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

Unified Diff: chrome/browser/app_controller_mac_unittest.mm

Issue 2435053002: Remove the sign-in menu item on macOS. (Closed)
Patch Set: Rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/app_controller_mac.mm ('k') | chrome/browser/signin/signin_ui_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/app_controller_mac_unittest.mm
diff --git a/chrome/browser/app_controller_mac_unittest.mm b/chrome/browser/app_controller_mac_unittest.mm
index 0539ea4ac52828aaeaa4a0ea2951a6fff76ac9df..da14d701d055f4b8d7204cfacd9e489ed3fb716b 100644
--- a/chrome/browser/app_controller_mac_unittest.mm
+++ b/chrome/browser/app_controller_mac_unittest.mm
@@ -91,137 +91,3 @@ TEST_F(AppControllerTest, LastProfile) {
EXPECT_EQ(dest_path2, [ac lastProfile]->GetPath());
}
-
-TEST_F(AppControllerTest, TestSigninMenuItemNoErrors) {
- base::scoped_nsobject<NSMenuItem> syncMenuItem(
- [[NSMenuItem alloc] initWithTitle:@""
- action:@selector(commandDispatch)
- keyEquivalent:@""]);
- [syncMenuItem setTag:IDC_SHOW_SYNC_SETUP];
-
- NSString* startSignin = l10n_util::GetNSStringFWithFixup(
- IDS_SYNC_MENU_PRE_SYNCED_LABEL,
- l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME));
-
- // Make sure shouldShow parameter is obeyed, and we get the default
- // label if not signed in.
- [AppController updateSigninItem:syncMenuItem
- shouldShow:YES
- currentProfile:profile_];
-
- EXPECT_TRUE([[syncMenuItem title] isEqualTo:startSignin]);
- EXPECT_FALSE([syncMenuItem isHidden]);
-
- [AppController updateSigninItem:syncMenuItem
- shouldShow:NO
- currentProfile:profile_];
- EXPECT_TRUE([[syncMenuItem title] isEqualTo:startSignin]);
- EXPECT_TRUE([syncMenuItem isHidden]);
-
- // Now sign in.
- std::string username = "foo@example.com";
- NSString* alreadySignedIn = l10n_util::GetNSStringFWithFixup(
- IDS_SYNC_MENU_SYNCED_LABEL, base::UTF8ToUTF16(username));
- SigninManager* signin = SigninManagerFactory::GetForProfile(profile_);
- signin->SetAuthenticatedAccountInfo(username, username);
- browser_sync::ProfileSyncService* sync =
- ProfileSyncServiceFactory::GetForProfile(profile_);
- sync->SetFirstSetupComplete();
- [AppController updateSigninItem:syncMenuItem
- shouldShow:YES
- currentProfile:profile_];
- EXPECT_TRUE([[syncMenuItem title] isEqualTo:alreadySignedIn]);
- EXPECT_FALSE([syncMenuItem isHidden]);
-}
-
-TEST_F(AppControllerTest, TestSigninMenuItemAuthError) {
- base::scoped_nsobject<NSMenuItem> syncMenuItem(
- [[NSMenuItem alloc] initWithTitle:@""
- action:@selector(commandDispatch)
- keyEquivalent:@""]);
- [syncMenuItem setTag:IDC_SHOW_SYNC_SETUP];
-
- // Now sign in.
- std::string username = "foo@example.com";
- SigninManager* signin = SigninManagerFactory::GetForProfile(profile_);
- signin->SetAuthenticatedAccountInfo(username, username);
- browser_sync::ProfileSyncService* sync =
- ProfileSyncServiceFactory::GetForProfile(profile_);
- sync->SetFirstSetupComplete();
- // Force an auth error.
- FakeAuthStatusProvider provider(
- SigninErrorControllerFactory::GetForProfile(profile_));
- GoogleServiceAuthError error(
- GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS);
- provider.SetAuthError("user@gmail.com", error);
- [AppController updateSigninItem:syncMenuItem
- shouldShow:YES
- currentProfile:profile_];
- NSString* authError =
- l10n_util::GetNSStringWithFixup(IDS_SYNC_SIGN_IN_ERROR_WRENCH_MENU_ITEM);
- EXPECT_TRUE([[syncMenuItem title] isEqualTo:authError]);
- EXPECT_FALSE([syncMenuItem isHidden]);
-}
-
-// If there's a separator after the signin menu item, make sure it is hidden/
-// shown when the signin menu item is.
-TEST_F(AppControllerTest, TestSigninMenuItemWithSeparator) {
- base::scoped_nsobject<NSMenu> menu([[NSMenu alloc] initWithTitle:@""]);
- NSMenuItem* signinMenuItem = [menu addItemWithTitle:@""
- action:@selector(commandDispatch)
- keyEquivalent:@""];
- [signinMenuItem setTag:IDC_SHOW_SYNC_SETUP];
- NSMenuItem* followingSeparator = [NSMenuItem separatorItem];
- [menu addItem:followingSeparator];
- [signinMenuItem setHidden:NO];
- [followingSeparator setHidden:NO];
-
- [AppController updateSigninItem:signinMenuItem
- shouldShow:NO
- currentProfile:profile_];
-
- EXPECT_FALSE([followingSeparator isEnabled]);
- EXPECT_TRUE([signinMenuItem isHidden]);
- EXPECT_TRUE([followingSeparator isHidden]);
-
- [AppController updateSigninItem:signinMenuItem
- shouldShow:YES
- currentProfile:profile_];
-
- EXPECT_FALSE([followingSeparator isEnabled]);
- EXPECT_FALSE([signinMenuItem isHidden]);
- EXPECT_FALSE([followingSeparator isHidden]);
-}
-
-// If there's a non-separator item after the signin menu item, it should not
-// change state when the signin menu item is hidden/shown.
-TEST_F(AppControllerTest, TestSigninMenuItemWithNonSeparator) {
- base::scoped_nsobject<NSMenu> menu([[NSMenu alloc] initWithTitle:@""]);
- NSMenuItem* signinMenuItem = [menu addItemWithTitle:@""
- action:@selector(commandDispatch)
- keyEquivalent:@""];
- [signinMenuItem setTag:IDC_SHOW_SYNC_SETUP];
- NSMenuItem* followingNonSeparator =
- [menu addItemWithTitle:@""
- action:@selector(commandDispatch)
- keyEquivalent:@""];
- [signinMenuItem setHidden:NO];
- [followingNonSeparator setHidden:NO];
-
- [AppController updateSigninItem:signinMenuItem
- shouldShow:NO
- currentProfile:profile_];
-
- EXPECT_TRUE([followingNonSeparator isEnabled]);
- EXPECT_TRUE([signinMenuItem isHidden]);
- EXPECT_FALSE([followingNonSeparator isHidden]);
-
- [followingNonSeparator setHidden:YES];
- [AppController updateSigninItem:signinMenuItem
- shouldShow:YES
- currentProfile:profile_];
-
- EXPECT_TRUE([followingNonSeparator isEnabled]);
- EXPECT_FALSE([signinMenuItem isHidden]);
- EXPECT_TRUE([followingNonSeparator isHidden]);
-}
« no previous file with comments | « chrome/browser/app_controller_mac.mm ('k') | chrome/browser/signin/signin_ui_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698