| 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 <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 MediaStreamProviderError)); | 42 MediaStreamProviderError)); |
| 43 }; // class MockMediaStreamProviderListener | 43 }; // class MockMediaStreamProviderListener |
| 44 | 44 |
| 45 // Needed as an input argument to StartCaptureForClient(). | 45 // Needed as an input argument to StartCaptureForClient(). |
| 46 class MockFrameObserver : public VideoCaptureControllerEventHandler { | 46 class MockFrameObserver : public VideoCaptureControllerEventHandler { |
| 47 public: | 47 public: |
| 48 MOCK_METHOD1(OnError, void(const VideoCaptureControllerID& id)); | 48 MOCK_METHOD1(OnError, void(const VideoCaptureControllerID& id)); |
| 49 | 49 |
| 50 virtual void OnBufferCreated(const VideoCaptureControllerID& id, | 50 virtual void OnBufferCreated(const VideoCaptureControllerID& id, |
| 51 base::SharedMemoryHandle handle, | 51 base::SharedMemoryHandle handle, |
| 52 int length, int buffer_id) OVERRIDE {}; | 52 int length, int buffer_id) OVERRIDE {} |
| 53 virtual void OnBufferReady(const VideoCaptureControllerID& id, | 53 virtual void OnBufferDestroyed(const VideoCaptureControllerID& id, |
| 54 int buffer_id, | 54 int buffer_id) OVERRIDE {} |
| 55 base::Time timestamp) OVERRIDE {}; | 55 virtual void OnBufferReady( |
| 56 virtual void OnFrameInfo( | |
| 57 const VideoCaptureControllerID& id, | 56 const VideoCaptureControllerID& id, |
| 58 const media::VideoCaptureCapability& format) OVERRIDE {}; | 57 int buffer_id, |
| 59 virtual void OnFrameInfoChanged(const VideoCaptureControllerID& id, | 58 base::Time timestamp, |
| 60 int width, | 59 const media::VideoCaptureFormat& format) OVERRIDE {} |
| 61 int height, | 60 virtual void OnEnded(const VideoCaptureControllerID& id) OVERRIDE {} |
| 62 int frame_rate) OVERRIDE {}; | |
| 63 virtual void OnEnded(const VideoCaptureControllerID& id) OVERRIDE {}; | |
| 64 | 61 |
| 65 void OnGotControllerCallback(VideoCaptureControllerID) {} | 62 void OnGotControllerCallback(VideoCaptureControllerID) {} |
| 66 }; | 63 }; |
| 67 | 64 |
| 68 // Test class | 65 // Test class |
| 69 class VideoCaptureManagerTest : public testing::Test { | 66 class VideoCaptureManagerTest : public testing::Test { |
| 70 public: | 67 public: |
| 71 VideoCaptureManagerTest() : next_client_id_(1) {} | 68 VideoCaptureManagerTest() : next_client_id_(1) {} |
| 72 virtual ~VideoCaptureManagerTest() {} | 69 virtual ~VideoCaptureManagerTest() {} |
| 73 | 70 |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 // VideoCaptureManager destructor otherwise. | 286 // VideoCaptureManager destructor otherwise. |
| 290 vcm_->Close(video_session_id); | 287 vcm_->Close(video_session_id); |
| 291 StopClient(client_id); | 288 StopClient(client_id); |
| 292 | 289 |
| 293 // Wait to check callbacks before removing the listener | 290 // Wait to check callbacks before removing the listener |
| 294 message_loop_->RunUntilIdle(); | 291 message_loop_->RunUntilIdle(); |
| 295 vcm_->Unregister(); | 292 vcm_->Unregister(); |
| 296 } | 293 } |
| 297 | 294 |
| 298 } // namespace content | 295 } // namespace content |
| OLD | NEW |