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

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

Issue 17593006: mac: Update clients of scoped_nsobject.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: iwyu, scoped_nsprotocol Created 7 years, 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/ui/cocoa/browser/avatar_menu_bubble_controller.h" 5 #import "chrome/browser/ui/cocoa/browser/avatar_menu_bubble_controller.h"
6 6
7 #include "base/memory/scoped_nsobject.h" 7 #include "base/mac/scoped_nsobject.h"
8 #include "base/message_loop/message_pump_mac.h" 8 #include "base/message_loop/message_pump_mac.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/prefs/pref_service_syncable.h" 10 #include "chrome/browser/prefs/pref_service_syncable.h"
11 #include "chrome/browser/profiles/avatar_menu_model.h" 11 #include "chrome/browser/profiles/avatar_menu_model.h"
12 #include "chrome/browser/profiles/avatar_menu_model_observer.h" 12 #include "chrome/browser/profiles/avatar_menu_model_observer.h"
13 #include "chrome/browser/profiles/profile_info_cache.h" 13 #include "chrome/browser/profiles/profile_info_cache.h"
14 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" 14 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h"
15 #import "chrome/browser/ui/cocoa/hyperlink_button_cell.h" 15 #import "chrome/browser/ui/cocoa/hyperlink_button_cell.h"
16 #include "chrome/test/base/testing_browser_process.h" 16 #include "chrome/test/base/testing_browser_process.h"
17 #include "chrome/test/base/testing_profile_manager.h" 17 #include "chrome/test/base/testing_profile_manager.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 109
110 [controller() close]; 110 [controller() close];
111 } 111 }
112 112
113 TEST_F(AvatarMenuBubbleControllerTest, PerformLayout) { 113 TEST_F(AvatarMenuBubbleControllerTest, PerformLayout) {
114 [controller() showWindow:nil]; 114 [controller() showWindow:nil];
115 115
116 NSView* contents = [[controller() window] contentView]; 116 NSView* contents = [[controller() window] contentView];
117 EXPECT_EQ(4U, [[contents subviews] count]); 117 EXPECT_EQ(4U, [[contents subviews] count]);
118 118
119 scoped_nsobject<NSMutableArray> oldItems([[controller() items] copy]); 119 base::scoped_nsobject<NSMutableArray> oldItems([[controller() items] copy]);
120 120
121 // Now create a new profile and notify the delegate. 121 // Now create a new profile and notify the delegate.
122 manager()->CreateTestingProfile("test3", scoped_ptr<PrefServiceSyncable>(), 122 manager()->CreateTestingProfile("test3", scoped_ptr<PrefServiceSyncable>(),
123 ASCIIToUTF16("Test 3"), 0); 123 ASCIIToUTF16("Test 3"), 0);
124 124
125 // Testing the bridge is not worth the effort... 125 // Testing the bridge is not worth the effort...
126 [controller() performLayout]; 126 [controller() performLayout];
127 127
128 EXPECT_EQ(5U, [[contents subviews] count]); 128 EXPECT_EQ(5U, [[contents subviews] count]);
129 129
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 } 173 }
174 174
175 - (void)sendHighlightMessageForMouseExited { 175 - (void)sendHighlightMessageForMouseExited {
176 [self highlightForEventType:NSMouseExited]; 176 [self highlightForEventType:NSMouseExited];
177 // Quit the pump because the animation was cancelled before it even ran. 177 // Quit the pump because the animation was cancelled before it even ran.
178 pump_->Quit(); 178 pump_->Quit();
179 } 179 }
180 @end 180 @end
181 181
182 TEST_F(AvatarMenuBubbleControllerTest, HighlightForEventType) { 182 TEST_F(AvatarMenuBubbleControllerTest, HighlightForEventType) {
183 scoped_nsobject<TestingAvatarMenuItemController> item( 183 base::scoped_nsobject<TestingAvatarMenuItemController> item(
184 [[TestingAvatarMenuItemController alloc] initWithModelIndex:0 184 [[TestingAvatarMenuItemController alloc] initWithModelIndex:0
185 menuController:nil]); 185 menuController:nil]);
186 // Test non-active states first. 186 // Test non-active states first.
187 [[item activeView] setHidden:YES]; 187 [[item activeView] setHidden:YES];
188 188
189 NSView* editButton = [item editButton]; 189 NSView* editButton = [item editButton];
190 NSView* emailField = [item emailField]; 190 NSView* emailField = [item emailField];
191 191
192 // The edit link remains hidden. 192 // The edit link remains hidden.
193 [item setIsHighlighted:YES]; 193 [item setIsHighlighted:YES];
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 [controller() keyDown:event]; 253 [controller() keyDown:event];
254 EXPECT_EQ([[controller() items] objectAtIndex:0], GetHighlightedItem()); 254 EXPECT_EQ([[controller() items] objectAtIndex:0], GetHighlightedItem());
255 255
256 [controller() keyDown:event]; 256 [controller() keyDown:event];
257 EXPECT_EQ([[controller() items] objectAtIndex:1], GetHighlightedItem()); 257 EXPECT_EQ([[controller() items] objectAtIndex:1], GetHighlightedItem());
258 258
259 // There are no more items now so going up should stay at the first item. 259 // There are no more items now so going up should stay at the first item.
260 [controller() keyDown:event]; 260 [controller() keyDown:event];
261 EXPECT_EQ([[controller() items] objectAtIndex:1], GetHighlightedItem()); 261 EXPECT_EQ([[controller() items] objectAtIndex:1], GetHighlightedItem());
262 } 262 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698