| 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 26 matching lines...) Expand all Loading... |
| 37 MOCK_METHOD2(Opened, void(MediaStreamType, int)); | 37 MOCK_METHOD2(Opened, void(MediaStreamType, int)); |
| 38 MOCK_METHOD2(Closed, void(MediaStreamType, int)); | 38 MOCK_METHOD2(Closed, void(MediaStreamType, int)); |
| 39 MOCK_METHOD2(DevicesEnumerated, void(MediaStreamType, | 39 MOCK_METHOD2(DevicesEnumerated, void(MediaStreamType, |
| 40 const StreamDeviceInfoArray&)); | 40 const StreamDeviceInfoArray&)); |
| 41 MOCK_METHOD2(Aborted, void(MediaStreamType, int)); | 41 MOCK_METHOD2(Aborted, void(MediaStreamType, int)); |
| 42 }; // class MockMediaStreamProviderListener | 42 }; // class MockMediaStreamProviderListener |
| 43 | 43 |
| 44 // Needed as an input argument to StartCaptureForClient(). | 44 // Needed as an input argument to StartCaptureForClient(). |
| 45 class MockFrameObserver : public VideoCaptureControllerEventHandler { | 45 class MockFrameObserver : public VideoCaptureControllerEventHandler { |
| 46 public: | 46 public: |
| 47 MOCK_METHOD1(OnError, void(const VideoCaptureControllerID& id)); | 47 MOCK_METHOD1(OnError, void(VideoCaptureControllerID id)); |
| 48 | 48 |
| 49 virtual void OnBufferCreated(const VideoCaptureControllerID& id, | 49 virtual void OnBufferCreated(VideoCaptureControllerID id, |
| 50 base::SharedMemoryHandle handle, | 50 base::SharedMemoryHandle handle, |
| 51 int length, int buffer_id) override {} | 51 int length, int buffer_id) override {} |
| 52 virtual void OnBufferDestroyed(const VideoCaptureControllerID& id, | 52 virtual void OnBufferDestroyed(VideoCaptureControllerID id, |
| 53 int buffer_id) override {} | 53 int buffer_id) override {} |
| 54 virtual void OnBufferReady( | 54 virtual void OnBufferReady( |
| 55 const VideoCaptureControllerID& id, | 55 VideoCaptureControllerID id, |
| 56 int buffer_id, | 56 int buffer_id, |
| 57 const gfx::Size& coded_size, | 57 const gfx::Size& coded_size, |
| 58 const gfx::Rect& visible_rect, | 58 const gfx::Rect& visible_rect, |
| 59 base::TimeTicks timestamp, | 59 const base::TimeTicks& timestamp, |
| 60 scoped_ptr<base::DictionaryValue> metadata) override {} | 60 scoped_ptr<base::DictionaryValue> metadata) override {} |
| 61 virtual void OnMailboxBufferReady( | 61 virtual void OnMailboxBufferReady( |
| 62 const VideoCaptureControllerID& id, | 62 VideoCaptureControllerID id, |
| 63 int buffer_id, | 63 int buffer_id, |
| 64 const gpu::MailboxHolder& mailbox_holder, | 64 const gpu::MailboxHolder& mailbox_holder, |
| 65 const gfx::Size& packed_frame_size, | 65 const gfx::Size& packed_frame_size, |
| 66 base::TimeTicks timestamp, | 66 const base::TimeTicks& timestamp, |
| 67 scoped_ptr<base::DictionaryValue> metadata) override {} | 67 scoped_ptr<base::DictionaryValue> metadata) override {} |
| 68 virtual void OnEnded(const VideoCaptureControllerID& id) override {} | 68 virtual void OnEnded(VideoCaptureControllerID id) override {} |
| 69 | 69 |
| 70 void OnGotControllerCallback(VideoCaptureControllerID) {} | 70 void OnGotControllerCallback(VideoCaptureControllerID) {} |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 // Test class | 73 // Test class |
| 74 class VideoCaptureManagerTest : public testing::Test { | 74 class VideoCaptureManagerTest : public testing::Test { |
| 75 public: | 75 public: |
| 76 VideoCaptureManagerTest() : next_client_id_(1) {} | 76 VideoCaptureManagerTest() : next_client_id_(1) {} |
| 77 ~VideoCaptureManagerTest() override {} | 77 ~VideoCaptureManagerTest() override {} |
| 78 | 78 |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 | 514 |
| 515 // Wait to check callbacks before removing the listener | 515 // Wait to check callbacks before removing the listener |
| 516 message_loop_->RunUntilIdle(); | 516 message_loop_->RunUntilIdle(); |
| 517 vcm_->Unregister(); | 517 vcm_->Unregister(); |
| 518 } | 518 } |
| 519 | 519 |
| 520 // TODO(mcasas): Add a test to check consolidation of the supported formats | 520 // TODO(mcasas): Add a test to check consolidation of the supported formats |
| 521 // provided by the device when http://crbug.com/323913 is closed. | 521 // provided by the device when http://crbug.com/323913 is closed. |
| 522 | 522 |
| 523 } // namespace content | 523 } // namespace content |
| OLD | NEW |