| Index: content/browser/renderer_host/media/video_capture_host_unittest.cc
|
| ===================================================================
|
| --- content/browser/renderer_host/media/video_capture_host_unittest.cc (revision 164646)
|
| +++ content/browser/renderer_host/media/video_capture_host_unittest.cc (working copy)
|
| @@ -31,15 +31,15 @@
|
| using ::testing::InSequence;
|
| using ::testing::Mock;
|
| using ::testing::Return;
|
| -using content::BrowserThread;
|
| -using content::BrowserThreadImpl;
|
|
|
| +namespace content {
|
| +
|
| // Id used to identify the capture session between renderer and
|
| // video_capture_host.
|
| static const int kDeviceId = 1;
|
| // Id of a video capture device
|
| static const media::VideoCaptureSessionId kTestFakeDeviceId =
|
| - media_stream::VideoCaptureManager::kStartOpenSessionId;
|
| + VideoCaptureManager::kStartOpenSessionId;
|
|
|
| // Define to enable test where video is dumped to file.
|
| // #define DUMP_VIDEO
|
| @@ -71,7 +71,7 @@
|
|
|
| class MockVideoCaptureHost : public VideoCaptureHost {
|
| public:
|
| - MockVideoCaptureHost(media_stream::MediaStreamManager* manager)
|
| + MockVideoCaptureHost(MediaStreamManager* manager)
|
| : VideoCaptureHost(),
|
| return_buffers_(false),
|
| dump_video_(false),
|
| @@ -83,8 +83,7 @@
|
| int length, int buffer_id));
|
| MOCK_METHOD3(OnBufferFilled,
|
| void(int device_id, int buffer_id, base::Time timestamp));
|
| - MOCK_METHOD2(OnStateChanged,
|
| - void(int device_id, video_capture::State state));
|
| + MOCK_METHOD2(OnStateChanged, void(int device_id, VideoCaptureState state));
|
| MOCK_METHOD1(OnDeviceInfo, void(int device_id));
|
|
|
| // Use class DumpVideo to write I420 video to file.
|
| @@ -144,7 +143,7 @@
|
| return true;
|
| }
|
|
|
| - virtual media_stream::VideoCaptureManager* GetVideoCaptureManager() OVERRIDE {
|
| + virtual VideoCaptureManager* GetVideoCaptureManager() OVERRIDE {
|
| return manager_->video_capture_manager();
|
| }
|
|
|
| @@ -172,8 +171,7 @@
|
| }
|
| }
|
|
|
| - void OnStateChangedDispatch(int device_id,
|
| - video_capture::State state) {
|
| + void OnStateChangedDispatch(int device_id, VideoCaptureState state) {
|
| OnStateChanged(device_id, state);
|
| }
|
|
|
| @@ -189,7 +187,7 @@
|
| bool return_buffers_;
|
| bool dump_video_;
|
| DumpVideo dumper_;
|
| - media_stream::MediaStreamManager* manager_;
|
| + MediaStreamManager* manager_;
|
| };
|
|
|
| ACTION_P(ExitMessageLoop, message_loop) {
|
| @@ -211,8 +209,7 @@
|
|
|
| // Create our own MediaStreamManager.
|
| audio_manager_.reset(media::AudioManager::Create());
|
| - media_stream_manager_.reset(
|
| - new media_stream::MediaStreamManager(audio_manager_.get()));
|
| + media_stream_manager_.reset(new MediaStreamManager(audio_manager_.get()));
|
| #ifndef TEST_REAL_CAPTURE_DEVICE
|
| media_stream_manager_->UseFakeDevice();
|
| #endif
|
| @@ -229,7 +226,7 @@
|
| Mock::VerifyAndClearExpectations(host_);
|
|
|
| EXPECT_CALL(*host_, OnStateChanged(kDeviceId,
|
| - video_capture::kStopped))
|
| + VIDEO_CAPTURE_STATE_STOPPED))
|
| .Times(AnyNumber());
|
|
|
| // Simulate closing the IPC channel.
|
| @@ -254,7 +251,7 @@
|
|
|
| // 2. Change state to started
|
| EXPECT_CALL(*host_, OnStateChanged(kDeviceId,
|
| - video_capture::kStarted));
|
| + VIDEO_CAPTURE_STATE_STARTED));
|
|
|
| // 3. Newly created buffers will arrive.
|
| EXPECT_CALL(*host_, OnNewBufferCreated(kDeviceId, _, _, _))
|
| @@ -282,8 +279,7 @@
|
| EXPECT_CALL(*host_, OnDeviceInfo(kDeviceId));
|
|
|
| // 2. Change state to started
|
| - EXPECT_CALL(*host_, OnStateChanged(kDeviceId,
|
| - video_capture::kStarted));
|
| + EXPECT_CALL(*host_, OnStateChanged(kDeviceId, VIDEO_CAPTURE_STATE_STARTED));
|
|
|
| // 3. First filled buffer will arrive.
|
| EXPECT_CALL(*host_, OnBufferFilled(kDeviceId, _, _))
|
| @@ -303,7 +299,7 @@
|
|
|
| void StopCapture() {
|
| EXPECT_CALL(*host_, OnStateChanged(kDeviceId,
|
| - video_capture::kStopped))
|
| + VIDEO_CAPTURE_STATE_STOPPED))
|
| .WillOnce(ExitMessageLoop(message_loop_.get()));
|
|
|
| host_->OnStopCapture(kDeviceId);
|
| @@ -331,8 +327,7 @@
|
|
|
| void SimulateError() {
|
| // Expect a change state to error state sent through IPC.
|
| - EXPECT_CALL(*host_, OnStateChanged(kDeviceId,
|
| - video_capture::kError))
|
| + EXPECT_CALL(*host_, OnStateChanged(kDeviceId, VIDEO_CAPTURE_STATE_ERROR))
|
| .Times(1);
|
| VideoCaptureControllerID id(kDeviceId);
|
| host_->OnError(id);
|
| @@ -346,7 +341,7 @@
|
| scoped_ptr<MessageLoop> message_loop_;
|
| scoped_ptr<BrowserThreadImpl> io_thread_;
|
| scoped_ptr<media::AudioManager> audio_manager_;
|
| - scoped_ptr<media_stream::MediaStreamManager> media_stream_manager_;
|
| + scoped_ptr<MediaStreamManager> media_stream_manager_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(VideoCaptureHostTest);
|
| };
|
| @@ -371,7 +366,7 @@
|
|
|
| TEST_F(VideoCaptureHostTest, StartCaptureError) {
|
| EXPECT_CALL(*host_, OnStateChanged(kDeviceId,
|
| - video_capture::kStopped))
|
| + VIDEO_CAPTURE_STATE_STOPPED))
|
| .Times(0);
|
| StartCapture();
|
| NotifyPacketReady();
|
| @@ -387,3 +382,5 @@
|
| CaptureAndDumpVideo(1280, 720, 30);
|
| }
|
| #endif
|
| +
|
| +} // namespace content
|
|
|