| 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 VideoCaptureController. | 5 // Unit test for VideoCaptureController. |
| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 93 |
| 94 scoped_refptr<VideoCaptureController> controller_; | 94 scoped_refptr<VideoCaptureController> controller_; |
| 95 base::MessageLoop* message_loop_; | 95 base::MessageLoop* message_loop_; |
| 96 VideoCaptureControllerID controller_id_; | 96 VideoCaptureControllerID controller_id_; |
| 97 base::ProcessHandle process_handle_; | 97 base::ProcessHandle process_handle_; |
| 98 }; | 98 }; |
| 99 | 99 |
| 100 class MockVideoCaptureManager : public VideoCaptureManager { | 100 class MockVideoCaptureManager : public VideoCaptureManager { |
| 101 public: | 101 public: |
| 102 MockVideoCaptureManager() | 102 MockVideoCaptureManager() |
| 103 : video_session_id_(kStartOpenSessionId) {} | 103 : video_session_id_(kStartOpenSessionId), |
| 104 device_name_("fake_device_0", "/dev/video0") {} |
| 104 | 105 |
| 105 void Init() { | 106 void Init() { |
| 106 device_name_.unique_id = "/dev/video0"; | |
| 107 device_name_.device_name = "fake_device_0"; | |
| 108 | |
| 109 video_capture_device_.reset( | 107 video_capture_device_.reset( |
| 110 media::FakeVideoCaptureDevice::Create(device_name_)); | 108 media::FakeVideoCaptureDevice::Create(device_name_)); |
| 111 ASSERT_TRUE(video_capture_device_.get() != NULL); | 109 ASSERT_TRUE(video_capture_device_.get() != NULL); |
| 112 } | 110 } |
| 113 | 111 |
| 114 MOCK_METHOD3(StartCapture, void(int, int, | 112 MOCK_METHOD3(StartCapture, void(int, int, |
| 115 media::VideoCaptureDevice::EventHandler*)); | 113 media::VideoCaptureDevice::EventHandler*)); |
| 116 MOCK_METHOD1(StopCapture, void(const media::VideoCaptureSessionId&)); | 114 MOCK_METHOD1(StopCapture, void(const media::VideoCaptureSessionId&)); |
| 117 | 115 |
| 118 void Start(const media::VideoCaptureParams& capture_params, | 116 void Start(const media::VideoCaptureParams& capture_params, |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 message_loop_->PostDelayedTask(FROM_HERE, | 250 message_loop_->PostDelayedTask(FROM_HERE, |
| 253 base::MessageLoop::QuitClosure(), base::TimeDelta::FromSeconds(1)); | 251 base::MessageLoop::QuitClosure(), base::TimeDelta::FromSeconds(1)); |
| 254 message_loop_->Run(); | 252 message_loop_->Run(); |
| 255 | 253 |
| 256 EXPECT_CALL(*vcm_.get(), StopCapture(vcm_->video_session_id_)).Times(1); | 254 EXPECT_CALL(*vcm_.get(), StopCapture(vcm_->video_session_id_)).Times(1); |
| 257 controller_->StopCapture(controller_handler_->controller_id_, | 255 controller_->StopCapture(controller_handler_->controller_id_, |
| 258 controller_handler_.get()); | 256 controller_handler_.get()); |
| 259 } | 257 } |
| 260 | 258 |
| 261 } // namespace content | 259 } // namespace content |
| OLD | NEW |