1 // Copyright 2010 Google Inc. All Rights Reserved
4 #include "talk/base/gunit.h"
5 #include "talk/base/logging.h"
6 #include "talk/base/macutils.h"
7 #include "talk/base/macwindowpicker.h"
8 #include "talk/base/windowpicker.h"
11 #error Only for Mac OSX
16 bool IsLeopardOrLater() {
17 return GetOSVersionName() >= kMacOSLeopard;
20 // Test that this works on new versions and fails acceptably on old versions.
21 TEST(MacWindowPickerTest, TestGetWindowList) {
22 MacWindowPicker picker, picker2;
23 WindowDescriptionList descriptions;
24 if (IsLeopardOrLater()) {
25 EXPECT_TRUE(picker.Init());
26 EXPECT_TRUE(picker.GetWindowList(&descriptions));
27 EXPECT_TRUE(picker2.GetWindowList(&descriptions)); // Init is optional
29 EXPECT_FALSE(picker.Init());
30 EXPECT_FALSE(picker.GetWindowList(&descriptions));
31 EXPECT_FALSE(picker2.GetWindowList(&descriptions));
35 // TODO: Add verification of the actual parsing, ie, add
36 // functionality to inject a fake get_window_array function which
37 // provide a pre-constructed list of windows.
39 } // namespace talk_base