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/synchronization/waitable_event.h" | 7 #include "base/synchronization/waitable_event.h" |
8 #include "content/browser/browser_thread_impl.h" | 8 #include "content/browser/browser_thread_impl.h" |
9 #include "content/public/browser/desktop_media_id.h" | 9 #include "content/public/browser/desktop_media_id.h" |
10 #include "media/video/capture/video_capture_types.h" | 10 #include "media/video/capture/video_capture_types.h" |
11 #include "testing/gmock/include/gmock/gmock.h" | 11 #include "testing/gmock/include/gmock/gmock.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "ui/aura/client/window_tree_client.h" | 13 #include "ui/aura/client/window_tree_client.h" |
14 #include "ui/aura/test/aura_test_helper.h" | 14 #include "ui/aura/test/aura_test_helper.h" |
15 #include "ui/aura/test/test_window_delegate.h" | 15 #include "ui/aura/test/test_window_delegate.h" |
16 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
17 #include "ui/compositor/test/context_factories_for_test.h" | 17 #include "ui/compositor/test/context_factories_for_test.h" |
| 18 #include "ui/wm/core/default_activation_client.h" |
18 | 19 |
19 using ::testing::_; | 20 using ::testing::_; |
20 using ::testing::AnyNumber; | 21 using ::testing::AnyNumber; |
21 using ::testing::DoAll; | 22 using ::testing::DoAll; |
22 using ::testing::Expectation; | 23 using ::testing::Expectation; |
23 using ::testing::InvokeWithoutArgs; | 24 using ::testing::InvokeWithoutArgs; |
24 using ::testing::SaveArg; | 25 using ::testing::SaveArg; |
25 | 26 |
26 namespace media { | 27 namespace media { |
27 class VideoFrame; | 28 class VideoFrame; |
(...skipping 30 matching lines...) Expand all Loading... |
58 : browser_thread_for_ui_(BrowserThread::UI, &message_loop_) {} | 59 : browser_thread_for_ui_(BrowserThread::UI, &message_loop_) {} |
59 virtual ~DesktopCaptureDeviceAuraTest() {} | 60 virtual ~DesktopCaptureDeviceAuraTest() {} |
60 | 61 |
61 protected: | 62 protected: |
62 virtual void SetUp() OVERRIDE { | 63 virtual void SetUp() OVERRIDE { |
63 // The ContextFactory must exist before any Compositors are created. | 64 // The ContextFactory must exist before any Compositors are created. |
64 bool enable_pixel_output = false; | 65 bool enable_pixel_output = false; |
65 ui::InitializeContextFactoryForTests(enable_pixel_output); | 66 ui::InitializeContextFactoryForTests(enable_pixel_output); |
66 helper_.reset(new aura::test::AuraTestHelper(&message_loop_)); | 67 helper_.reset(new aura::test::AuraTestHelper(&message_loop_)); |
67 helper_->SetUp(); | 68 helper_->SetUp(); |
| 69 new wm::DefaultActivationClient(helper_->root_window()); |
68 | 70 |
69 // We need a window to cover desktop area so that DesktopCaptureDeviceAura | 71 // We need a window to cover desktop area so that DesktopCaptureDeviceAura |
70 // can use gfx::NativeWindow::GetWindowAtScreenPoint() to locate the | 72 // can use gfx::NativeWindow::GetWindowAtScreenPoint() to locate the |
71 // root window associated with the primary display. | 73 // root window associated with the primary display. |
72 gfx::Rect desktop_bounds = root_window()->bounds(); | 74 gfx::Rect desktop_bounds = root_window()->bounds(); |
73 window_delegate_.reset(new aura::test::TestWindowDelegate()); | 75 window_delegate_.reset(new aura::test::TestWindowDelegate()); |
74 desktop_window_.reset(new aura::Window(window_delegate_.get())); | 76 desktop_window_.reset(new aura::Window(window_delegate_.get())); |
75 desktop_window_->Init(aura::WINDOW_LAYER_TEXTURED); | 77 desktop_window_->Init(aura::WINDOW_LAYER_TEXTURED); |
76 desktop_window_->SetBounds(desktop_bounds); | 78 desktop_window_->SetBounds(desktop_bounds); |
77 aura::client::ParentWindowWithContext( | 79 aura::client::ParentWindowWithContext( |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 capture_params.requested_format.frame_rate = kFrameRate; | 115 capture_params.requested_format.frame_rate = kFrameRate; |
114 capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420; | 116 capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420; |
115 capture_params.allow_resolution_change = false; | 117 capture_params.allow_resolution_change = false; |
116 capture_device->AllocateAndStart( | 118 capture_device->AllocateAndStart( |
117 capture_params, client.PassAs<media::VideoCaptureDevice::Client>()); | 119 capture_params, client.PassAs<media::VideoCaptureDevice::Client>()); |
118 capture_device->StopAndDeAllocate(); | 120 capture_device->StopAndDeAllocate(); |
119 } | 121 } |
120 | 122 |
121 } // namespace | 123 } // namespace |
122 } // namespace content | 124 } // namespace content |
OLD | NEW |