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" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
57 using ::testing::_; | 57 using ::testing::_; |
58 using ::testing::AnyNumber; | 58 using ::testing::AnyNumber; |
59 using ::testing::Return; | 59 using ::testing::Return; |
60 using ::testing::AtLeast; | 60 using ::testing::AtLeast; |
61 using ::testing::SaveArg; | 61 using ::testing::SaveArg; |
62 | 62 |
63 namespace media { | 63 namespace media { |
64 | 64 |
65 class MockClient : public media::VideoCaptureDevice::Client { | 65 class MockClient : public media::VideoCaptureDevice::Client { |
66 public: | 66 public: |
67 MOCK_METHOD1(ReserveOutputBuffer, | 67 MOCK_METHOD1( |
68 scoped_refptr<media::VideoFrame>(const gfx::Size&)); | 68 ReserveOutputBuffer, |
69 scoped_refptr<media::VideoFrame>(media::VideoFrame::Format format, | |
70 const gfx::Size&)); | |
69 MOCK_METHOD0(OnErr, void()); | 71 MOCK_METHOD0(OnErr, void()); |
70 MOCK_METHOD1(OnFrameInfo, void(const VideoCaptureCapability&)); | 72 MOCK_METHOD1(OnFrameInfo, void(const VideoCaptureCapability&)); |
71 MOCK_METHOD1(OnFrameInfoChanged, void(const VideoCaptureCapability&)); | 73 MOCK_METHOD1(OnFrameInfoChanged, void(const VideoCaptureCapability&)); |
72 | 74 |
73 explicit MockClient( | 75 explicit MockClient( |
74 base::Closure frame_cb) | 76 base::Closure frame_cb) |
75 : main_thread_(base::MessageLoopProxy::current()), | 77 : main_thread_(base::MessageLoopProxy::current()), |
76 frame_cb_(frame_cb) {} | 78 frame_cb_(frame_cb) {} |
77 | 79 |
78 virtual void OnError() OVERRIDE { | 80 virtual void OnError() OVERRIDE { |
79 OnErr(); | 81 OnErr(); |
80 } | 82 } |
81 | 83 |
82 virtual void OnIncomingCapturedFrame( | 84 virtual void OnIncomingCapturedFrame( |
83 const uint8* data, | 85 const uint8* data, |
84 int length, | 86 int length, |
85 base::Time timestamp, | 87 base::Time timestamp, |
86 int rotation, | 88 int rotation, |
87 bool flip_vert, | 89 bool flip_vert, |
88 bool flip_horiz) OVERRIDE { | 90 bool flip_horiz) OVERRIDE { |
89 main_thread_->PostTask(FROM_HERE, frame_cb_); | 91 main_thread_->PostTask(FROM_HERE, frame_cb_); |
90 } | 92 } |
91 | 93 |
92 virtual void OnIncomingCapturedVideoFrame( | 94 virtual void OnIncomingCapturedI420Buffer(scoped_ptr<Buffer> buffer, |
ncarter (slow)
2013/10/29 18:42:17
This method doesn't seem to match anything in Vide
sheu
2013/11/05 20:02:10
Apparently not :-P
I didn't realize I had to buil
| |
93 const scoped_refptr<media::VideoFrame>& frame, | 95 const gfx::Size& dimensions, |
94 base::Time timestamp) OVERRIDE { | 96 base::Time timestamp) OVERRIDE { |
95 main_thread_->PostTask(FROM_HERE, frame_cb_); | 97 main_thread_->PostTask(FROM_HERE, frame_cb_); |
96 } | 98 } |
97 | 99 |
98 private: | 100 private: |
99 scoped_refptr<base::MessageLoopProxy> main_thread_; | 101 scoped_refptr<base::MessageLoopProxy> main_thread_; |
100 base::Closure frame_cb_; | 102 base::Closure frame_cb_; |
101 }; | 103 }; |
102 | 104 |
103 class VideoCaptureDeviceTest : public testing::Test { | 105 class VideoCaptureDeviceTest : public testing::Test { |
104 protected: | 106 protected: |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
461 &capture_formats); | 463 &capture_formats); |
462 EXPECT_GE(capture_formats.size(), 1u); | 464 EXPECT_GE(capture_formats.size(), 1u); |
463 EXPECT_EQ(capture_formats[0].width, 640); | 465 EXPECT_EQ(capture_formats[0].width, 640); |
464 EXPECT_EQ(capture_formats[0].height, 480); | 466 EXPECT_EQ(capture_formats[0].height, 480); |
465 EXPECT_EQ(capture_formats[0].color, media::PIXEL_FORMAT_I420); | 467 EXPECT_EQ(capture_formats[0].color, media::PIXEL_FORMAT_I420); |
466 EXPECT_GE(capture_formats[0].frame_rate, 20); | 468 EXPECT_GE(capture_formats[0].frame_rate, 20); |
467 } | 469 } |
468 } | 470 } |
469 | 471 |
470 }; // namespace media | 472 }; // namespace media |
OLD | NEW |