1 #include "talk/base/gunit.h"
2 #include "talk/base/testutils.h"
3 #include "talk/base/window.h"
4 #include "talk/base/windowpicker.h"
5 #include "talk/base/windowpickerfactory.h"
8 # define DISABLE_ON_MAC(name) DISABLED_ ## name
10 # define DISABLE_ON_MAC(name) name
13 TEST(WindowPickerTest, GetWindowList) {
14 MAYBE_SKIP_SCREENCAST_TEST();
15 if (!talk_base::WindowPickerFactory::IsSupported()) {
16 LOG(LS_INFO) << "skipping test: window capturing is not supported with "
17 << "current configuration.";
19 talk_base::scoped_ptr<talk_base::WindowPicker> picker(
20 talk_base::WindowPickerFactory::CreateWindowPicker());
21 EXPECT_TRUE(picker->Init());
22 talk_base::WindowDescriptionList descriptions;
23 EXPECT_TRUE(picker->GetWindowList(&descriptions));
26 // TODO(hughv) Investigate why this fails on pulse but not locally after
27 // upgrading to XCode 4.5. The failure is GetDesktopList returning FALSE.
28 TEST(WindowPickerTest, DISABLE_ON_MAC(GetDesktopList)) {
29 MAYBE_SKIP_SCREENCAST_TEST();
30 if (!talk_base::WindowPickerFactory::IsSupported()) {
31 LOG(LS_INFO) << "skipping test: window capturing is not supported with "
32 << "current configuration.";
34 talk_base::scoped_ptr<talk_base::WindowPicker> picker(
35 talk_base::WindowPickerFactory::CreateWindowPicker());
36 EXPECT_TRUE(picker->Init());
37 talk_base::DesktopDescriptionList descriptions;
38 EXPECT_TRUE(picker->GetDesktopList(&descriptions));
39 if (descriptions.size() > 0) {
42 EXPECT_TRUE(picker->GetDesktopDimensions(descriptions[0].id(), &width,
47 // Test |IsPrimaryDesktop|. Only one desktop should be a primary.
48 bool found_primary = false;
49 for (talk_base::DesktopDescriptionList::iterator it = descriptions.begin();
50 it != descriptions.end(); ++it) {
52 EXPECT_FALSE(found_primary);
56 EXPECT_TRUE(found_primary);