You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.1 KiB

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