Index: base/mac/scoped_sending_event_unittest.mm |
diff --git a/base/mac/scoped_sending_event_unittest.mm b/base/mac/scoped_sending_event_unittest.mm |
index 9ae99856c9e76e37b169e4d886ccea42a51eddcb..95f6eba16ab4304bd5a23a81062971c371094d1a 100644 |
--- a/base/mac/scoped_sending_event_unittest.mm |
+++ b/base/mac/scoped_sending_event_unittest.mm |
@@ -4,12 +4,39 @@ |
#import "base/mac/scoped_sending_event.h" |
+#import <Foundation/Foundation.h> |
+ |
+#include "base/mac/scoped_nsobject.h" |
#include "testing/gtest/include/gtest/gtest.h" |
Mark Mentovai
2014/10/17 19:44:58
:)
|
+@interface ScopedSendingEventTestCrApp : NSObject <CrAppControlProtocol> { |
+ @private |
+ BOOL handlingSendEvent_; |
+} |
+@property(nonatomic, assign, getter=isHandlingSendEvent) BOOL handlingSendEvent; |
+@end |
+ |
+@implementation ScopedSendingEventTestCrApp |
+@synthesize handlingSendEvent = handlingSendEvent_; |
+@end |
+ |
namespace { |
+class ScopedSendingEventTest : public testing::Test { |
+ public: |
+ ScopedSendingEventTest() : app_([[ScopedSendingEventTestCrApp alloc] init]) { |
+ NSApp = app_.get(); |
+ } |
+ virtual ~ScopedSendingEventTest() { |
+ NSApp = nil; |
+ } |
+ |
+ private: |
+ base::scoped_nsobject<ScopedSendingEventTestCrApp> app_; |
+}; |
+ |
// Sets the flag within scope, resets when leaving scope. |
-TEST(ScopedSendingEventTest, SetHandlingSendEvent) { |
+TEST_F(ScopedSendingEventTest, SetHandlingSendEvent) { |
id<CrAppProtocol> app = NSApp; |
EXPECT_FALSE([app isHandlingSendEvent]); |
{ |
@@ -20,7 +47,7 @@ TEST(ScopedSendingEventTest, SetHandlingSendEvent) { |
} |
// Nested call restores previous value rather than resetting flag. |
-TEST(ScopedSendingEventTest, NestedSetHandlingSendEvent) { |
+TEST_F(ScopedSendingEventTest, NestedSetHandlingSendEvent) { |
id<CrAppProtocol> app = NSApp; |
EXPECT_FALSE([app isHandlingSendEvent]); |
{ |