Index: chrome/browser/apps/app_shim/app_shim_interactive_uitest_mac.mm |
diff --git a/chrome/browser/apps/app_shim/app_shim_interactive_uitest_mac.mm b/chrome/browser/apps/app_shim/app_shim_interactive_uitest_mac.mm |
index 4c1b143935cc5ceb876c35868bb39946595ce267..5eb10d199ae422aae6e6eaa6c3350386fd8fe0f2 100644 |
--- a/chrome/browser/apps/app_shim/app_shim_interactive_uitest_mac.mm |
+++ b/chrome/browser/apps/app_shim/app_shim_interactive_uitest_mac.mm |
@@ -35,6 +35,7 @@ |
#include "extensions/browser/app_window/native_app_window.h" |
#include "extensions/browser/extension_prefs.h" |
#include "extensions/test/extension_test_message_listener.h" |
+#import "ui/base/test/windowed_nsnotification_observer.h" |
#import "ui/events/test/cocoa_test_event_utils.h" |
namespace { |
@@ -301,59 +302,6 @@ Browser* GetFirstHostedAppWindow() { |
} // namespace |
-// Watches for NSNotifications from the shared workspace. |
-@interface WindowedNSNotificationObserver : NSObject { |
- @private |
- base::scoped_nsobject<NSString> bundleId_; |
- BOOL notificationReceived_; |
- scoped_ptr<base::RunLoop> runLoop_; |
-} |
- |
-- (id)initForNotification:(NSString*)name |
- andBundleId:(NSString*)bundleId; |
-- (void)observe:(NSNotification*)notification; |
-- (void)wait; |
-@end |
- |
-@implementation WindowedNSNotificationObserver |
- |
-- (id)initForNotification:(NSString*)name |
- andBundleId:(NSString*)bundleId { |
- if (self = [super init]) { |
- bundleId_.reset([[bundleId copy] retain]); |
- [[[NSWorkspace sharedWorkspace] notificationCenter] |
- addObserver:self |
- selector:@selector(observe:) |
- name:name |
- object:nil]; |
- } |
- return self; |
-} |
- |
-- (void)observe:(NSNotification*)notification { |
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
- |
- NSRunningApplication* application = |
- [[notification userInfo] objectForKey:NSWorkspaceApplicationKey]; |
- if (![[application bundleIdentifier] isEqualToString:bundleId_]) |
- return; |
- |
- [[[NSWorkspace sharedWorkspace] notificationCenter] removeObserver:self]; |
- notificationReceived_ = YES; |
- if (runLoop_.get()) |
- runLoop_->Quit(); |
-} |
- |
-- (void)wait { |
- if (notificationReceived_) |
- return; |
- |
- runLoop_.reset(new base::RunLoop); |
- runLoop_->Run(); |
-} |
- |
-@end |
- |
namespace apps { |
// Shims require static libraries http://crbug.com/386024. |