| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 DISALLOW_COPY_AND_ASSIGN(MockVideoCaptureManager); | 144 DISALLOW_COPY_AND_ASSIGN(MockVideoCaptureManager); |
| 145 }; | 145 }; |
| 146 | 146 |
| 147 // Test class. | 147 // Test class. |
| 148 class VideoCaptureControllerTest : public testing::Test { | 148 class VideoCaptureControllerTest : public testing::Test { |
| 149 public: | 149 public: |
| 150 VideoCaptureControllerTest() {} | 150 VideoCaptureControllerTest() {} |
| 151 virtual ~VideoCaptureControllerTest() {} | 151 virtual ~VideoCaptureControllerTest() {} |
| 152 | 152 |
| 153 protected: | 153 protected: |
| 154 virtual void SetUp() { | 154 virtual void SetUp() OVERRIDE { |
| 155 message_loop_.reset(new MessageLoop(MessageLoop::TYPE_IO)); | 155 message_loop_.reset(new MessageLoop(MessageLoop::TYPE_IO)); |
| 156 file_thread_.reset(new BrowserThreadImpl(BrowserThread::FILE, | 156 file_thread_.reset(new BrowserThreadImpl(BrowserThread::FILE, |
| 157 message_loop_.get())); | 157 message_loop_.get())); |
| 158 io_thread_.reset(new BrowserThreadImpl(BrowserThread::IO, | 158 io_thread_.reset(new BrowserThreadImpl(BrowserThread::IO, |
| 159 message_loop_.get())); | 159 message_loop_.get())); |
| 160 | 160 |
| 161 vcm_ = new MockVideoCaptureManager(); | 161 vcm_ = new MockVideoCaptureManager(); |
| 162 vcm_->Init(); | 162 vcm_->Init(); |
| 163 controller_ = new VideoCaptureController(vcm_); | 163 controller_ = new VideoCaptureController(vcm_); |
| 164 controller_handler_.reset( | 164 controller_handler_.reset( |
| 165 new MockVideoCaptureControllerEventHandler(controller_.get(), | 165 new MockVideoCaptureControllerEventHandler(controller_.get(), |
| 166 message_loop_.get())); | 166 message_loop_.get())); |
| 167 } | 167 } |
| 168 | 168 |
| 169 virtual void TearDown() { | 169 virtual void TearDown() OVERRIDE {} |
| 170 } | |
| 171 | 170 |
| 172 scoped_ptr<MessageLoop> message_loop_; | 171 scoped_ptr<MessageLoop> message_loop_; |
| 173 scoped_ptr<BrowserThreadImpl> file_thread_; | 172 scoped_ptr<BrowserThreadImpl> file_thread_; |
| 174 scoped_ptr<BrowserThreadImpl> io_thread_; | 173 scoped_ptr<BrowserThreadImpl> io_thread_; |
| 175 scoped_refptr<MockVideoCaptureManager> vcm_; | 174 scoped_refptr<MockVideoCaptureManager> vcm_; |
| 176 scoped_ptr<MockVideoCaptureControllerEventHandler> controller_handler_; | 175 scoped_ptr<MockVideoCaptureControllerEventHandler> controller_handler_; |
| 177 scoped_refptr<VideoCaptureController> controller_; | 176 scoped_refptr<VideoCaptureController> controller_; |
| 178 | 177 |
| 179 private: | 178 private: |
| 180 DISALLOW_COPY_AND_ASSIGN(VideoCaptureControllerTest); | 179 DISALLOW_COPY_AND_ASSIGN(VideoCaptureControllerTest); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 message_loop_->PostDelayedTask( | 261 message_loop_->PostDelayedTask( |
| 263 FROM_HERE, MessageLoop::QuitClosure(), base::TimeDelta::FromSeconds(1)); | 262 FROM_HERE, MessageLoop::QuitClosure(), base::TimeDelta::FromSeconds(1)); |
| 264 message_loop_->Run(); | 263 message_loop_->Run(); |
| 265 | 264 |
| 266 EXPECT_CALL(*vcm_, | 265 EXPECT_CALL(*vcm_, |
| 267 StopCapture(vcm_->video_session_id_)) | 266 StopCapture(vcm_->video_session_id_)) |
| 268 .Times(1); | 267 .Times(1); |
| 269 controller_->StopCapture(controller_handler_->controller_id_, | 268 controller_->StopCapture(controller_handler_->controller_id_, |
| 270 controller_handler_.get()); | 269 controller_handler_.get()); |
| 271 } | 270 } |
| OLD | NEW |