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 3// found in the LICENSE file. 4 5#ifndef CHROME_BROWSER_UI_COCOA_RUN_LOOP_TESTING_H_ 6#define CHROME_BROWSER_UI_COCOA_RUN_LOOP_TESTING_H_ 7 8namespace chrome { 9namespace testing { 10 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: 13// 14// [someObj performSelector:@selector(someSel:) withObject:nil afterDelay:0]; 15// 16// This is used when performing the work will negatively affect something 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 19// the event queue and run it until all such work, as of the time of calling 20// this, has been processed. 21// 22// Note that this is not a NSApplication-based loop, and so things like NSEvents 23// are *not* pumped from the event queue. 24void NSRunLoopRunAllPending(); 25 26} // namespace testing 27} // namespace chrome 28 29#endif // CHROME_BROWSER_UI_COCOA_RUN_LOOP_TESTING_H_ 30