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

Side by Side Diff: chrome/browser/ui/cocoa/tracking_area_unittest.mm

Issue 6612025: [Mac] Apply CrTrackingArea to the two other places where we get |-mouseMoved:| zombie messages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 9 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/cocoa/tracking_area.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "base/scoped_nsobject.h" 5 #include "base/scoped_nsobject.h"
6 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" 6 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h"
7 #include "chrome/browser/ui/cocoa/objc_zombie.h" 7 #include "chrome/browser/ui/cocoa/objc_zombie.h"
8 #import "chrome/browser/ui/cocoa/tracking_area.h" 8 #import "chrome/browser/ui/cocoa/tracking_area.h"
9 9
10 // A test object that counts the number of times a message is sent to it. 10 // A test object that counts the number of times a message is sent to it.
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 77
78 [owner_ shouldBecomeCrZombie]; 78 [owner_ shouldBecomeCrZombie];
79 owner_.reset(); 79 owner_.reset();
80 [trackingArea_ clearOwner]; 80 [trackingArea_ clearOwner];
81 81
82 [[trackingArea_ owner] performMessage]; 82 [[trackingArea_ owner] performMessage];
83 // Don't crash! 83 // Don't crash!
84 84
85 ObjcEvilDoers::ZombieDisable(); 85 ObjcEvilDoers::ZombieDisable();
86 } 86 }
87
88 TEST_F(CrTrackingAreaTest, ScoperInit) {
89 {
90 ScopedCrTrackingArea scoper([trackingArea_ retain]);
91 [[scoper.get() owner] performMessage];
92 EXPECT_EQ(1U, [owner_ messageCount]);
93 }
94
95 [[trackingArea_ owner] performMessage];
96 EXPECT_EQ(1U, [owner_ messageCount]);
97 }
98
99 TEST_F(CrTrackingAreaTest, ScoperReset) {
100 {
101 ScopedCrTrackingArea scoper;
102 EXPECT_FALSE(scoper.get());
103
104 scoper.reset([trackingArea_ retain]);
105 [[scoper.get() owner] performMessage];
106 EXPECT_EQ(1U, [owner_ messageCount]);
107
108 [[scoper.get() owner] performMessage];
109 EXPECT_EQ(2U, [owner_ messageCount]);
110 }
111
112 [[trackingArea_ owner] performMessage];
113 EXPECT_EQ(2U, [owner_ messageCount]);
114 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/tracking_area.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698