| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 scoped_refptr<VideoCaptureController> controller_; | 94 scoped_refptr<VideoCaptureController> controller_; |
| 95 MessageLoop* message_loop_; | 95 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 | 100 class MockVideoCaptureManager |
| 101 : public media_stream::VideoCaptureManager { | 101 : public media_stream::VideoCaptureManager { |
| 102 public: | 102 public: |
| 103 MockVideoCaptureManager() | 103 MockVideoCaptureManager() |
| 104 : video_session_id_(kStartOpenSessionId) {} | 104 : VideoCaptureManager( |
| 105 content::MEDIA_STREAM_DEVICE_TYPE_USER_VIDEO_CAPTURE), |
| 106 video_session_id_(kStartOpenSessionId) {} |
| 105 | 107 |
| 106 void Init() { | 108 void Init() { |
| 107 device_name_.unique_id = "/dev/video0"; | 109 device_name_.unique_id = "/dev/video0"; |
| 108 device_name_.device_name = "fake_device_0"; | 110 device_name_.device_name = "fake_device_0"; |
| 109 | 111 |
| 110 video_capture_device_.reset( | 112 video_capture_device_.reset( |
| 111 media::FakeVideoCaptureDevice::Create(device_name_)); | 113 media::FakeVideoCaptureDevice::Create(device_name_)); |
| 112 ASSERT_TRUE(video_capture_device_.get() != NULL); | 114 ASSERT_TRUE(video_capture_device_.get() != NULL); |
| 113 } | 115 } |
| 114 | 116 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 message_loop_->PostDelayedTask( | 263 message_loop_->PostDelayedTask( |
| 262 FROM_HERE, MessageLoop::QuitClosure(), base::TimeDelta::FromSeconds(1)); | 264 FROM_HERE, MessageLoop::QuitClosure(), base::TimeDelta::FromSeconds(1)); |
| 263 message_loop_->Run(); | 265 message_loop_->Run(); |
| 264 | 266 |
| 265 EXPECT_CALL(*vcm_, | 267 EXPECT_CALL(*vcm_, |
| 266 StopCapture(vcm_->video_session_id_)) | 268 StopCapture(vcm_->video_session_id_)) |
| 267 .Times(1); | 269 .Times(1); |
| 268 controller_->StopCapture(controller_handler_->controller_id_, | 270 controller_->StopCapture(controller_handler_->controller_id_, |
| 269 controller_handler_.get()); | 271 controller_handler_.get()); |
| 270 } | 272 } |
| OLD | NEW |