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

Side by Side Diff: webrtc/modules/desktop_capture/mouse_cursor_monitor_unittest.cc

Issue 2479553006: Remove GetWindowList / GetScreenList and SelectWindow / SelectScreen from WebRTC (Closed)
Patch Set: Resolve review comments Created 4 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 DesktopCaptureOptions options = DesktopCaptureOptions::CreateDefault(); 87 DesktopCaptureOptions options = DesktopCaptureOptions::CreateDefault();
88 88
89 // First get list of windows. 89 // First get list of windows.
90 std::unique_ptr<WindowCapturer> window_capturer( 90 std::unique_ptr<WindowCapturer> window_capturer(
91 WindowCapturer::Create(options)); 91 WindowCapturer::Create(options));
92 92
93 // If window capturing is not supported then skip this test. 93 // If window capturing is not supported then skip this test.
94 if (!window_capturer.get()) 94 if (!window_capturer.get())
95 return; 95 return;
96 96
97 WindowCapturer::WindowList windows; 97 DesktopCapturer::SourceList sources;
98 EXPECT_TRUE(window_capturer->GetWindowList(&windows)); 98 EXPECT_TRUE(window_capturer->GetSourceList(&sources));
99 99
100 // Iterate over all windows and try capturing mouse cursor for each of them. 100 // Iterate over all windows and try capturing mouse cursor for each of them.
101 for (size_t i = 0; i < windows.size(); ++i) { 101 for (size_t i = 0; i < sources.size(); ++i) {
102 cursor_image_.reset(); 102 cursor_image_.reset();
103 position_received_ = false; 103 position_received_ = false;
104 104
105 std::unique_ptr<MouseCursorMonitor> capturer( 105 std::unique_ptr<MouseCursorMonitor> capturer(
106 MouseCursorMonitor::CreateForWindow( 106 MouseCursorMonitor::CreateForWindow(
107 DesktopCaptureOptions::CreateDefault(), windows[i].id)); 107 DesktopCaptureOptions::CreateDefault(), sources[i].id));
108 assert(capturer.get()); 108 assert(capturer.get());
109 109
110 capturer->Init(this, MouseCursorMonitor::SHAPE_AND_POSITION); 110 capturer->Init(this, MouseCursorMonitor::SHAPE_AND_POSITION);
111 capturer->Capture(); 111 capturer->Capture();
112 112
113 EXPECT_TRUE(cursor_image_.get()); 113 EXPECT_TRUE(cursor_image_.get());
114 EXPECT_TRUE(position_received_); 114 EXPECT_TRUE(position_received_);
115 } 115 }
116 } 116 }
117 117
118 // Make sure that OnMouseCursorPosition() is not called in the SHAPE_ONLY mode. 118 // Make sure that OnMouseCursorPosition() is not called in the SHAPE_ONLY mode.
119 TEST_F(MouseCursorMonitorTest, MAYBE(ShapeOnly)) { 119 TEST_F(MouseCursorMonitorTest, MAYBE(ShapeOnly)) {
120 std::unique_ptr<MouseCursorMonitor> capturer( 120 std::unique_ptr<MouseCursorMonitor> capturer(
121 MouseCursorMonitor::CreateForScreen( 121 MouseCursorMonitor::CreateForScreen(
122 DesktopCaptureOptions::CreateDefault(), 122 DesktopCaptureOptions::CreateDefault(),
123 webrtc::kFullDesktopScreenId)); 123 webrtc::kFullDesktopScreenId));
124 assert(capturer.get()); 124 assert(capturer.get());
125 capturer->Init(this, MouseCursorMonitor::SHAPE_ONLY); 125 capturer->Init(this, MouseCursorMonitor::SHAPE_ONLY);
126 capturer->Capture(); 126 capturer->Capture();
127 127
128 EXPECT_TRUE(cursor_image_.get()); 128 EXPECT_TRUE(cursor_image_.get());
129 EXPECT_FALSE(position_received_); 129 EXPECT_FALSE(position_received_);
130 } 130 }
131 131
132 } // namespace webrtc 132 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/desktop_capture/mac/window_list_utils.cc ('k') | webrtc/modules/desktop_capture/screen_capturer_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698