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

Side by Side Diff: media/video/capture/screen/screen_capture_device_unittest.cc

Issue 15692018: Remove screen capturers from media/video/capture/screen. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/video/capture/screen/screen_capture_device.h" 5 #include "media/video/capture/screen/screen_capture_device.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/sequenced_task_runner.h" 8 #include "base/sequenced_task_runner.h"
9 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "base/test/test_timeouts.h" 10 #include "base/test/test_timeouts.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 base::Time timestamp, 42 base::Time timestamp,
43 int rotation, 43 int rotation,
44 bool flip_vert, 44 bool flip_vert,
45 bool flip_horiz)); 45 bool flip_horiz));
46 MOCK_METHOD2(OnIncomingCapturedVideoFrame, 46 MOCK_METHOD2(OnIncomingCapturedVideoFrame,
47 void(const scoped_refptr<media::VideoFrame>& frame, 47 void(const scoped_refptr<media::VideoFrame>& frame,
48 base::Time timestamp)); 48 base::Time timestamp));
49 }; 49 };
50 50
51 // TODO(sergeyu): Move this to a separate file where it can be reused. 51 // TODO(sergeyu): Move this to a separate file where it can be reused.
52 class FakeScreenCapturer : public ScreenCapturer { 52 class FakeScreenCapturer : public webrtc::ScreenCapturer {
53 public: 53 public:
54 FakeScreenCapturer() 54 FakeScreenCapturer()
55 : callback_(NULL), 55 : callback_(NULL),
56 frame_index_(0) { 56 frame_index_(0) {
57 } 57 }
58 virtual ~FakeScreenCapturer() {} 58 virtual ~FakeScreenCapturer() {}
59 59
60 // VideoFrameCapturer interface. 60 // VideoFrameCapturer interface.
61 virtual void Start(Callback* callback) OVERRIDE { 61 virtual void Start(Callback* callback) OVERRIDE {
62 callback_ = callback; 62 callback_ = callback;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 EXPECT_EQ(caps.width * caps.height * 4, frame_size); 126 EXPECT_EQ(caps.width * caps.height * 4, frame_size);
127 } 127 }
128 128
129 // Test that screen capturer can handle resolution change without crashing. 129 // Test that screen capturer can handle resolution change without crashing.
130 TEST_F(ScreenCaptureDeviceTest, ScreenResolutionChange) { 130 TEST_F(ScreenCaptureDeviceTest, ScreenResolutionChange) {
131 FakeScreenCapturer* mock_capturer = new FakeScreenCapturer(); 131 FakeScreenCapturer* mock_capturer = new FakeScreenCapturer();
132 132
133 ScreenCaptureDevice capture_device( 133 ScreenCaptureDevice capture_device(
134 worker_pool_->GetSequencedTaskRunner(worker_pool_->GetSequenceToken())); 134 worker_pool_->GetSequencedTaskRunner(worker_pool_->GetSequenceToken()));
135 capture_device.SetScreenCapturerForTest( 135 capture_device.SetScreenCapturerForTest(
136 scoped_ptr<ScreenCapturer>(mock_capturer)); 136 scoped_ptr<webrtc::ScreenCapturer>(mock_capturer));
137 137
138 VideoCaptureCapability caps; 138 VideoCaptureCapability caps;
139 base::WaitableEvent done_event(false, false); 139 base::WaitableEvent done_event(false, false);
140 int frame_size; 140 int frame_size;
141 141
142 MockFrameObserver frame_observer; 142 MockFrameObserver frame_observer;
143 EXPECT_CALL(frame_observer, OnFrameInfo(_)) 143 EXPECT_CALL(frame_observer, OnFrameInfo(_))
144 .WillOnce(SaveArg<0>(&caps)); 144 .WillOnce(SaveArg<0>(&caps));
145 EXPECT_CALL(frame_observer, OnError()) 145 EXPECT_CALL(frame_observer, OnError())
146 .Times(0); 146 .Times(0);
(...skipping 15 matching lines...) Expand all
162 EXPECT_EQ(kTestFrameWidth1, caps.width); 162 EXPECT_EQ(kTestFrameWidth1, caps.width);
163 EXPECT_EQ(kTestFrameHeight1, caps.height); 163 EXPECT_EQ(kTestFrameHeight1, caps.height);
164 EXPECT_EQ(kFrameRate, caps.frame_rate); 164 EXPECT_EQ(kFrameRate, caps.frame_rate);
165 EXPECT_EQ(VideoCaptureCapability::kARGB, caps.color); 165 EXPECT_EQ(VideoCaptureCapability::kARGB, caps.color);
166 EXPECT_FALSE(caps.interlaced); 166 EXPECT_FALSE(caps.interlaced);
167 167
168 EXPECT_EQ(caps.width * caps.height * 4, frame_size); 168 EXPECT_EQ(caps.width * caps.height * 4, frame_size);
169 } 169 }
170 170
171 } // namespace media 171 } // namespace media
OLDNEW
« no previous file with comments | « media/video/capture/screen/screen_capture_device.cc ('k') | media/video/capture/screen/screen_capture_frame_queue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698