Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: content/browser/renderer_host/media/desktop_capture_device_aura_unittest.cc

Issue 100743003: Extend content::DesktopMediaID to allow Aura windows as capture sources. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/renderer_host/media/desktop_capture_device_aura.h" 5 #include "content/browser/renderer_host/media/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 "media/video/capture/video_capture_types.h" 10 #include "media/video/capture/video_capture_types.h"
10 #include "testing/gmock/include/gmock/gmock.h" 11 #include "testing/gmock/include/gmock/gmock.h"
11 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
12 #include "ui/aura/client/window_tree_client.h" 13 #include "ui/aura/client/window_tree_client.h"
13 #include "ui/aura/test/aura_test_helper.h" 14 #include "ui/aura/test/aura_test_helper.h"
14 #include "ui/aura/test/test_window_delegate.h" 15 #include "ui/aura/test/test_window_delegate.h"
15 #include "ui/aura/window.h" 16 #include "ui/aura/window.h"
16 17
17 using ::testing::_; 18 using ::testing::_;
18 using ::testing::AnyNumber; 19 using ::testing::AnyNumber;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 base::MessageLoopForUI message_loop_; 86 base::MessageLoopForUI message_loop_;
86 BrowserThreadImpl browser_thread_for_ui_; 87 BrowserThreadImpl browser_thread_for_ui_;
87 scoped_ptr<aura::test::AuraTestHelper> helper_; 88 scoped_ptr<aura::test::AuraTestHelper> helper_;
88 scoped_ptr<aura::Window> desktop_window_; 89 scoped_ptr<aura::Window> desktop_window_;
89 scoped_ptr<aura::test::TestWindowDelegate> window_delegate_; 90 scoped_ptr<aura::test::TestWindowDelegate> window_delegate_;
90 91
91 DISALLOW_COPY_AND_ASSIGN(DesktopCaptureDeviceAuraTest); 92 DISALLOW_COPY_AND_ASSIGN(DesktopCaptureDeviceAuraTest);
92 }; 93 };
93 94
94 TEST_F(DesktopCaptureDeviceAuraTest, StartAndStop) { 95 TEST_F(DesktopCaptureDeviceAuraTest, StartAndStop) {
95 DesktopMediaID source(DesktopMediaID::TYPE_SCREEN, 0);
96 scoped_ptr<media::VideoCaptureDevice> capture_device( 96 scoped_ptr<media::VideoCaptureDevice> capture_device(
97 DesktopCaptureDeviceAura::Create(source)); 97 DesktopCaptureDeviceAura::Create(
98 content::DesktopMediaID::RegisterAuraWindow(root_window())));
98 99
99 scoped_ptr<MockDeviceClient> client(new MockDeviceClient()); 100 scoped_ptr<MockDeviceClient> client(new MockDeviceClient());
100 EXPECT_CALL(*client, OnError()).Times(0); 101 EXPECT_CALL(*client, OnError()).Times(0);
101 102
102 media::VideoCaptureParams capture_params; 103 media::VideoCaptureParams capture_params;
103 capture_params.requested_format.frame_size.SetSize(640, 480); 104 capture_params.requested_format.frame_size.SetSize(640, 480);
104 capture_params.requested_format.frame_rate = kFrameRate; 105 capture_params.requested_format.frame_rate = kFrameRate;
105 capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420; 106 capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420;
106 capture_params.allow_resolution_change = false; 107 capture_params.allow_resolution_change = false;
107 capture_device->AllocateAndStart( 108 capture_device->AllocateAndStart(
108 capture_params, client.PassAs<media::VideoCaptureDevice::Client>()); 109 capture_params, client.PassAs<media::VideoCaptureDevice::Client>());
109 capture_device->StopAndDeAllocate(); 110 capture_device->StopAndDeAllocate();
110 } 111 }
111 112
112 } // namespace 113 } // namespace
113 } // namespace content 114 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698