| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 // Unit test for VideoCaptureManager. | 5 // Unit test for VideoCaptureManager. |
| 6 | 6 |
| 7 #include "content/browser/renderer_host/media/video_capture_manager.h" | 7 #include "content/browser/renderer_host/media/video_capture_manager.h" |
| 8 | 8 |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 MOCK_METHOD2(Closed, void(MediaStreamType, int)); | 131 MOCK_METHOD2(Closed, void(MediaStreamType, int)); |
| 132 MOCK_METHOD2(Aborted, void(MediaStreamType, int)); | 132 MOCK_METHOD2(Aborted, void(MediaStreamType, int)); |
| 133 }; // class MockMediaStreamProviderListener | 133 }; // class MockMediaStreamProviderListener |
| 134 | 134 |
| 135 // Needed as an input argument to StartCaptureForClient(). | 135 // Needed as an input argument to StartCaptureForClient(). |
| 136 class MockFrameObserver : public VideoCaptureControllerEventHandler { | 136 class MockFrameObserver : public VideoCaptureControllerEventHandler { |
| 137 public: | 137 public: |
| 138 MOCK_METHOD1(OnError, void(VideoCaptureControllerID id)); | 138 MOCK_METHOD1(OnError, void(VideoCaptureControllerID id)); |
| 139 | 139 |
| 140 void OnBufferCreated(VideoCaptureControllerID id, | 140 void OnBufferCreated(VideoCaptureControllerID id, |
| 141 base::SharedMemoryHandle handle, | 141 mojo::ScopedSharedBufferHandle handle, |
| 142 int length, int buffer_id) override {} | 142 int length, int buffer_id) override {} |
| 143 void OnBufferDestroyed(VideoCaptureControllerID id, int buffer_id) override {} | 143 void OnBufferDestroyed(VideoCaptureControllerID id, int buffer_id) override {} |
| 144 void OnBufferReady(VideoCaptureControllerID id, | 144 void OnBufferReady(VideoCaptureControllerID id, |
| 145 int buffer_id, | 145 int buffer_id, |
| 146 const scoped_refptr<media::VideoFrame>& frame) override {} | 146 const scoped_refptr<media::VideoFrame>& frame) override {} |
| 147 void OnEnded(VideoCaptureControllerID id) override {} | 147 void OnEnded(VideoCaptureControllerID id) override {} |
| 148 | 148 |
| 149 void OnGotControllerCallback(VideoCaptureControllerID) {} | 149 void OnGotControllerCallback(VideoCaptureControllerID) {} |
| 150 }; | 150 }; |
| 151 | 151 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 | 212 |
| 213 VideoCaptureControllerID StartClient(int session_id, bool expect_success) { | 213 VideoCaptureControllerID StartClient(int session_id, bool expect_success) { |
| 214 media::VideoCaptureParams params; | 214 media::VideoCaptureParams params; |
| 215 params.requested_format = media::VideoCaptureFormat( | 215 params.requested_format = media::VideoCaptureFormat( |
| 216 gfx::Size(320, 240), 30, media::PIXEL_FORMAT_I420); | 216 gfx::Size(320, 240), 30, media::PIXEL_FORMAT_I420); |
| 217 | 217 |
| 218 VideoCaptureControllerID client_id(next_client_id_++); | 218 VideoCaptureControllerID client_id(next_client_id_++); |
| 219 vcm_->StartCaptureForClient( | 219 vcm_->StartCaptureForClient( |
| 220 session_id, | 220 session_id, |
| 221 params, | 221 params, |
| 222 base::kNullProcessHandle, | |
| 223 client_id, | 222 client_id, |
| 224 frame_observer_.get(), | 223 frame_observer_.get(), |
| 225 base::Bind(&VideoCaptureManagerTest::OnGotControllerCallback, | 224 base::Bind(&VideoCaptureManagerTest::OnGotControllerCallback, |
| 226 base::Unretained(this), | 225 base::Unretained(this), |
| 227 client_id, | 226 client_id, |
| 228 expect_success)); | 227 expect_success)); |
| 229 base::RunLoop().RunUntilIdle(); | 228 base::RunLoop().RunUntilIdle(); |
| 230 return client_id; | 229 return client_id; |
| 231 } | 230 } |
| 232 | 231 |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 // Wait to check callbacks before removing the listener. | 627 // Wait to check callbacks before removing the listener. |
| 629 base::RunLoop().RunUntilIdle(); | 628 base::RunLoop().RunUntilIdle(); |
| 630 vcm_->Unregister(); | 629 vcm_->Unregister(); |
| 631 } | 630 } |
| 632 #endif | 631 #endif |
| 633 | 632 |
| 634 // TODO(mcasas): Add a test to check consolidation of the supported formats | 633 // TODO(mcasas): Add a test to check consolidation of the supported formats |
| 635 // provided by the device when http://crbug.com/323913 is closed. | 634 // provided by the device when http://crbug.com/323913 is closed. |
| 636 | 635 |
| 637 } // namespace content | 636 } // namespace content |
| OLD | NEW |