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

Unified Diff: content/browser/renderer_host/media/video_capture_manager_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_manager_unittest.cc
diff --git a/content/browser/renderer_host/media/video_capture_manager_unittest.cc b/content/browser/renderer_host/media/video_capture_manager_unittest.cc
index 9b18576af8ef152ecb657d3ec29164196646977a..a4c88298e5226cdaf3eb9fb8cc7571a3c64e3e1a 100644
--- a/content/browser/renderer_host/media/video_capture_manager_unittest.cc
+++ b/content/browser/renderer_host/media/video_capture_manager_unittest.cc
@@ -73,13 +73,7 @@ class MockFrameObserver: public media::VideoCaptureDevice::EventHandler {
// Test class
class VideoCaptureManagerTest : public testing::Test {
public:
- VideoCaptureManagerTest()
- : vcm_(),
- listener_(),
- message_loop_(),
- io_thread_(),
- frame_observer_() {
- }
+ VideoCaptureManagerTest() {}
virtual ~VideoCaptureManagerTest() {}
protected:
@@ -88,7 +82,10 @@ class VideoCaptureManagerTest : public testing::Test {
message_loop_.reset(new MessageLoop(MessageLoop::TYPE_IO));
io_thread_.reset(new BrowserThreadImpl(BrowserThread::IO,
message_loop_.get()));
- vcm_ = new media_stream::VideoCaptureManager();
+ device_thread_.reset(new base::Thread("VideoCaptureManagerTestThread"));
+ CHECK(device_thread_->Start());
+ vcm_ = new media_stream::VideoCaptureManager(
+ device_thread_->message_loop_proxy());
vcm_->UseFakeDevice();
vcm_->Register(listener_.get());
frame_observer_.reset(new MockFrameObserver());
@@ -96,6 +93,7 @@ class VideoCaptureManagerTest : public testing::Test {
virtual void TearDown() {
io_thread_.reset();
+ device_thread_->Stop();
scherkus (not reviewing) 2012/06/27 00:52:31 nit: should we be stopping/resetting the threads i
no longer working on chromium 2012/06/27 14:07:16 I will remove the device_thread_ here and inject t
}
// Called on the VideoCaptureManager thread.
@@ -105,8 +103,8 @@ class VideoCaptureManagerTest : public testing::Test {
// Called on the main thread.
static void PostQuitOnVideoCaptureManagerThread(
- MessageLoop* message_loop, media_stream::VideoCaptureManager* vcm) {
- vcm->GetMessageLoop()->PostTask(
+ MessageLoop* message_loop, MessageLoop* device_message_loop) {
+ device_message_loop->PostTask(
FROM_HERE, base::Bind(&PostQuitMessageLoop, message_loop));
}
@@ -119,13 +117,14 @@ class VideoCaptureManagerTest : public testing::Test {
message_loop_->PostTask(
FROM_HERE, base::Bind(&PostQuitOnVideoCaptureManagerThread,
message_loop_.get(),
- vcm_));
+ device_thread_->message_loop()));
message_loop_->Run();
}
scoped_refptr<media_stream::VideoCaptureManager> vcm_;
scoped_ptr<media_stream::MockMediaStreamProviderListener> listener_;
scoped_ptr<MessageLoop> message_loop_;
scoped_ptr<BrowserThreadImpl> io_thread_;
+ scoped_ptr<base::Thread> device_thread_;
scoped_ptr<MockFrameObserver> frame_observer_;
private:

Powered by Google App Engine
This is Rietveld 408576698