OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright 2012 The WebRTC Project Authors. All rights reserved. | |
3 * | |
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 | |
6 * tree. An additional intellectual property rights grant can be found | |
7 * in the file PATENTS. All contributing project authors may | |
8 * be found in the AUTHORS file in the root of the source tree. | |
9 */ | |
10 #include <memory> | |
11 | |
12 #include "webrtc/base/gunit.h" | |
13 #include "webrtc/base/testutils.h" | |
14 #include "webrtc/base/window.h" | |
15 #include "webrtc/base/windowpicker.h" | |
16 #include "webrtc/base/windowpickerfactory.h" | |
17 | |
18 #if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) | |
19 # define DISABLE_ON_MAC(name) DISABLED_ ## name | |
20 #else | |
21 # define DISABLE_ON_MAC(name) name | |
22 #endif | |
23 | |
24 TEST(WindowPickerTest, GetWindowList) { | |
25 MAYBE_SKIP_SCREENCAST_TEST(); | |
26 if (!rtc::WindowPickerFactory::IsSupported()) { | |
27 LOG(LS_INFO) << "skipping test: window capturing is not supported with " | |
28 << "current configuration."; | |
29 } | |
30 std::unique_ptr<rtc::WindowPicker> picker( | |
31 rtc::WindowPickerFactory::CreateWindowPicker()); | |
32 EXPECT_TRUE(picker->Init()); | |
33 rtc::WindowDescriptionList descriptions; | |
34 EXPECT_TRUE(picker->GetWindowList(&descriptions)); | |
35 } | |
36 | |
37 // TODO(hughv) Investigate why this fails on pulse but not locally after | |
38 // upgrading to XCode 4.5. The failure is GetDesktopList returning FALSE. | |
39 TEST(WindowPickerTest, DISABLE_ON_MAC(GetDesktopList)) { | |
40 MAYBE_SKIP_SCREENCAST_TEST(); | |
41 if (!rtc::WindowPickerFactory::IsSupported()) { | |
42 LOG(LS_INFO) << "skipping test: window capturing is not supported with " | |
43 << "current configuration."; | |
44 } | |
45 std::unique_ptr<rtc::WindowPicker> picker( | |
46 rtc::WindowPickerFactory::CreateWindowPicker()); | |
47 EXPECT_TRUE(picker->Init()); | |
48 rtc::DesktopDescriptionList descriptions; | |
49 EXPECT_TRUE(picker->GetDesktopList(&descriptions)); | |
50 if (descriptions.size() > 0) { | |
51 int width = 0; | |
52 int height = 0; | |
53 EXPECT_TRUE(picker->GetDesktopDimensions(descriptions[0].id(), &width, | |
54 &height)); | |
55 EXPECT_GT(width, 0); | |
56 EXPECT_GT(height, 0); | |
57 | |
58 // Test |IsPrimaryDesktop|. Only one desktop should be a primary. | |
59 bool found_primary = false; | |
60 for (rtc::DesktopDescriptionList::iterator it = descriptions.begin(); | |
61 it != descriptions.end(); ++it) { | |
62 if (it->primary()) { | |
63 EXPECT_FALSE(found_primary); | |
64 found_primary = true; | |
65 } | |
66 } | |
67 EXPECT_TRUE(found_primary); | |
68 } | |
69 } | |
OLD | NEW |