| 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 #include <map> | 5 #include <map> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 OnDeviceInfo(device_id); | 178 OnDeviceInfo(device_id); |
| 179 } | 179 } |
| 180 | 180 |
| 181 std::map<int, base::SharedMemory*> filled_dib_; | 181 std::map<int, base::SharedMemory*> filled_dib_; |
| 182 bool return_buffers_; | 182 bool return_buffers_; |
| 183 bool dump_video_; | 183 bool dump_video_; |
| 184 DumpVideo dumper_; | 184 DumpVideo dumper_; |
| 185 }; | 185 }; |
| 186 | 186 |
| 187 ACTION_P(ExitMessageLoop, message_loop) { | 187 ACTION_P(ExitMessageLoop, message_loop) { |
| 188 message_loop->PostTask(FROM_HERE, new MessageLoop::QuitTask()); | 188 message_loop->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
| 189 } | 189 } |
| 190 | 190 |
| 191 class VideoCaptureHostTest : public testing::Test { | 191 class VideoCaptureHostTest : public testing::Test { |
| 192 public: | 192 public: |
| 193 VideoCaptureHostTest() {} | 193 VideoCaptureHostTest() {} |
| 194 | 194 |
| 195 protected: | 195 protected: |
| 196 virtual void SetUp() { | 196 virtual void SetUp() { |
| 197 // Create a message loop so VideoCaptureHostTest can use it. | 197 // Create a message loop so VideoCaptureHostTest can use it. |
| 198 message_loop_.reset(new MessageLoop(MessageLoop::TYPE_IO)); | 198 message_loop_.reset(new MessageLoop(MessageLoop::TYPE_IO)); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 host_ = NULL; | 239 host_ = NULL; |
| 240 | 240 |
| 241 // We need to continue running message_loop_ to complete all destructions. | 241 // We need to continue running message_loop_ to complete all destructions. |
| 242 SyncWithVideoCaptureManagerThread(); | 242 SyncWithVideoCaptureManagerThread(); |
| 243 | 243 |
| 244 content::MockResourceContext::GetInstance()->set_media_stream_manager(NULL); | 244 content::MockResourceContext::GetInstance()->set_media_stream_manager(NULL); |
| 245 } | 245 } |
| 246 | 246 |
| 247 // Called on the VideoCaptureManager thread. | 247 // Called on the VideoCaptureManager thread. |
| 248 static void PostQuitMessageLoop(MessageLoop* message_loop) { | 248 static void PostQuitMessageLoop(MessageLoop* message_loop) { |
| 249 message_loop->PostTask(FROM_HERE, new MessageLoop::QuitTask()); | 249 message_loop->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
| 250 } | 250 } |
| 251 | 251 |
| 252 // Called on the main thread. | 252 // Called on the main thread. |
| 253 static void PostQuitOnVideoCaptureManagerThread( | 253 static void PostQuitOnVideoCaptureManagerThread( |
| 254 MessageLoop* message_loop, content::ResourceContext* resource_context) { | 254 MessageLoop* message_loop, content::ResourceContext* resource_context) { |
| 255 resource_context->media_stream_manager()->video_capture_manager()-> | 255 resource_context->media_stream_manager()->video_capture_manager()-> |
| 256 GetMessageLoop()->PostTask(FROM_HERE, | 256 GetMessageLoop()->PostTask(FROM_HERE, |
| 257 base::Bind(&PostQuitMessageLoop, | 257 base::Bind(&PostQuitMessageLoop, |
| 258 message_loop)); | 258 message_loop)); |
| 259 } | 259 } |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 } | 401 } |
| 402 | 402 |
| 403 #ifdef DUMP_VIDEO | 403 #ifdef DUMP_VIDEO |
| 404 TEST_F(VideoCaptureHostTest, CaptureAndDumpVideoVga) { | 404 TEST_F(VideoCaptureHostTest, CaptureAndDumpVideoVga) { |
| 405 CaptureAndDumpVideo(640, 480, 30); | 405 CaptureAndDumpVideo(640, 480, 30); |
| 406 } | 406 } |
| 407 TEST_F(VideoCaptureHostTest, CaptureAndDump720P) { | 407 TEST_F(VideoCaptureHostTest, CaptureAndDump720P) { |
| 408 CaptureAndDumpVideo(1280, 720, 30); | 408 CaptureAndDumpVideo(1280, 720, 30); |
| 409 } | 409 } |
| 410 #endif | 410 #endif |
| OLD | NEW |