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

Side by Side Diff: base/mac/scoped_sending_event_unittest.mm

Issue 8724004: [Mac] Move ScopedSendingEvent from content/common/mac to base/mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add CrAppControlProtocol support to CrDrtApplication Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "content/common/mac/scoped_sending_event.h" 5 #import "base/mac/scoped_sending_event.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 namespace { 9 namespace {
10 10
11 // Sets the flag within scope, resets when leaving scope. 11 // Sets the flag within scope, resets when leaving scope.
12 TEST(ScopedSendingEventTest, SetHandlingSendEvent) { 12 TEST(ScopedSendingEventTest, SetHandlingSendEvent) {
13 id<CrAppProtocol> app = NSApp; 13 id<CrAppProtocol> app = NSApp;
14 EXPECT_FALSE([app isHandlingSendEvent]); 14 EXPECT_FALSE([app isHandlingSendEvent]);
15 { 15 {
16 content::mac::ScopedSendingEvent is_handling_send_event; 16 base::mac::ScopedSendingEvent is_handling_send_event;
17 EXPECT_TRUE([app isHandlingSendEvent]); 17 EXPECT_TRUE([app isHandlingSendEvent]);
18 } 18 }
19 EXPECT_FALSE([app isHandlingSendEvent]); 19 EXPECT_FALSE([app isHandlingSendEvent]);
20 } 20 }
21 21
22 // Nested call restores previous value rather than resetting flag. 22 // Nested call restores previous value rather than resetting flag.
23 TEST(ScopedSendingEventTest, NestedSetHandlingSendEvent) { 23 TEST(ScopedSendingEventTest, NestedSetHandlingSendEvent) {
24 id<CrAppProtocol> app = NSApp; 24 id<CrAppProtocol> app = NSApp;
25 EXPECT_FALSE([app isHandlingSendEvent]); 25 EXPECT_FALSE([app isHandlingSendEvent]);
26 { 26 {
27 content::mac::ScopedSendingEvent is_handling_send_event; 27 base::mac::ScopedSendingEvent is_handling_send_event;
28 EXPECT_TRUE([app isHandlingSendEvent]); 28 EXPECT_TRUE([app isHandlingSendEvent]);
29 { 29 {
30 content::mac::ScopedSendingEvent nested_is_handling_send_event; 30 base::mac::ScopedSendingEvent nested_is_handling_send_event;
31 EXPECT_TRUE([app isHandlingSendEvent]); 31 EXPECT_TRUE([app isHandlingSendEvent]);
32 } 32 }
33 EXPECT_TRUE([app isHandlingSendEvent]); 33 EXPECT_TRUE([app isHandlingSendEvent]);
34 } 34 }
35 EXPECT_FALSE([app isHandlingSendEvent]); 35 EXPECT_FALSE([app isHandlingSendEvent]);
36 } 36 }
37 37
38 } // namespace 38 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698