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/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 class MockClient : public media::VideoCaptureDevice::Client { | 65 class MockClient : public media::VideoCaptureDevice::Client { |
66 public: | 66 public: |
67 MOCK_METHOD2(ReserveOutputBuffer, | 67 MOCK_METHOD2(ReserveOutputBuffer, |
68 scoped_refptr<Buffer>(media::VideoFrame::Format format, | 68 scoped_refptr<Buffer>(media::VideoFrame::Format format, |
69 const gfx::Size& dimensions)); | 69 const gfx::Size& dimensions)); |
70 MOCK_METHOD0(OnErr, void()); | 70 MOCK_METHOD0(OnErr, void()); |
71 | 71 |
72 explicit MockClient(base::Callback<void(const VideoCaptureFormat&)> frame_cb) | 72 explicit MockClient(base::Callback<void(const VideoCaptureFormat&)> frame_cb) |
73 : main_thread_(base::MessageLoopProxy::current()), frame_cb_(frame_cb) {} | 73 : main_thread_(base::MessageLoopProxy::current()), frame_cb_(frame_cb) {} |
74 | 74 |
75 virtual void OnError(const std::string& error_message) OVERRIDE { | 75 virtual void OnError(const std::string& error_message) override { |
76 OnErr(); | 76 OnErr(); |
77 } | 77 } |
78 | 78 |
79 virtual void OnIncomingCapturedData(const uint8* data, | 79 virtual void OnIncomingCapturedData(const uint8* data, |
80 int length, | 80 int length, |
81 const VideoCaptureFormat& format, | 81 const VideoCaptureFormat& format, |
82 int rotation, | 82 int rotation, |
83 base::TimeTicks timestamp) OVERRIDE { | 83 base::TimeTicks timestamp) 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 OnIncomingCapturedVideoFrame( | 87 virtual void OnIncomingCapturedVideoFrame( |
88 const scoped_refptr<Buffer>& buffer, | 88 const scoped_refptr<Buffer>& buffer, |
89 const media::VideoCaptureFormat& buffer_format, | 89 const media::VideoCaptureFormat& buffer_format, |
90 const scoped_refptr<media::VideoFrame>& frame, | 90 const scoped_refptr<media::VideoFrame>& frame, |
91 base::TimeTicks timestamp) OVERRIDE { | 91 base::TimeTicks timestamp) override { |
92 NOTREACHED(); | 92 NOTREACHED(); |
93 } | 93 } |
94 | 94 |
95 private: | 95 private: |
96 scoped_refptr<base::SingleThreadTaskRunner> main_thread_; | 96 scoped_refptr<base::SingleThreadTaskRunner> main_thread_; |
97 base::Callback<void(const VideoCaptureFormat&)> frame_cb_; | 97 base::Callback<void(const VideoCaptureFormat&)> frame_cb_; |
98 }; | 98 }; |
99 | 99 |
100 class DeviceEnumerationListener : | 100 class DeviceEnumerationListener : |
101 public base::RefCounted<DeviceEnumerationListener>{ | 101 public base::RefCounted<DeviceEnumerationListener>{ |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 // Use PIXEL_FORMAT_MAX to iterate all device names for testing | 429 // Use PIXEL_FORMAT_MAX to iterate all device names for testing |
430 // GetDeviceSupportedFormats(). | 430 // GetDeviceSupportedFormats(). |
431 scoped_ptr<VideoCaptureDevice::Name> name = | 431 scoped_ptr<VideoCaptureDevice::Name> name = |
432 GetFirstDeviceNameSupportingPixelFormat(PIXEL_FORMAT_MAX); | 432 GetFirstDeviceNameSupportingPixelFormat(PIXEL_FORMAT_MAX); |
433 // Verify no camera returned for PIXEL_FORMAT_MAX. Nothing else to test here | 433 // Verify no camera returned for PIXEL_FORMAT_MAX. Nothing else to test here |
434 // since we cannot forecast the hardware capabilities. | 434 // since we cannot forecast the hardware capabilities. |
435 ASSERT_FALSE(name); | 435 ASSERT_FALSE(name); |
436 } | 436 } |
437 | 437 |
438 }; // namespace media | 438 }; // namespace media |
OLD | NEW |