| OLD | NEW | 
|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_UI_COCOA_RUN_LOOP_TESTING_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_TEST_RUN_LOOP_TESTING_H_ | 
| 6 #define CHROME_BROWSER_UI_COCOA_RUN_LOOP_TESTING_H_ | 6 #define CHROME_BROWSER_UI_COCOA_TEST_RUN_LOOP_TESTING_H_ | 
| 7 | 7 | 
| 8 namespace chrome { | 8 namespace chrome { | 
| 9 namespace testing { | 9 namespace testing { | 
| 10 | 10 | 
| 11 // A common pattern in Chromium is to get a selector to execute on the next | 11 // A common pattern in Chromium is to get a selector to execute on the next | 
| 12 // iteration of the outermost run loop, done like so: | 12 // iteration of the outermost run loop, done like so: | 
| 13 // | 13 // | 
| 14 //    [someObj performSelector:@selector(someSel:) withObject:nil afterDelay:0]; | 14 //    [someObj performSelector:@selector(someSel:) withObject:nil afterDelay:0]; | 
| 15 // | 15 // | 
| 16 // This is used when performing the work will negatively affect something | 16 // This is used when performing the work will negatively affect something | 
| 17 // currently on the stack. Unfortunately this also affects the testability of | 17 // currently on the stack. Unfortunately this also affects the testability of | 
| 18 // objects that do this. A call to this function will pump work like this from | 18 // objects that do this. A call to this function will pump work like this from | 
| 19 // the event queue and run it until all such work, as of the time of calling | 19 // the event queue and run it until all such work, as of the time of calling | 
| 20 // this, has been processed. | 20 // this, has been processed. | 
| 21 // | 21 // | 
| 22 // Note that this is not a NSApplication-based loop, and so things like NSEvents | 22 // Note that this is not a NSApplication-based loop, and so things like NSEvents | 
| 23 // are *not* pumped from the event queue. | 23 // are *not* pumped from the event queue. | 
| 24 void NSRunLoopRunAllPending(); | 24 void NSRunLoopRunAllPending(); | 
| 25 | 25 | 
| 26 }  // namespace testing | 26 }  // namespace testing | 
| 27 }  // namespace chrome | 27 }  // namespace chrome | 
| 28 | 28 | 
| 29 #endif  // CHROME_BROWSER_UI_COCOA_RUN_LOOP_TESTING_H_ | 29 #endif  // CHROME_BROWSER_UI_COCOA_TEST_RUN_LOOP_TESTING_H_ | 
| OLD | NEW | 
|---|