| OLD | NEW | 
|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #import "ui/base/test/ui_cocoa_test_helper.h" | 5 #import "ui/base/test/ui_cocoa_test_helper.h" | 
| 6 | 6 | 
| 7 #include "base/debug/debugger.h" | 7 #include "base/debug/debugger.h" | 
| 8 #include "base/logging.h" | 8 #include "base/logging.h" | 
|  | 9 #include "base/stl_util.h" | 
| 9 #include "base/test/test_timeouts.h" | 10 #include "base/test/test_timeouts.h" | 
| 10 | 11 | 
| 11 @implementation CocoaTestHelperWindow | 12 @implementation CocoaTestHelperWindow | 
| 12 | 13 | 
| 13 - (id)initWithContentRect:(NSRect)contentRect { | 14 - (id)initWithContentRect:(NSRect)contentRect { | 
| 14   return [self initWithContentRect:contentRect | 15   return [self initWithContentRect:contentRect | 
| 15                          styleMask:NSBorderlessWindowMask | 16                          styleMask:NSBorderlessWindowMask | 
| 16                            backing:NSBackingStoreBuffered | 17                            backing:NSBackingStoreBuffered | 
| 17                              defer:NO]; | 18                              defer:NO]; | 
| 18 } | 19 } | 
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 172   base::mac::ScopedNSAutoreleasePool pool; | 173   base::mac::ScopedNSAutoreleasePool pool; | 
| 173   NSArray *appWindows = [NSApp windows]; | 174   NSArray *appWindows = [NSApp windows]; | 
| 174   for (NSWindow *window in appWindows) { | 175   for (NSWindow *window in appWindows) { | 
| 175     windows.insert(window); | 176     windows.insert(window); | 
| 176   } | 177   } | 
| 177   return windows; | 178   return windows; | 
| 178 } | 179 } | 
| 179 | 180 | 
| 180 std::set<NSWindow*> CocoaTest::WindowsLeft() { | 181 std::set<NSWindow*> CocoaTest::WindowsLeft() { | 
| 181   const std::set<NSWindow*> windows(ApplicationWindows()); | 182   const std::set<NSWindow*> windows(ApplicationWindows()); | 
| 182   std::set<NSWindow*> windows_left; | 183   std::set<NSWindow*> windows_left = | 
| 183   std::set_difference(windows.begin(), windows.end(), | 184       base::STLSetDifference<std::set<NSWindow*> >(windows, initial_windows_); | 
| 184                       initial_windows_.begin(), initial_windows_.end(), |  | 
| 185                       std::inserter(windows_left, windows_left.begin())); |  | 
| 186   return windows_left; | 185   return windows_left; | 
| 187 } | 186 } | 
| 188 | 187 | 
| 189 CocoaTestHelperWindow* CocoaTest::test_window() { | 188 CocoaTestHelperWindow* CocoaTest::test_window() { | 
| 190   if (!test_window_) { | 189   if (!test_window_) { | 
| 191     test_window_ = [[CocoaTestHelperWindow alloc] init]; | 190     test_window_ = [[CocoaTestHelperWindow alloc] init]; | 
| 192     if (base::debug::BeingDebugged()) { | 191     if (base::debug::BeingDebugged()) { | 
| 193       [test_window_ orderFront:nil]; | 192       [test_window_ orderFront:nil]; | 
| 194     } else { | 193     } else { | 
| 195       [test_window_ orderBack:nil]; | 194       [test_window_ orderBack:nil]; | 
| 196     } | 195     } | 
| 197   } | 196   } | 
| 198   return test_window_; | 197   return test_window_; | 
| 199 } | 198 } | 
| 200 | 199 | 
| 201 }  // namespace ui | 200 }  // namespace ui | 
| OLD | NEW | 
|---|