OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 5 #import "chrome/browser/ui/cocoa/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/mac/mac_util.h" | 9 #include "base/mac/mac_util.h" |
10 #include "base/test/test_timeouts.h" | 10 #include "base/test/test_timeouts.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 // one to two spins through the event loop to see a change. | 104 // one to two spins through the event loop to see a change. |
105 | 105 |
106 // NOTE(shess): Under valgrind, -nextEventMatchingMask:* in one test | 106 // NOTE(shess): Under valgrind, -nextEventMatchingMask:* in one test |
107 // needed to run twice, once taking .2 seconds, the next time .6 | 107 // needed to run twice, once taking .2 seconds, the next time .6 |
108 // seconds. The loop exit condition attempts to be scalable. | 108 // seconds. The loop exit condition attempts to be scalable. |
109 | 109 |
110 // Get the set of windows which weren't present when the test | 110 // Get the set of windows which weren't present when the test |
111 // started. | 111 // started. |
112 std::set<NSWindow*> windows_left(WindowsLeft()); | 112 std::set<NSWindow*> windows_left(WindowsLeft()); |
113 | 113 |
114 while (windows_left.size() > 0) { | 114 while (!windows_left.empty()) { |
115 // Cover delayed actions by spinning the loop at least once after | 115 // Cover delayed actions by spinning the loop at least once after |
116 // this timeout. | 116 // this timeout. |
117 const NSTimeInterval kCloseTimeoutSeconds = | 117 const NSTimeInterval kCloseTimeoutSeconds = |
118 TestTimeouts::action_timeout_ms() / 1000.0; | 118 TestTimeouts::action_timeout_ms() / 1000.0; |
119 | 119 |
120 // Cover chains of delayed actions by spinning the loop at least | 120 // Cover chains of delayed actions by spinning the loop at least |
121 // this many times. | 121 // this many times. |
122 const int kCloseSpins = 3; | 122 const int kCloseSpins = 3; |
123 | 123 |
124 // Track the set of remaining windows so that everything can be | 124 // Track the set of remaining windows so that everything can be |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 if (!test_window_) { | 198 if (!test_window_) { |
199 test_window_ = [[CocoaTestHelperWindow alloc] init]; | 199 test_window_ = [[CocoaTestHelperWindow alloc] init]; |
200 if (base::debug::BeingDebugged()) { | 200 if (base::debug::BeingDebugged()) { |
201 [test_window_ orderFront:nil]; | 201 [test_window_ orderFront:nil]; |
202 } else { | 202 } else { |
203 [test_window_ orderBack:nil]; | 203 [test_window_ orderBack:nil]; |
204 } | 204 } |
205 } | 205 } |
206 return test_window_; | 206 return test_window_; |
207 } | 207 } |
OLD | NEW |