| 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 #include "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/message_loop/message_loop.h" | |
| 9 #include "base/message_loop/message_loop_proxy.h" | |
| 10 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 11 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
| 12 #include "base/test/test_timeouts.h" | 10 #include "base/test/test_timeouts.h" |
| 13 #include "base/threading/thread.h" | 11 #include "base/threading/thread.h" |
| 14 #include "media/video/capture/fake_video_capture_device.h" | 12 #include "media/video/capture/fake_video_capture_device.h" |
| 15 #include "media/video/capture/video_capture_device.h" | 13 #include "media/video/capture/video_capture_device.h" |
| 16 #include "media/video/capture/video_capture_types.h" | 14 #include "media/video/capture/video_capture_types.h" |
| 17 #include "testing/gmock/include/gmock/gmock.h" | 15 #include "testing/gmock/include/gmock/gmock.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 19 | 17 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 main_thread_->PostTask(FROM_HERE, frame_cb_); | 87 main_thread_->PostTask(FROM_HERE, frame_cb_); |
| 90 } | 88 } |
| 91 | 89 |
| 92 virtual void OnIncomingCapturedVideoFrame( | 90 virtual void OnIncomingCapturedVideoFrame( |
| 93 const scoped_refptr<media::VideoFrame>& frame, | 91 const scoped_refptr<media::VideoFrame>& frame, |
| 94 base::Time timestamp) OVERRIDE { | 92 base::Time timestamp) OVERRIDE { |
| 95 main_thread_->PostTask(FROM_HERE, frame_cb_); | 93 main_thread_->PostTask(FROM_HERE, frame_cb_); |
| 96 } | 94 } |
| 97 | 95 |
| 98 private: | 96 private: |
| 99 scoped_refptr<base::MessageLoopProxy> main_thread_; | 97 scoped_refptr<base::SingleThreadTaskRunner> main_thread_; |
| 100 base::Closure frame_cb_; | 98 base::Closure frame_cb_; |
| 101 }; | 99 }; |
| 102 | 100 |
| 103 class VideoCaptureDeviceTest : public testing::Test { | 101 class VideoCaptureDeviceTest : public testing::Test { |
| 104 protected: | 102 protected: |
| 105 typedef media::VideoCaptureDevice::Client Client; | 103 typedef media::VideoCaptureDevice::Client Client; |
| 106 | 104 |
| 107 virtual void SetUp() { | 105 virtual void SetUp() { |
| 108 loop_.reset(new base::MessageLoopForUI()); | 106 loop_.reset(new base::MessageLoopForUI()); |
| 109 client_.reset(new MockClient(loop_->QuitClosure())); | 107 client_.reset(new MockClient(loop_->QuitClosure())); |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 &capture_formats); | 459 &capture_formats); |
| 462 EXPECT_GE(capture_formats.size(), 1u); | 460 EXPECT_GE(capture_formats.size(), 1u); |
| 463 EXPECT_EQ(capture_formats[0].width, 640); | 461 EXPECT_EQ(capture_formats[0].width, 640); |
| 464 EXPECT_EQ(capture_formats[0].height, 480); | 462 EXPECT_EQ(capture_formats[0].height, 480); |
| 465 EXPECT_EQ(capture_formats[0].color, media::PIXEL_FORMAT_I420); | 463 EXPECT_EQ(capture_formats[0].color, media::PIXEL_FORMAT_I420); |
| 466 EXPECT_GE(capture_formats[0].frame_rate, 20); | 464 EXPECT_GE(capture_formats[0].frame_rate, 20); |
| 467 } | 465 } |
| 468 } | 466 } |
| 469 | 467 |
| 470 }; // namespace media | 468 }; // namespace media |
| OLD | NEW |