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

Side by Side Diff: webrtc/base/windowpicker_unittest.cc

Issue 1920043002: Replace scoped_ptr with unique_ptr in webrtc/base/ (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebased Created 4 years, 7 months 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
« no previous file with comments | « webrtc/base/win32regkey.cc ('k') | webrtc/base/x11windowpicker.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2012 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 #include <memory>
11
10 #include "webrtc/base/gunit.h" 12 #include "webrtc/base/gunit.h"
11 #include "webrtc/base/testutils.h" 13 #include "webrtc/base/testutils.h"
12 #include "webrtc/base/window.h" 14 #include "webrtc/base/window.h"
13 #include "webrtc/base/windowpicker.h" 15 #include "webrtc/base/windowpicker.h"
14 #include "webrtc/base/windowpickerfactory.h" 16 #include "webrtc/base/windowpickerfactory.h"
15 17
16 #if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) 18 #if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
17 # define DISABLE_ON_MAC(name) DISABLED_ ## name 19 # define DISABLE_ON_MAC(name) DISABLED_ ## name
18 #else 20 #else
19 # define DISABLE_ON_MAC(name) name 21 # define DISABLE_ON_MAC(name) name
20 #endif 22 #endif
21 23
22 TEST(WindowPickerTest, GetWindowList) { 24 TEST(WindowPickerTest, GetWindowList) {
23 MAYBE_SKIP_SCREENCAST_TEST(); 25 MAYBE_SKIP_SCREENCAST_TEST();
24 if (!rtc::WindowPickerFactory::IsSupported()) { 26 if (!rtc::WindowPickerFactory::IsSupported()) {
25 LOG(LS_INFO) << "skipping test: window capturing is not supported with " 27 LOG(LS_INFO) << "skipping test: window capturing is not supported with "
26 << "current configuration."; 28 << "current configuration.";
27 } 29 }
28 rtc::scoped_ptr<rtc::WindowPicker> picker( 30 std::unique_ptr<rtc::WindowPicker> picker(
29 rtc::WindowPickerFactory::CreateWindowPicker()); 31 rtc::WindowPickerFactory::CreateWindowPicker());
30 EXPECT_TRUE(picker->Init()); 32 EXPECT_TRUE(picker->Init());
31 rtc::WindowDescriptionList descriptions; 33 rtc::WindowDescriptionList descriptions;
32 EXPECT_TRUE(picker->GetWindowList(&descriptions)); 34 EXPECT_TRUE(picker->GetWindowList(&descriptions));
33 } 35 }
34 36
35 // TODO(hughv) Investigate why this fails on pulse but not locally after 37 // TODO(hughv) Investigate why this fails on pulse but not locally after
36 // upgrading to XCode 4.5. The failure is GetDesktopList returning FALSE. 38 // upgrading to XCode 4.5. The failure is GetDesktopList returning FALSE.
37 TEST(WindowPickerTest, DISABLE_ON_MAC(GetDesktopList)) { 39 TEST(WindowPickerTest, DISABLE_ON_MAC(GetDesktopList)) {
38 MAYBE_SKIP_SCREENCAST_TEST(); 40 MAYBE_SKIP_SCREENCAST_TEST();
39 if (!rtc::WindowPickerFactory::IsSupported()) { 41 if (!rtc::WindowPickerFactory::IsSupported()) {
40 LOG(LS_INFO) << "skipping test: window capturing is not supported with " 42 LOG(LS_INFO) << "skipping test: window capturing is not supported with "
41 << "current configuration."; 43 << "current configuration.";
42 } 44 }
43 rtc::scoped_ptr<rtc::WindowPicker> picker( 45 std::unique_ptr<rtc::WindowPicker> picker(
44 rtc::WindowPickerFactory::CreateWindowPicker()); 46 rtc::WindowPickerFactory::CreateWindowPicker());
45 EXPECT_TRUE(picker->Init()); 47 EXPECT_TRUE(picker->Init());
46 rtc::DesktopDescriptionList descriptions; 48 rtc::DesktopDescriptionList descriptions;
47 EXPECT_TRUE(picker->GetDesktopList(&descriptions)); 49 EXPECT_TRUE(picker->GetDesktopList(&descriptions));
48 if (descriptions.size() > 0) { 50 if (descriptions.size() > 0) {
49 int width = 0; 51 int width = 0;
50 int height = 0; 52 int height = 0;
51 EXPECT_TRUE(picker->GetDesktopDimensions(descriptions[0].id(), &width, 53 EXPECT_TRUE(picker->GetDesktopDimensions(descriptions[0].id(), &width,
52 &height)); 54 &height));
53 EXPECT_GT(width, 0); 55 EXPECT_GT(width, 0);
54 EXPECT_GT(height, 0); 56 EXPECT_GT(height, 0);
55 57
56 // Test |IsPrimaryDesktop|. Only one desktop should be a primary. 58 // Test |IsPrimaryDesktop|. Only one desktop should be a primary.
57 bool found_primary = false; 59 bool found_primary = false;
58 for (rtc::DesktopDescriptionList::iterator it = descriptions.begin(); 60 for (rtc::DesktopDescriptionList::iterator it = descriptions.begin();
59 it != descriptions.end(); ++it) { 61 it != descriptions.end(); ++it) {
60 if (it->primary()) { 62 if (it->primary()) {
61 EXPECT_FALSE(found_primary); 63 EXPECT_FALSE(found_primary);
62 found_primary = true; 64 found_primary = true;
63 } 65 }
64 } 66 }
65 EXPECT_TRUE(found_primary); 67 EXPECT_TRUE(found_primary);
66 } 68 }
67 } 69 }
OLDNEW
« no previous file with comments | « webrtc/base/win32regkey.cc ('k') | webrtc/base/x11windowpicker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698