| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 namespace media { | 33 namespace media { |
| 34 class VideoFrame; | 34 class VideoFrame; |
| 35 } // namespace media | 35 } // namespace media |
| 36 | 36 |
| 37 namespace content { | 37 namespace content { |
| 38 namespace { | 38 namespace { |
| 39 | 39 |
| 40 const int kFrameRate = 30; | 40 const int kFrameRate = 30; |
| 41 | 41 |
| 42 class MockDeviceClient : public media::VideoCaptureDevice::Client { | 42 class MockDeviceClient : public device::VideoCaptureDevice::Client { |
| 43 public: | 43 public: |
| 44 MOCK_METHOD6(OnIncomingCapturedData, | 44 MOCK_METHOD6(OnIncomingCapturedData, |
| 45 void(const uint8_t* data, | 45 void(const uint8_t* data, |
| 46 int length, | 46 int length, |
| 47 const media::VideoCaptureFormat& frame_format, | 47 const media::VideoCaptureFormat& frame_format, |
| 48 int rotation, | 48 int rotation, |
| 49 base::TimeTicks reference_time, | 49 base::TimeTicks reference_time, |
| 50 base::TimeDelta tiemstamp)); | 50 base::TimeDelta tiemstamp)); |
| 51 MOCK_METHOD0(DoReserveOutputBuffer, void(void)); | 51 MOCK_METHOD0(DoReserveOutputBuffer, void(void)); |
| 52 MOCK_METHOD0(DoOnIncomingCapturedBuffer, void(void)); | 52 MOCK_METHOD0(DoOnIncomingCapturedBuffer, void(void)); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 base::MessageLoopForUI message_loop_; | 134 base::MessageLoopForUI message_loop_; |
| 135 BrowserThreadImpl browser_thread_for_ui_; | 135 BrowserThreadImpl browser_thread_for_ui_; |
| 136 std::unique_ptr<aura::test::AuraTestHelper> helper_; | 136 std::unique_ptr<aura::test::AuraTestHelper> helper_; |
| 137 std::unique_ptr<aura::Window> desktop_window_; | 137 std::unique_ptr<aura::Window> desktop_window_; |
| 138 std::unique_ptr<aura::test::TestWindowDelegate> window_delegate_; | 138 std::unique_ptr<aura::test::TestWindowDelegate> window_delegate_; |
| 139 | 139 |
| 140 DISALLOW_COPY_AND_ASSIGN(DesktopCaptureDeviceAuraTest); | 140 DISALLOW_COPY_AND_ASSIGN(DesktopCaptureDeviceAuraTest); |
| 141 }; | 141 }; |
| 142 | 142 |
| 143 TEST_F(DesktopCaptureDeviceAuraTest, StartAndStop) { | 143 TEST_F(DesktopCaptureDeviceAuraTest, StartAndStop) { |
| 144 std::unique_ptr<media::VideoCaptureDevice> capture_device = | 144 std::unique_ptr<device::VideoCaptureDevice> capture_device = |
| 145 DesktopCaptureDeviceAura::Create( | 145 DesktopCaptureDeviceAura::Create( |
| 146 content::DesktopMediaID::RegisterAuraWindow( | 146 content::DesktopMediaID::RegisterAuraWindow( |
| 147 content::DesktopMediaID::TYPE_SCREEN, root_window())); | 147 content::DesktopMediaID::TYPE_SCREEN, root_window())); |
| 148 ASSERT_TRUE(capture_device); | 148 ASSERT_TRUE(capture_device); |
| 149 | 149 |
| 150 std::unique_ptr<MockDeviceClient> client(new MockDeviceClient()); | 150 std::unique_ptr<MockDeviceClient> client(new MockDeviceClient()); |
| 151 EXPECT_CALL(*client, OnError(_, _)).Times(0); | 151 EXPECT_CALL(*client, OnError(_, _)).Times(0); |
| 152 | 152 |
| 153 media::VideoCaptureParams capture_params; | 153 media::VideoCaptureParams capture_params; |
| 154 capture_params.requested_format.frame_size.SetSize(640, 480); | 154 capture_params.requested_format.frame_size.SetSize(640, 480); |
| 155 capture_params.requested_format.frame_rate = kFrameRate; | 155 capture_params.requested_format.frame_rate = kFrameRate; |
| 156 capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420; | 156 capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420; |
| 157 capture_device->AllocateAndStart(capture_params, std::move(client)); | 157 capture_device->AllocateAndStart(capture_params, std::move(client)); |
| 158 capture_device->StopAndDeAllocate(); | 158 capture_device->StopAndDeAllocate(); |
| 159 } | 159 } |
| 160 | 160 |
| 161 } // namespace | 161 } // namespace |
| 162 } // namespace content | 162 } // namespace content |
| OLD | NEW |