OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 VideoCaptureManager | 5 // Unit test for VideoCaptureManager |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 vcm_->Register(listener_.get()); | 92 vcm_->Register(listener_.get()); |
93 frame_observer_.reset(new MockFrameObserver()); | 93 frame_observer_.reset(new MockFrameObserver()); |
94 } | 94 } |
95 | 95 |
96 virtual void TearDown() { | 96 virtual void TearDown() { |
97 io_thread_.reset(); | 97 io_thread_.reset(); |
98 } | 98 } |
99 | 99 |
100 // Called on the VideoCaptureManager thread. | 100 // Called on the VideoCaptureManager thread. |
101 static void PostQuitMessageLoop(MessageLoop* message_loop) { | 101 static void PostQuitMessageLoop(MessageLoop* message_loop) { |
102 message_loop->PostTask(FROM_HERE, new MessageLoop::QuitTask()); | 102 message_loop->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
103 } | 103 } |
104 | 104 |
105 // Called on the main thread. | 105 // Called on the main thread. |
106 static void PostQuitOnVideoCaptureManagerThread( | 106 static void PostQuitOnVideoCaptureManagerThread( |
107 MessageLoop* message_loop, media_stream::VideoCaptureManager* vcm) { | 107 MessageLoop* message_loop, media_stream::VideoCaptureManager* vcm) { |
108 vcm->GetMessageLoop()->PostTask( | 108 vcm->GetMessageLoop()->PostTask( |
109 FROM_HERE, base::Bind(&PostQuitMessageLoop, message_loop)); | 109 FROM_HERE, base::Bind(&PostQuitMessageLoop, message_loop)); |
110 } | 110 } |
111 | 111 |
112 // SyncWithVideoCaptureManagerThread() waits until all pending tasks on the | 112 // SyncWithVideoCaptureManagerThread() waits until all pending tasks on the |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 vcm_->Open(*it); | 301 vcm_->Open(*it); |
302 | 302 |
303 // Wait to check callbacks before removing the listener | 303 // Wait to check callbacks before removing the listener |
304 SyncWithVideoCaptureManagerThread(); | 304 SyncWithVideoCaptureManagerThread(); |
305 | 305 |
306 // Delete the manager. | 306 // Delete the manager. |
307 vcm_.reset(); | 307 vcm_.reset(); |
308 } | 308 } |
309 | 309 |
310 } // namespace | 310 } // namespace |
OLD | NEW |