Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / ui / base / test / windowed_nsnotification_observer.h
blobadb9621dd5fcb4cba31d041381bbe0cc243ecb08
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.
5 #ifndef UI_BASE_TEST_WINDOWED_NSNOTIFICATION_OBSERVER_H_
6 #define UI_BASE_TEST_WINDOWED_NSNOTIFICATION_OBSERVER_H_
8 #import <Foundation/Foundation.h>
10 #import "base/mac/scoped_nsobject.h"
12 namespace base {
13 class RunLoop;
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 notifications fired between
19 // calls to init and wait will be caught.
20 @interface WindowedNSNotificationObserver : NSObject {
21 @private
22 base::scoped_nsobject<NSString> bundleId_;
23 int notificationCount_;
24 base::RunLoop* runLoop_;
27 @property(readonly, nonatomic) int notificationCount;
29 // Watch for an NSNotification on the default notification center for the given
30 // |notificationSender|, or a nil object if omitted.
31 - (id)initForNotification:(NSString*)name;
33 // Watch for an NSNotification on the default notification center from a
34 // particular object.
35 - (id)initForNotification:(NSString*)name object:(id)sender;
37 // Watch for an NSNotification on the shared workspace notification center for
38 // the given application.
39 - (id)initForWorkspaceNotification:(NSString*)name bundleId:(NSString*)bundleId;
41 // Waits for |minimumCount| notifications to be observed and returns YES.
42 // Returns NO on a timeout. This can be called multiple times.
43 - (BOOL)waitForCount:(int)minimumCount;
45 // Returns YES if any notification has been observed, or spins a RunLoop until
46 // it either is observed, or a timeout occurs. Returns NO on a timeout.
47 - (BOOL)wait;
48 @end
50 #endif // UI_BASE_TEST_WINDOWED_NSNOTIFICATION_OBSERVER_H_