OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 UI_BASE_TEST_WINDOWED_NSNOTIFICATION_OBSERVER_H_ |
| 6 #define UI_BASE_TEST_WINDOWED_NSNOTIFICATION_OBSERVER_H_ |
| 7 |
| 8 #import <Foundation/Foundation.h> |
| 9 |
| 10 #import "base/mac/scoped_nsobject.h" |
| 11 |
| 12 namespace base { |
| 13 class RunLoop; |
| 14 } |
| 15 |
| 16 // Like WindowedNotificationObserver in content/public/test/test_utils.h, this |
| 17 // starts watching for a notification upon construction and can wait until the |
| 18 // notification is observed. This guarantees that a notification fired between |
| 19 // calls to init and wait will be caught. |
| 20 @interface WindowedNSNotificationObserver : NSObject { |
| 21 @private |
| 22 base::scoped_nsobject<NSString> bundleId_; |
| 23 BOOL notificationReceived_; |
| 24 base::RunLoop* runLoop_; |
| 25 } |
| 26 |
| 27 // Watch for an NSNotification on the default notification center. |
| 28 - (id)initForNotification:(NSString*)name; |
| 29 |
| 30 // Watch for an NSNotification on the shared workspace notification center for |
| 31 // the |
| 32 // given application. |
| 33 - (id)initForWorkspaceNotification:(NSString*)name bundleId:(NSString*)bundleId; |
| 34 |
| 35 // Returns if the notification has been observed, or spins a RunLoop until it |
| 36 // is. Stops observing. |
| 37 - (void)wait; |
| 38 @end |
| 39 |
| 40 #endif // UI_BASE_TEST_WINDOWED_NSNOTIFICATION_OBSERVER_H_ |
OLD | NEW |