| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 70 |
| 71 explicit MockClient(base::Callback<void(const VideoCaptureFormat&)> frame_cb) | 71 explicit MockClient(base::Callback<void(const VideoCaptureFormat&)> frame_cb) |
| 72 : main_thread_(base::MessageLoopProxy::current()), frame_cb_(frame_cb) {} | 72 : main_thread_(base::MessageLoopProxy::current()), frame_cb_(frame_cb) {} |
| 73 | 73 |
| 74 virtual void OnError() OVERRIDE { | 74 virtual void OnError() OVERRIDE { |
| 75 OnErr(); | 75 OnErr(); |
| 76 } | 76 } |
| 77 | 77 |
| 78 virtual void OnIncomingCapturedFrame(const uint8* data, | 78 virtual void OnIncomingCapturedFrame(const uint8* data, |
| 79 int length, | 79 int length, |
| 80 base::Time timestamp, | 80 base::TimeTicks timestamp, |
| 81 int rotation, | 81 int rotation, |
| 82 const VideoCaptureFormat& format) | 82 const VideoCaptureFormat& format) |
| 83 OVERRIDE { | 83 OVERRIDE { |
| 84 main_thread_->PostTask(FROM_HERE, base::Bind(frame_cb_, format)); | 84 main_thread_->PostTask(FROM_HERE, base::Bind(frame_cb_, format)); |
| 85 } | 85 } |
| 86 | 86 |
| 87 virtual void OnIncomingCapturedBuffer(const scoped_refptr<Buffer>& buffer, | 87 virtual void OnIncomingCapturedBuffer(const scoped_refptr<Buffer>& buffer, |
| 88 media::VideoFrame::Format format, | 88 media::VideoFrame::Format format, |
| 89 const gfx::Size& dimensions, | 89 const gfx::Size& dimensions, |
| 90 base::Time timestamp, | 90 base::TimeTicks timestamp, |
| 91 int frame_rate) OVERRIDE { | 91 int frame_rate) OVERRIDE { |
| 92 NOTREACHED(); | 92 NOTREACHED(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 private: | 95 private: |
| 96 scoped_refptr<base::MessageLoopProxy> main_thread_; | 96 scoped_refptr<base::MessageLoopProxy> main_thread_; |
| 97 base::Callback<void(const VideoCaptureFormat&)> frame_cb_; | 97 base::Callback<void(const VideoCaptureFormat&)> frame_cb_; |
| 98 }; | 98 }; |
| 99 | 99 |
| 100 class VideoCaptureDeviceTest : public testing::Test { | 100 class VideoCaptureDeviceTest : public testing::Test { |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 EXPECT_EQ(supported_formats[0].pixel_format, media::PIXEL_FORMAT_I420); | 430 EXPECT_EQ(supported_formats[0].pixel_format, media::PIXEL_FORMAT_I420); |
| 431 EXPECT_GE(supported_formats[0].frame_rate, 20); | 431 EXPECT_GE(supported_formats[0].frame_rate, 20); |
| 432 EXPECT_EQ(supported_formats[1].frame_size.width(), 320); | 432 EXPECT_EQ(supported_formats[1].frame_size.width(), 320); |
| 433 EXPECT_EQ(supported_formats[1].frame_size.height(), 240); | 433 EXPECT_EQ(supported_formats[1].frame_size.height(), 240); |
| 434 EXPECT_EQ(supported_formats[1].pixel_format, media::PIXEL_FORMAT_I420); | 434 EXPECT_EQ(supported_formats[1].pixel_format, media::PIXEL_FORMAT_I420); |
| 435 EXPECT_GE(supported_formats[1].frame_rate, 20); | 435 EXPECT_GE(supported_formats[1].frame_rate, 20); |
| 436 } | 436 } |
| 437 } | 437 } |
| 438 | 438 |
| 439 }; // namespace media | 439 }; // namespace media |
| OLD | NEW |