Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(327)

Unified Diff: base/mac/scoped_sending_event_unittest.mm

Issue 656293003: [Mac] Do not initialize the MockCrApplication in base::TestSuite. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Invert negated conditions Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/test/test_suite.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
+@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]);
{
« no previous file with comments | « no previous file | base/test/test_suite.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698