Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Side by Side Diff: remoting/host/video_frame_capturer_unittest.cc

Issue 10790075: Rename Capturer to VideoFrameCapturer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased. Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "remoting/host/video_frame_capturer.h"
6
7 #include "base/bind.h"
8 #if defined(OS_MACOSX)
9 #include "base/mac/mac_util.h"
10 #endif // defined(OS_MACOSX)
11 #include "remoting/base/capture_data.h"
12 #include "remoting/host/host_mock_objects.h"
13 #include "remoting/protocol/protocol_mock_objects.h"
14 #include "testing/gmock/include/gmock/gmock.h"
15 #include "testing/gtest/include/gtest/gtest.h"
16
17 namespace remoting {
18
19 namespace {
20
21 bool IsOsSupported() {
22 #if defined(OS_MACOSX)
23 // Verify that the OS is at least Snow Leopard (10.6).
24 // Chromoting doesn't support 10.5 or earlier.
25 return base::mac::IsOSSnowLeopardOrLater();
26 #else
27 return true;
28 #endif
29 }
30
31 void IgnoreCursorShapeChanged(scoped_ptr<protocol::CursorShapeInfo> info) {
32 }
33
34 } // namespace
35
36 MATCHER(DirtyRegionIsNonEmptyRect, "") {
37 const SkRegion& dirty_region = arg->dirty_region();
38 const SkIRect& dirty_region_bounds = dirty_region.getBounds();
39 if (dirty_region_bounds.isEmpty()) {
40 return false;
41 }
42 return dirty_region == SkRegion(dirty_region_bounds);
43 }
44
45 class VideoFrameCapturerTest : public testing::Test {
46 protected:
47 virtual void SetUp() OVERRIDE {
48 capturer_.reset(VideoFrameCapturer::Create());
49 }
50
51 scoped_ptr<VideoFrameCapturer> capturer_;
52 MockCaptureCompletedCallback capture_completed_callback_;
53 };
54
55 TEST_F(VideoFrameCapturerTest, StartCapturer) {
56 if (!IsOsSupported()) {
57 return;
58 }
59
60 capturer_->Start(base::Bind(&IgnoreCursorShapeChanged));
61 capturer_->Stop();
62 }
63
64 #if defined(OS_MACOSX)
65 #define MAYBE_Capture DISABLED_Capture
66 #else
67 #define MAYBE_Capture Capture
68 #endif
69
70 TEST_F(VideoFrameCapturerTest, MAYBE_Capture) {
71 if (!IsOsSupported()) {
72 return;
73 }
74
75 // Assume that Start() treats the screen as invalid initially.
76 EXPECT_CALL(capture_completed_callback_,
77 CaptureCompletedPtr(DirtyRegionIsNonEmptyRect()));
78
79 capturer_->Start(base::Bind(&IgnoreCursorShapeChanged));
80 capturer_->CaptureInvalidRegion(base::Bind(
81 &MockCaptureCompletedCallback::CaptureCompleted,
82 base::Unretained(&capture_completed_callback_)));
83 capturer_->Stop();
84 }
85
86 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/video_frame_capturer_mac_unittest.cc ('k') | remoting/host/video_frame_capturer_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698