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

Unified Diff: chrome/browser/ui/cocoa/profiles/avatar_button_controller_unittest.mm

Issue 605803002: [Mac] Redesign the new avatar button. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
Index: chrome/browser/ui/cocoa/profiles/avatar_button_controller_unittest.mm
diff --git a/chrome/browser/ui/cocoa/profiles/avatar_button_controller_unittest.mm b/chrome/browser/ui/cocoa/profiles/avatar_button_controller_unittest.mm
index 635697807076b15bf3ae00af4c569de2368d14d1..4786a2476f4ec176bb3e9e2f561791df1f910718 100644
--- a/chrome/browser/ui/cocoa/profiles/avatar_button_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/profiles/avatar_button_controller_unittest.mm
@@ -7,6 +7,7 @@
#include "base/command_line.h"
#include "base/mac/scoped_nsobject.h"
#include "base/strings/sys_string_conversions.h"
+#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/profiles/profiles_state.h"
#include "chrome/browser/ui/browser.h"
@@ -48,9 +49,19 @@ class AvatarButtonControllerTest : public CocoaProfileTest {
base::scoped_nsobject<AvatarButtonController> controller_;
};
-TEST_F(AvatarButtonControllerTest, ButtonShown) {
+TEST_F(AvatarButtonControllerTest, GenericButtonShown) {
EXPECT_FALSE([view() isHidden]);
- EXPECT_EQ(l10n_util::GetStringUTF16(IDS_SINGLE_PROFILE_DISPLAY_NAME),
+ // We only have one local profile, which means we are displaying the
+ // generic avatar button.
+ EXPECT_EQ(base::string16(), base::SysNSStringToUTF16([button() title]));
+}
+
+TEST_F(AvatarButtonControllerTest, ProfileButtonShown) {
+ // Create a second profile, to force the button to display the profile name.
+ testing_profile_manager()->CreateTestingProfile("batman");
+
+ EXPECT_FALSE([view() isHidden]);
+ EXPECT_EQ(base::ASCIIToUTF16("Person 1"),
base::SysNSStringToUTF16([button() title]));
}
groby-ooo-7-16 2014/09/25 22:03:30 Can you add a test for the error case, please?
noms (inactive) 2014/09/26 15:49:10 Done.

Powered by Google App Engine
This is Rietveld 408576698