Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Unified Diff: content/browser/renderer_host/media/video_capture_controller_unittest.cc

Issue 10662049: Move the device enumerate/open/close work to device thread from IO thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ready for review. Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/media/video_capture_controller_unittest.cc
diff --git a/content/browser/renderer_host/media/video_capture_controller_unittest.cc b/content/browser/renderer_host/media/video_capture_controller_unittest.cc
index 47c0c29786d9234d54828c40f114fd7a21b8666b..f381b262b53a8e4068adb95eb65e806688c8e80c 100644
--- a/content/browser/renderer_host/media/video_capture_controller_unittest.cc
+++ b/content/browser/renderer_host/media/video_capture_controller_unittest.cc
@@ -100,8 +100,9 @@ class MockVideoCaptureControllerEventHandler
class MockVideoCaptureManager
: public media_stream::VideoCaptureManager {
public:
- MockVideoCaptureManager()
- : video_session_id_(kStartOpenSessionId) {}
+ MockVideoCaptureManager(scoped_refptr<base::MessageLoopProxy> message_loop)
+ : media_stream::VideoCaptureManager(message_loop),
+ video_session_id_(kStartOpenSessionId) {}
void Init() {
device_name_.unique_id = "/dev/video0";
@@ -158,7 +159,10 @@ class VideoCaptureControllerTest : public testing::Test {
io_thread_.reset(new BrowserThreadImpl(BrowserThread::IO,
message_loop_.get()));
- vcm_ = new MockVideoCaptureManager();
+ device_thread_.reset(new base::Thread("VideoCaptureControllerTestThread"));
+ CHECK(device_thread_->Start());
+
+ vcm_ = new MockVideoCaptureManager(device_thread_->message_loop_proxy());
vcm_->Init();
controller_ = new VideoCaptureController(vcm_);
controller_handler_.reset(
@@ -167,11 +171,13 @@ class VideoCaptureControllerTest : public testing::Test {
}
virtual void TearDown() {
+ device_thread_->Stop();
}
scoped_ptr<MessageLoop> message_loop_;
scoped_ptr<BrowserThreadImpl> file_thread_;
scoped_ptr<BrowserThreadImpl> io_thread_;
+ scoped_ptr<base::Thread> device_thread_;
scoped_refptr<MockVideoCaptureManager> vcm_;
scoped_ptr<MockVideoCaptureControllerEventHandler> controller_handler_;
scoped_refptr<VideoCaptureController> controller_;

Powered by Google App Engine
This is Rietveld 408576698