| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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() 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 const VideoCaptureFormat& format, |
| 79 int rotation, | 79 int rotation, |
| 80 const VideoCaptureFormat& format) | 80 base::TimeTicks timestamp) OVERRIDE { |
| 81 OVERRIDE { | |
| 82 main_thread_->PostTask(FROM_HERE, base::Bind(frame_cb_, format)); | 81 main_thread_->PostTask(FROM_HERE, base::Bind(frame_cb_, format)); |
| 83 } | 82 } |
| 84 | 83 |
| 85 virtual void OnIncomingCapturedBuffer(const scoped_refptr<Buffer>& buffer, | 84 virtual void OnIncomingCapturedVideoFrame( |
| 86 media::VideoFrame::Format format, | 85 const scoped_refptr<Buffer>& buffer, |
| 87 const gfx::Size& dimensions, | 86 const media::VideoCaptureFormat& buffer_format, |
| 88 base::TimeTicks timestamp, | 87 const scoped_refptr<media::VideoFrame>& frame, |
| 89 int frame_rate) OVERRIDE { | 88 base::TimeTicks timestamp) OVERRIDE { |
| 90 NOTREACHED(); | 89 NOTREACHED(); |
| 91 } | 90 } |
| 92 | 91 |
| 93 private: | 92 private: |
| 94 scoped_refptr<base::SingleThreadTaskRunner> main_thread_; | 93 scoped_refptr<base::SingleThreadTaskRunner> main_thread_; |
| 95 base::Callback<void(const VideoCaptureFormat&)> frame_cb_; | 94 base::Callback<void(const VideoCaptureFormat&)> frame_cb_; |
| 96 }; | 95 }; |
| 97 | 96 |
| 98 class VideoCaptureDeviceTest : public testing::Test { | 97 class VideoCaptureDeviceTest : public testing::Test { |
| 99 protected: | 98 protected: |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 EXPECT_EQ(supported_formats[0].pixel_format, media::PIXEL_FORMAT_I420); | 427 EXPECT_EQ(supported_formats[0].pixel_format, media::PIXEL_FORMAT_I420); |
| 429 EXPECT_GE(supported_formats[0].frame_rate, 20); | 428 EXPECT_GE(supported_formats[0].frame_rate, 20); |
| 430 EXPECT_EQ(supported_formats[1].frame_size.width(), 320); | 429 EXPECT_EQ(supported_formats[1].frame_size.width(), 320); |
| 431 EXPECT_EQ(supported_formats[1].frame_size.height(), 240); | 430 EXPECT_EQ(supported_formats[1].frame_size.height(), 240); |
| 432 EXPECT_EQ(supported_formats[1].pixel_format, media::PIXEL_FORMAT_I420); | 431 EXPECT_EQ(supported_formats[1].pixel_format, media::PIXEL_FORMAT_I420); |
| 433 EXPECT_GE(supported_formats[1].frame_rate, 20); | 432 EXPECT_GE(supported_formats[1].frame_rate, 20); |
| 434 } | 433 } |
| 435 } | 434 } |
| 436 | 435 |
| 437 }; // namespace media | 436 }; // namespace media |
| OLD | NEW |