Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / base / mac / scoped_sending_event_unittest.mm
index 9ae9985..95f6eba 100644 (file)
@@ -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"
 
+@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]);
   {