Chromium Code Reviews| Index: base/test/mock_chrome_application_mac.mm |
| diff --git a/base/test/mock_chrome_application_mac.mm b/base/test/mock_chrome_application_mac.mm |
| index 48db4195cab976a24270326892ee0970ecefa6ed..b0b86171d75481b1438fb5b184188699e2f6504b 100644 |
| --- a/base/test/mock_chrome_application_mac.mm |
| +++ b/base/test/mock_chrome_application_mac.mm |
| @@ -4,22 +4,38 @@ |
| #include "base/test/mock_chrome_application_mac.h" |
| +#include "base/auto_reset.h" |
| #include "base/logging.h" |
| @implementation MockCrApp |
| + |
| ++ (NSApplication*)sharedApplication { |
| + NSApplication* app = [super sharedApplication]; |
| + DCHECK([app conformsToProtocol:@protocol(CrAppControlProtocol)]) |
| + << "Existing NSApp (class " << [[app className] UTF8String] |
| + << ") does not conform to required protocol."; |
| + return app; |
| +} |
| + |
| +- (void)sendEvent:(NSEvent*)event { |
| + AutoReset<BOOL> scoper(&handlingSendEvent_, YES); |
| + [super sendEvent:event]; |
| +} |
| + |
| +- (void)setHandlingSendEvent:(BOOL)handlingSendEvent { |
| + handlingSendEvent_ = handlingSendEvent; |
| +} |
| + |
| - (BOOL)isHandlingSendEvent { |
| - return NO; |
| + return handlingSendEvent_; |
| } |
| + |
| @end |
| namespace mock_cr_app { |
| void RegisterMockCrApp() { |
| - NSApplication* app = [MockCrApp sharedApplication]; |
| - |
| - // Would prefer ASSERT_TRUE() to provide better test failures, but |
| - // this class is used by remoting/ for a non-test use. |
|
Nico
2011/11/30 18:04:13
Is this still true?
Scott Hess - ex-Googler
2011/12/01 19:28:51
It's still being used by remoting/, but I'm becomi
|
| - DCHECK([app conformsToProtocol:@protocol(CrAppProtocol)]); |
| + [MockCrApp sharedApplication]; |
| } |
| } // namespace mock_cr_app |