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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 84 |
87 virtual void OnIncomingCapturedBuffer(const scoped_refptr<Buffer>& buffer, | 85 virtual void OnIncomingCapturedBuffer(const scoped_refptr<Buffer>& buffer, |
88 media::VideoFrame::Format format, | 86 media::VideoFrame::Format format, |
89 const gfx::Size& dimensions, | 87 const gfx::Size& dimensions, |
90 base::Time timestamp, | 88 base::Time timestamp, |
91 int frame_rate) OVERRIDE { | 89 int frame_rate) OVERRIDE { |
92 NOTREACHED(); | 90 NOTREACHED(); |
93 } | 91 } |
94 | 92 |
95 private: | 93 private: |
96 scoped_refptr<base::MessageLoopProxy> main_thread_; | 94 scoped_refptr<base::SingleThreadTaskRunner> main_thread_; |
97 base::Callback<void(const VideoCaptureFormat&)> frame_cb_; | 95 base::Callback<void(const VideoCaptureFormat&)> frame_cb_; |
98 }; | 96 }; |
99 | 97 |
100 class VideoCaptureDeviceTest : public testing::Test { | 98 class VideoCaptureDeviceTest : public testing::Test { |
101 protected: | 99 protected: |
102 typedef media::VideoCaptureDevice::Client Client; | 100 typedef media::VideoCaptureDevice::Client Client; |
103 | 101 |
104 VideoCaptureDeviceTest() | 102 VideoCaptureDeviceTest() |
105 : loop_(new base::MessageLoop()), | 103 : loop_(new base::MessageLoop()), |
106 client_( | 104 client_( |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 EXPECT_EQ(supported_formats[0].pixel_format, media::PIXEL_FORMAT_I420); | 428 EXPECT_EQ(supported_formats[0].pixel_format, media::PIXEL_FORMAT_I420); |
431 EXPECT_GE(supported_formats[0].frame_rate, 20); | 429 EXPECT_GE(supported_formats[0].frame_rate, 20); |
432 EXPECT_EQ(supported_formats[1].frame_size.width(), 320); | 430 EXPECT_EQ(supported_formats[1].frame_size.width(), 320); |
433 EXPECT_EQ(supported_formats[1].frame_size.height(), 240); | 431 EXPECT_EQ(supported_formats[1].frame_size.height(), 240); |
434 EXPECT_EQ(supported_formats[1].pixel_format, media::PIXEL_FORMAT_I420); | 432 EXPECT_EQ(supported_formats[1].pixel_format, media::PIXEL_FORMAT_I420); |
435 EXPECT_GE(supported_formats[1].frame_rate, 20); | 433 EXPECT_GE(supported_formats[1].frame_rate, 20); |
436 } | 434 } |
437 } | 435 } |
438 | 436 |
439 }; // namespace media | 437 }; // namespace media |
OLD | NEW |