OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/browser/media/capture/desktop_capture_device_aura.h" | 5 #include "content/browser/media/capture/desktop_capture_device_aura.h" |
6 | 6 |
| 7 #include "base/location.h" |
7 #include "base/synchronization/waitable_event.h" | 8 #include "base/synchronization/waitable_event.h" |
8 #include "content/browser/browser_thread_impl.h" | 9 #include "content/browser/browser_thread_impl.h" |
9 #include "content/public/browser/desktop_media_id.h" | 10 #include "content/public/browser/desktop_media_id.h" |
10 #include "media/base/video_capture_types.h" | 11 #include "media/base/video_capture_types.h" |
11 #include "testing/gmock/include/gmock/gmock.h" | 12 #include "testing/gmock/include/gmock/gmock.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "ui/aura/client/window_tree_client.h" | 14 #include "ui/aura/client/window_tree_client.h" |
14 #include "ui/aura/test/aura_test_helper.h" | 15 #include "ui/aura/test/aura_test_helper.h" |
15 #include "ui/aura/test/test_window_delegate.h" | 16 #include "ui/aura/test/test_window_delegate.h" |
16 #include "ui/aura/window.h" | 17 #include "ui/aura/window.h" |
(...skipping 30 matching lines...) Expand all Loading... |
47 const uint8* v_data, | 48 const uint8* v_data, |
48 size_t y_stride, | 49 size_t y_stride, |
49 size_t u_stride, | 50 size_t u_stride, |
50 size_t v_stride, | 51 size_t v_stride, |
51 const media::VideoCaptureFormat& frame_format, | 52 const media::VideoCaptureFormat& frame_format, |
52 int clockwise_rotation, | 53 int clockwise_rotation, |
53 const base::TimeTicks& timestamp)); | 54 const base::TimeTicks& timestamp)); |
54 MOCK_METHOD0(DoReserveOutputBuffer, void(void)); | 55 MOCK_METHOD0(DoReserveOutputBuffer, void(void)); |
55 MOCK_METHOD0(DoOnIncomingCapturedBuffer, void(void)); | 56 MOCK_METHOD0(DoOnIncomingCapturedBuffer, void(void)); |
56 MOCK_METHOD0(DoOnIncomingCapturedVideoFrame, void(void)); | 57 MOCK_METHOD0(DoOnIncomingCapturedVideoFrame, void(void)); |
57 MOCK_METHOD1(OnError, void(const std::string& reason)); | 58 MOCK_METHOD2(OnError, |
| 59 void(const tracked_objects::Location& from_here, |
| 60 const std::string& reason)); |
58 | 61 |
59 // Trampoline methods to workaround GMOCK problems with scoped_ptr<>. | 62 // Trampoline methods to workaround GMOCK problems with scoped_ptr<>. |
60 scoped_ptr<Buffer> ReserveOutputBuffer( | 63 scoped_ptr<Buffer> ReserveOutputBuffer( |
61 const gfx::Size& dimensions, | 64 const gfx::Size& dimensions, |
62 media::VideoPixelFormat format, | 65 media::VideoPixelFormat format, |
63 media::VideoPixelStorage storage) override { | 66 media::VideoPixelStorage storage) override { |
64 EXPECT_TRUE((format == media::PIXEL_FORMAT_I420 && | 67 EXPECT_TRUE((format == media::PIXEL_FORMAT_I420 && |
65 storage == media::PIXEL_STORAGE_CPU) || | 68 storage == media::PIXEL_STORAGE_CPU) || |
66 (format == media::PIXEL_FORMAT_ARGB && | 69 (format == media::PIXEL_FORMAT_ARGB && |
67 storage == media::PIXEL_STORAGE_TEXTURE)); | 70 storage == media::PIXEL_STORAGE_TEXTURE)); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 }; | 138 }; |
136 | 139 |
137 TEST_F(DesktopCaptureDeviceAuraTest, StartAndStop) { | 140 TEST_F(DesktopCaptureDeviceAuraTest, StartAndStop) { |
138 scoped_ptr<media::VideoCaptureDevice> capture_device = | 141 scoped_ptr<media::VideoCaptureDevice> capture_device = |
139 DesktopCaptureDeviceAura::Create( | 142 DesktopCaptureDeviceAura::Create( |
140 content::DesktopMediaID::RegisterAuraWindow( | 143 content::DesktopMediaID::RegisterAuraWindow( |
141 content::DesktopMediaID::TYPE_SCREEN, root_window())); | 144 content::DesktopMediaID::TYPE_SCREEN, root_window())); |
142 ASSERT_TRUE(capture_device.get()); | 145 ASSERT_TRUE(capture_device.get()); |
143 | 146 |
144 scoped_ptr<MockDeviceClient> client(new MockDeviceClient()); | 147 scoped_ptr<MockDeviceClient> client(new MockDeviceClient()); |
145 EXPECT_CALL(*client, OnError(_)).Times(0); | 148 EXPECT_CALL(*client, OnError(_, _)).Times(0); |
146 | 149 |
147 media::VideoCaptureParams capture_params; | 150 media::VideoCaptureParams capture_params; |
148 capture_params.requested_format.frame_size.SetSize(640, 480); | 151 capture_params.requested_format.frame_size.SetSize(640, 480); |
149 capture_params.requested_format.frame_rate = kFrameRate; | 152 capture_params.requested_format.frame_rate = kFrameRate; |
150 capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420; | 153 capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420; |
151 capture_device->AllocateAndStart(capture_params, client.Pass()); | 154 capture_device->AllocateAndStart(capture_params, client.Pass()); |
152 capture_device->StopAndDeAllocate(); | 155 capture_device->StopAndDeAllocate(); |
153 } | 156 } |
154 | 157 |
155 } // namespace | 158 } // namespace |
156 } // namespace content | 159 } // namespace content |
OLD | NEW |