| 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/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
| 10 #include "base/test/test_timeouts.h" | 10 #include "base/test/test_timeouts.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 class MockClient : public media::VideoCaptureDevice::Client { | 62 class MockClient : public media::VideoCaptureDevice::Client { |
| 63 public: | 63 public: |
| 64 MOCK_METHOD2(ReserveOutputBuffer, | 64 MOCK_METHOD2(ReserveOutputBuffer, |
| 65 scoped_refptr<Buffer>(media::VideoFrame::Format format, | 65 scoped_refptr<Buffer>(media::VideoFrame::Format format, |
| 66 const gfx::Size& dimensions)); | 66 const gfx::Size& dimensions)); |
| 67 MOCK_METHOD0(OnErr, void()); | 67 MOCK_METHOD0(OnErr, void()); |
| 68 | 68 |
| 69 explicit MockClient(base::Callback<void(const VideoCaptureFormat&)> frame_cb) | 69 explicit MockClient(base::Callback<void(const VideoCaptureFormat&)> frame_cb) |
| 70 : main_thread_(base::MessageLoopProxy::current()), frame_cb_(frame_cb) {} | 70 : main_thread_(base::MessageLoopProxy::current()), frame_cb_(frame_cb) {} |
| 71 | 71 |
| 72 virtual void OnError() OVERRIDE { | 72 virtual void OnError(const std::string& error_message) OVERRIDE { |
| 73 OnErr(); | 73 OnErr(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 virtual void OnIncomingCapturedFrame(const uint8* data, | 76 virtual void OnIncomingCapturedFrame(const uint8* data, |
| 77 int length, | 77 int length, |
| 78 base::TimeTicks timestamp, | 78 base::TimeTicks timestamp, |
| 79 int rotation, | 79 int rotation, |
| 80 const VideoCaptureFormat& format) | 80 const VideoCaptureFormat& format) |
| 81 OVERRIDE { | 81 OVERRIDE { |
| 82 main_thread_->PostTask(FROM_HERE, base::Bind(frame_cb_, format)); | 82 main_thread_->PostTask(FROM_HERE, base::Bind(frame_cb_, format)); |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 EXPECT_EQ(supported_formats[0].pixel_format, media::PIXEL_FORMAT_I420); | 428 EXPECT_EQ(supported_formats[0].pixel_format, media::PIXEL_FORMAT_I420); |
| 429 EXPECT_GE(supported_formats[0].frame_rate, 20); | 429 EXPECT_GE(supported_formats[0].frame_rate, 20); |
| 430 EXPECT_EQ(supported_formats[1].frame_size.width(), 320); | 430 EXPECT_EQ(supported_formats[1].frame_size.width(), 320); |
| 431 EXPECT_EQ(supported_formats[1].frame_size.height(), 240); | 431 EXPECT_EQ(supported_formats[1].frame_size.height(), 240); |
| 432 EXPECT_EQ(supported_formats[1].pixel_format, media::PIXEL_FORMAT_I420); | 432 EXPECT_EQ(supported_formats[1].pixel_format, media::PIXEL_FORMAT_I420); |
| 433 EXPECT_GE(supported_formats[1].frame_rate, 20); | 433 EXPECT_GE(supported_formats[1].frame_rate, 20); |
| 434 } | 434 } |
| 435 } | 435 } |
| 436 | 436 |
| 437 }; // namespace media | 437 }; // namespace media |
| OLD | NEW |