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

Side by Side Diff: chrome/browser/ui/cocoa/profiles/avatar_button_controller_unittest.mm

Issue 2403853002: cocoa browser: remove remaining non-MD code (Closed)
Patch Set: git cl format Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/profiles/avatar_button_controller.h" 5 #import "chrome/browser/ui/cocoa/profiles/avatar_button_controller.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/mac/scoped_nsobject.h" 8 #include "base/mac/scoped_nsobject.h"
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 // Create a second profile, to force the button to display the profile name. 101 // Create a second profile, to force the button to display the profile name.
102 testing_profile_manager()->CreateTestingProfile("batman"); 102 testing_profile_manager()->CreateTestingProfile("batman");
103 103
104 EXPECT_EQ(0, [button() image].size.width); 104 EXPECT_EQ(0, [button() image].size.width);
105 [controller() setErrorStatus:true]; 105 [controller() setErrorStatus:true];
106 106
107 ASSERT_FALSE([view() isHidden]); 107 ASSERT_FALSE([view() isHidden]);
108 EXPECT_NSEQ(@"Person 1", [button() title]); 108 EXPECT_NSEQ(@"Person 1", [button() title]);
109 109
110 // If the button has an authentication error, it should display an error 110 // If the button has an authentication error, it should display an error
111 // icon. If in the MD, the icon size should be 16. 111 // icon.
112 int errorWidth = 112 EXPECT_EQ(16, [button() image].size.width);
113 ui::MaterialDesignController::IsModeMaterial()
114 ? 16
115 : ui::ResourceBundle::GetSharedInstance()
116 .GetNativeImageNamed(IDR_ICON_PROFILES_AVATAR_BUTTON_ERROR)
117 .Width();
118
119 EXPECT_EQ(errorWidth, [button() image].size.width);
120 } 113 }
121 114
122 TEST_F(AvatarButtonControllerTest, DoubleOpen) { 115 TEST_F(AvatarButtonControllerTest, DoubleOpen) {
123 EXPECT_FALSE([controller() menuController]); 116 EXPECT_FALSE([controller() menuController]);
124 117
125 [button() performClick:button()]; 118 [button() performClick:button()];
126 119
127 BaseBubbleController* menu = [controller() menuController]; 120 BaseBubbleController* menu = [controller() menuController];
128 EXPECT_TRUE(menu); 121 EXPECT_TRUE(menu);
129 EXPECT_TRUE([menu isKindOfClass:[ProfileChooserController class]]); 122 EXPECT_TRUE([menu isKindOfClass:[ProfileChooserController class]]);
(...skipping 29 matching lines...) Expand all
159 BaseBubbleController* menu = [controller() menuController]; 152 BaseBubbleController* menu = [controller() menuController];
160 EXPECT_TRUE(menu); 153 EXPECT_TRUE(menu);
161 EXPECT_TRUE([menu isKindOfClass:[ProfileChooserController class]]); 154 EXPECT_TRUE([menu isKindOfClass:[ProfileChooserController class]]);
162 155
163 // Do not animate out because that is hard to test around. 156 // Do not animate out because that is hard to test around.
164 static_cast<InfoBubbleWindow*>(menu.window).allowedAnimations = 157 static_cast<InfoBubbleWindow*>(menu.window).allowedAnimations =
165 info_bubble::kAnimateNone; 158 info_bubble::kAnimateNone;
166 [menu close]; 159 [menu close];
167 EXPECT_FALSE([controller() menuController]); 160 EXPECT_FALSE([controller() menuController]);
168 } 161 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698