| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 93 |
| 94 // Test harness that sets up a minimal environment with necessary stubs. | 94 // Test harness that sets up a minimal environment with necessary stubs. |
| 95 class DesktopCaptureDeviceAuraTest : public testing::Test { | 95 class DesktopCaptureDeviceAuraTest : public testing::Test { |
| 96 public: | 96 public: |
| 97 DesktopCaptureDeviceAuraTest() = default; | 97 DesktopCaptureDeviceAuraTest() = default; |
| 98 ~DesktopCaptureDeviceAuraTest() override = default; | 98 ~DesktopCaptureDeviceAuraTest() override = default; |
| 99 | 99 |
| 100 protected: | 100 protected: |
| 101 void SetUp() override { | 101 void SetUp() override { |
| 102 // The ContextFactory must exist before any Compositors are created. | 102 // The ContextFactory must exist before any Compositors are created. |
| 103 |
| 103 bool enable_pixel_output = false; | 104 bool enable_pixel_output = false; |
| 104 ui::ContextFactory* context_factory = | 105 ui::ContextFactory* context_factory = nullptr; |
| 105 ui::InitializeContextFactoryForTests(enable_pixel_output); | 106 ui::ContextFactoryPrivate* context_factory_private = nullptr; |
| 107 ui::InitializeContextFactoryForTests(enable_pixel_output, &context_factory, |
| 108 &context_factory_private); |
| 106 helper_.reset( | 109 helper_.reset( |
| 107 new aura::test::AuraTestHelper(base::MessageLoopForUI::current())); | 110 new aura::test::AuraTestHelper(base::MessageLoopForUI::current())); |
| 108 helper_->SetUp(context_factory); | 111 helper_->SetUp(context_factory, context_factory_private); |
| 109 new wm::DefaultActivationClient(helper_->root_window()); | 112 new wm::DefaultActivationClient(helper_->root_window()); |
| 110 | |
| 111 // We need a window to cover desktop area so that DesktopCaptureDeviceAura | 113 // We need a window to cover desktop area so that DesktopCaptureDeviceAura |
| 112 // can use gfx::NativeWindow::GetWindowAtScreenPoint() to locate the | 114 // can use gfx::NativeWindow::GetWindowAtScreenPoint() to locate the |
| 113 // root window associated with the primary display. | 115 // root window associated with the primary display. |
| 114 gfx::Rect desktop_bounds = root_window()->bounds(); | 116 gfx::Rect desktop_bounds = root_window()->bounds(); |
| 115 window_delegate_.reset(new aura::test::TestWindowDelegate()); | 117 window_delegate_.reset(new aura::test::TestWindowDelegate()); |
| 116 desktop_window_.reset(new aura::Window(window_delegate_.get())); | 118 desktop_window_.reset(new aura::Window(window_delegate_.get())); |
| 117 desktop_window_->Init(ui::LAYER_TEXTURED); | 119 desktop_window_->Init(ui::LAYER_TEXTURED); |
| 118 desktop_window_->SetBounds(desktop_bounds); | 120 desktop_window_->SetBounds(desktop_bounds); |
| 119 aura::client::ParentWindowWithContext( | 121 aura::client::ParentWindowWithContext( |
| 120 desktop_window_.get(), root_window(), desktop_bounds); | 122 desktop_window_.get(), root_window(), desktop_bounds); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 media::VideoCaptureParams capture_params; | 156 media::VideoCaptureParams capture_params; |
| 155 capture_params.requested_format.frame_size.SetSize(640, 480); | 157 capture_params.requested_format.frame_size.SetSize(640, 480); |
| 156 capture_params.requested_format.frame_rate = kFrameRate; | 158 capture_params.requested_format.frame_rate = kFrameRate; |
| 157 capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420; | 159 capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420; |
| 158 capture_device->AllocateAndStart(capture_params, std::move(client)); | 160 capture_device->AllocateAndStart(capture_params, std::move(client)); |
| 159 capture_device->StopAndDeAllocate(); | 161 capture_device->StopAndDeAllocate(); |
| 160 } | 162 } |
| 161 | 163 |
| 162 } // namespace | 164 } // namespace |
| 163 } // namespace content | 165 } // namespace content |
| OLD | NEW |