diff --git a/chrome/app/media_router_strings.grdp b/chrome/app/media_router_strings.grdp index fd375e4..2eebf2e 100644 --- a/chrome/app/media_router_strings.grdp +++ b/chrome/app/media_router_strings.grdp
@@ -185,7 +185,7 @@ Always use mirroring </message> <message name="IDS_MEDIA_ROUTER_ROUTE_DETAILS_FULLSCREEN_VIDEOS_DROPDOWN_TITLE" desc="The title for a toggle setting to choose whether fullscreen videos should always be mirrored (played locally and remotely), or played only remotely."> - Show fullscreen videos on: + Show fullscreen videos on </message> <message name="IDS_MEDIA_ROUTER_ROUTE_DETAILS_FULLSCREEN_VIDEOS_BOTH_SCREENS" desc="Settings option to play fullscreen videos both locally and remotely."> Both screens
diff --git a/chrome/browser/android/chrome_feature_list.cc b/chrome/browser/android/chrome_feature_list.cc index db61e06b..e70c6db 100644 --- a/chrome/browser/android/chrome_feature_list.cc +++ b/chrome/browser/android/chrome_feature_list.cc
@@ -224,7 +224,7 @@ base::FEATURE_DISABLED_BY_DEFAULT}; const base::Feature kChromeSmartSelection{"ChromeSmartSelection", - base::FEATURE_DISABLED_BY_DEFAULT}; + base::FEATURE_ENABLED_BY_DEFAULT}; const base::Feature kContentSuggestionsScrollToLoad{ "ContentSuggestionsScrollToLoad", base::FEATURE_ENABLED_BY_DEFAULT};
diff --git a/chrome/browser/chromeos/accessibility/accessibility_manager_browsertest.cc b/chrome/browser/chromeos/accessibility/accessibility_manager_browsertest.cc index a7369eb..463135f 100644 --- a/chrome/browser/chromeos/accessibility/accessibility_manager_browsertest.cc +++ b/chrome/browser/chromeos/accessibility/accessibility_manager_browsertest.cc
@@ -51,13 +51,14 @@ namespace { -const char kTestUserName[] = "owner@invalid.domain"; +constexpr char kTestUserName[] = "owner@invalid.domain"; +constexpr char kTestUserGaiaId[] = "9876543210"; -const int kTestAutoclickDelayMs = 2000; +constexpr int kTestAutoclickDelayMs = 2000; // Test user name for supervised user. The domain part must be matched with // user_manager::kSupervisedUserDomain. -const char kTestSupervisedUserName[] = "test@locally-managed.localhost"; +constexpr char kTestSupervisedUserName[] = "test@locally-managed.localhost"; class MockAccessibilityObserver { public: @@ -303,7 +304,8 @@ MockBrailleController braille_controller_; - const AccountId test_account_id_ = AccountId::FromUserEmail(kTestUserName); + const AccountId test_account_id_ = + AccountId::FromUserEmailGaiaId(kTestUserName, kTestUserGaiaId); DISALLOW_COPY_AND_ASSIGN(AccessibilityManagerTest); }; @@ -640,7 +642,7 @@ class AccessibilityManagerUserTypeTest : public AccessibilityManagerTest, - public ::testing::WithParamInterface<const char*> { + public ::testing::WithParamInterface<AccountId> { protected: AccessibilityManagerUserTypeTest() {} virtual ~AccessibilityManagerUserTypeTest() {} @@ -652,9 +654,10 @@ INSTANTIATE_TEST_CASE_P( UserTypeInstantiation, AccessibilityManagerUserTypeTest, - ::testing::Values(kTestUserName, - user_manager::GuestAccountId().GetUserEmail().c_str(), - kTestSupervisedUserName)); + ::testing::Values(AccountId::FromUserEmailGaiaId(kTestUserName, + kTestUserGaiaId), + user_manager::GuestAccountId(), + AccountId::FromUserEmail(kTestSupervisedUserName))); IN_PROC_BROWSER_TEST_P(AccessibilityManagerUserTypeTest, EnableOnLoginScreenAndLogin) { @@ -678,7 +681,7 @@ EXPECT_TRUE(IsMonoAudioEnabled()); // Logs in. - const AccountId account_id = AccountId::FromUserEmail(GetParam()); + const AccountId account_id = GetParam(); auto* session_manager = session_manager::SessionManager::Get(); session_manager->CreateSession(account_id, account_id.GetUserEmail()); @@ -711,7 +714,7 @@ IN_PROC_BROWSER_TEST_P(AccessibilityManagerUserTypeTest, BrailleWhenLoggedIn) { // Logs in. - const AccountId account_id = AccountId::FromUserEmail(GetParam()); + const AccountId account_id = GetParam(); auto* session_manager = session_manager::SessionManager::Get(); session_manager->CreateSession(account_id, account_id.GetUserEmail()); StartUserSession(account_id);
diff --git a/chrome/browser/chromeos/accessibility/magnification_manager_browsertest.cc b/chrome/browser/chromeos/accessibility/magnification_manager_browsertest.cc index db13911..b42bbfa 100644 --- a/chrome/browser/chromeos/accessibility/magnification_manager_browsertest.cc +++ b/chrome/browser/chromeos/accessibility/magnification_manager_browsertest.cc
@@ -32,7 +32,8 @@ namespace { -const char kTestUserName[] = "owner@invalid.domain"; +constexpr char kTestUserName[] = "owner@invalid.domain"; +constexpr char kTestUserGaiaId[] = "9876543210"; void SetMagnifierEnabled(bool enabled) { MagnificationManager::Get()->SetMagnifierEnabled(enabled); @@ -158,7 +159,8 @@ ProfileManager::GetActiveUserProfile()); } - const AccountId test_account_id_ = AccountId::FromUserEmail(kTestUserName); + const AccountId test_account_id_ = + AccountId::FromUserEmailGaiaId(kTestUserName, kTestUserGaiaId); DISALLOW_COPY_AND_ASSIGN(MagnificationManagerTest); };
diff --git a/chrome/browser/chromeos/extensions/quick_unlock_private/quick_unlock_private_api_unittest.cc b/chrome/browser/chromeos/extensions/quick_unlock_private/quick_unlock_private_api_unittest.cc index 82fce006..75ded6b 100644 --- a/chrome/browser/chromeos/extensions/quick_unlock_private/quick_unlock_private_api_unittest.cc +++ b/chrome/browser/chromeos/extensions/quick_unlock_private/quick_unlock_private_api_unittest.cc
@@ -34,10 +34,11 @@ namespace chromeos { namespace { -const char* kTestUserEmail = "testuser@gmail.com"; -const char* kTestUserEmailHash = "testuser@gmail.com-hash"; -const char* kValidPassword = "valid"; -const char* kInvalidPassword = "invalid"; +constexpr char kTestUserEmail[] = "testuser@gmail.com"; +constexpr char kTestUserGaiaId[] = "9876543210"; +constexpr char kTestUserEmailHash[] = "testuser@gmail.com-hash"; +constexpr char kValidPassword[] = "valid"; +constexpr char kInvalidPassword[] = "invalid"; class FakeEasyUnlockService : public EasyUnlockServiceRegular { public: @@ -70,7 +71,8 @@ ExtendedAuthenticator* CreateFakeAuthenticator( AuthStatusConsumer* auth_status_consumer) { - AccountId account_id = AccountId::FromUserEmail(kTestUserEmail); + const AccountId account_id = + AccountId::FromUserEmailGaiaId(kTestUserEmail, kTestUserGaiaId); UserContext expected_context(account_id); expected_context.SetKey(Key(kValidPassword)); @@ -109,7 +111,8 @@ quick_unlock::EnableForTesting(quick_unlock::PinStorageType::kPrefs); // Setup a primary user. - auto test_account = AccountId::FromUserEmail(kTestUserEmail); + auto test_account = + AccountId::FromUserEmailGaiaId(kTestUserEmail, kTestUserGaiaId); fake_user_manager_->AddUser(test_account); fake_user_manager_->UserLoggedIn(test_account, kTestUserEmailHash, false);
diff --git a/chrome/browser/chromeos/file_manager/external_filesystem_apitest.cc b/chrome/browser/chromeos/file_manager/external_filesystem_apitest.cc index 941db1b..61bd09f6 100644 --- a/chrome/browser/chromeos/file_manager/external_filesystem_apitest.cc +++ b/chrome/browser/chromeos/file_manager/external_filesystem_apitest.cc
@@ -68,16 +68,17 @@ // NOTE: Root dir for drive file system is set by Chrome's drive implementation, // but the test will have to make sure the mount point is added before // starting a test extension using WaitUntilDriveMountPointIsAdded(). -const char kLocalMountPointName[] = "local"; -const char kRestrictedMountPointName[] = "restricted"; +constexpr char kLocalMountPointName[] = "local"; +constexpr char kRestrictedMountPointName[] = "restricted"; // Default file content for the test files. -const char kTestFileContent[] = "This is some test content."; +constexpr char kTestFileContent[] = "This is some test content."; // User account email and directory hash for secondary account for multi-profile // sensitive test cases. -const char kSecondProfileAccount[] = "profile2@test.com"; -const char kSecondProfileHash[] = "fileBrowserApiTestProfile2"; +constexpr char kSecondProfileAccount[] = "profile2@test.com"; +constexpr char kSecondProfileGiaId[] = "9876543210"; +constexpr char kSecondProfileHash[] = "fileBrowserApiTestProfile2"; class FakeSelectFileDialog : public ui::SelectFileDialog { public: @@ -503,7 +504,9 @@ base::FilePath user_data_directory; PathService::Get(chrome::DIR_USER_DATA, &user_data_directory); session_manager::SessionManager::Get()->CreateSession( - AccountId::FromUserEmail(kSecondProfileAccount), kSecondProfileHash); + AccountId::FromUserEmailGaiaId(kSecondProfileAccount, + kSecondProfileGiaId), + kSecondProfileHash); // Set up the secondary profile. base::FilePath profile_dir = user_data_directory.Append(
diff --git a/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc b/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc index d1ef79a..0e60ec2 100644 --- a/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc +++ b/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc
@@ -627,7 +627,8 @@ // Adds a new user for testing to the current session. void AddUser(const TestAccountInfo& info, bool log_in) { base::ScopedAllowBlockingForTesting allow_blocking; - const AccountId account_id(AccountId::FromUserEmail(info.email)); + const AccountId account_id( + AccountId::FromUserEmailGaiaId(info.email, info.gaia_id)); if (log_in) { session_manager::SessionManager::Get()->CreateSession(account_id, info.hash);
diff --git a/chrome/browser/chromeos/login/login_browsertest.cc b/chrome/browser/chromeos/login/login_browsertest.cc index 088c591..830ac748 100644 --- a/chrome/browser/chromeos/login/login_browsertest.cc +++ b/chrome/browser/chromeos/login/login_browsertest.cc
@@ -266,7 +266,7 @@ } IN_PROC_BROWSER_TEST_F(LoginTest, PRE_GaiaAuthOffline) { - RegisterUser(kTestUser); + RegisterUser(AccountId::FromUserEmailGaiaId(kTestUser, kGaiaId)); StartupUtils::MarkOobeCompleted(); CrosSettings::Get()->SetBoolean(kAccountsPrefShowUserNamesOnSignIn, false); }
diff --git a/chrome/browser/chromeos/login/login_manager_test.cc b/chrome/browser/chromeos/login/login_manager_test.cc index aa162a96..330e36b8 100644 --- a/chrome/browser/chromeos/login/login_manager_test.cc +++ b/chrome/browser/chromeos/login/login_manager_test.cc
@@ -25,6 +25,8 @@ #include "chromeos/login/auth/key.h" #include "chromeos/login/auth/user_context.h" #include "components/prefs/scoped_user_pref_update.h" +#include "components/signin/core/account_id/account_id.h" +#include "components/user_manager/known_user.h" #include "components/user_manager/user.h" #include "components/user_manager/user_manager.h" #include "content/public/browser/notification_service.h" @@ -43,19 +45,18 @@ namespace { -const char kGAIAHost[] = "accounts.google.com"; -const char kTestUserinfoToken1[] = "fake-userinfo-token-1"; -const char kTestRefreshToken1[] = "fake-refresh-token-1"; -const char kTestUserinfoToken2[] = "fake-userinfo-token-2"; -const char kTestRefreshToken2[] = "fake-refresh-token-2"; +constexpr char kGAIAHost[] = "accounts.google.com"; +constexpr char kTestUserinfoToken1[] = "fake-userinfo-token-1"; +constexpr char kTestRefreshToken1[] = "fake-refresh-token-1"; +constexpr char kTestUserinfoToken2[] = "fake-userinfo-token-2"; +constexpr char kTestRefreshToken2[] = "fake-refresh-token-2"; -UserContext CreateUserContext(const std::string& user_id) { - UserContext user_context(AccountId::FromUserEmailGaiaId( - user_id, LoginManagerTest::GetGaiaIDForUserID(user_id))); +UserContext CreateUserContext(const AccountId& account_id) { + UserContext user_context(account_id); user_context.SetKey(Key("password")); - if (user_id == LoginManagerTest::kEnterpriseUser1) { + if (account_id.GetUserEmail() == LoginManagerTest::kEnterpriseUser1) { user_context.SetRefreshToken(kTestRefreshToken1); - } else if (user_id == LoginManagerTest::kEnterpriseUser2) { + } else if (account_id.GetUserEmail() == LoginManagerTest::kEnterpriseUser2) { user_context.SetRefreshToken(kTestRefreshToken2); } return user_context; @@ -63,8 +64,10 @@ } // namespace -const char LoginManagerTest::kEnterpriseUser1[] = "user-1@example.com"; -const char LoginManagerTest::kEnterpriseUser2[] = "user-2@example.com"; +constexpr char LoginManagerTest::kEnterpriseUser1[] = "user-1@example.com"; +constexpr char LoginManagerTest::kEnterpriseUser1GaiaId[] = "0000111111"; +constexpr char LoginManagerTest::kEnterpriseUser2[] = "user-2@example.com"; +constexpr char LoginManagerTest::kEnterpriseUser2GaiaId[] = "0000222222"; LoginManagerTest::LoginManagerTest(bool should_launch_browser) : should_launch_browser_(should_launch_browser), web_contents_(NULL) { @@ -151,9 +154,12 @@ MixinBasedBrowserTest::SetUpOnMainThread(); } -void LoginManagerTest::RegisterUser(const std::string& user_id) { +void LoginManagerTest::RegisterUser(const AccountId& account_id) { ListPrefUpdate users_pref(g_browser_process->local_state(), "LoggedInUsers"); - users_pref->AppendIfNotPresent(base::MakeUnique<base::Value>(user_id)); + users_pref->AppendIfNotPresent( + std::make_unique<base::Value>(account_id.GetUserEmail())); + if (user_manager::UserManager::IsInitialized()) + user_manager::known_user::SetProfileEverInitialized(account_id, false); } void LoginManagerTest::SetExpectedCredentials(const UserContext& user_context) { @@ -193,20 +199,24 @@ return false; } -void LoginManagerTest::LoginUser(const std::string& user_id) { - const UserContext user_context = CreateUserContext(user_id); +void LoginManagerTest::LoginUser(const AccountId& account_id) { + const UserContext user_context = CreateUserContext(account_id); SetExpectedCredentials(user_context); EXPECT_TRUE(TryToLogin(user_context)); } -void LoginManagerTest::AddUser(const std::string& user_id) { - const UserContext user_context = CreateUserContext(user_id); +void LoginManagerTest::AddUser(const AccountId& account_id) { + const UserContext user_context = CreateUserContext(account_id); SetExpectedCredentials(user_context); EXPECT_TRUE(AddUserToSession(user_context)); } // static std::string LoginManagerTest::GetGaiaIDForUserID(const std::string& user_id) { + if (user_id == LoginManagerTest::kEnterpriseUser1) + return LoginManagerTest::kEnterpriseUser1GaiaId; + if (user_id == LoginManagerTest::kEnterpriseUser2) + return LoginManagerTest::kEnterpriseUser2GaiaId; return "gaia-id-" + user_id; }
diff --git a/chrome/browser/chromeos/login/login_manager_test.h b/chrome/browser/chromeos/login/login_manager_test.h index 027e3c0..7476b2159 100644 --- a/chrome/browser/chromeos/login/login_manager_test.h +++ b/chrome/browser/chromeos/login/login_manager_test.h
@@ -13,6 +13,8 @@ #include "chrome/browser/chromeos/login/test/js_checker.h" #include "google_apis/gaia/fake_gaia.h" +class AccountId; + namespace content { class WebContents; } // namespace content @@ -41,7 +43,7 @@ // Registers the user with the given |user_id| on the device. // This method should be called in PRE_* test. // TODO(dzhioev): Add the ability to register users without a PRE_* test. - void RegisterUser(const std::string& user_id); + void RegisterUser(const AccountId& account_id); // Set expected credentials for next login attempt. void SetExpectedCredentials(const UserContext& user_context); @@ -57,10 +59,10 @@ bool AddUserToSession(const UserContext& user_context); // Log in user with |user_id|. User should be registered using RegisterUser(). - void LoginUser(const std::string& user_id); + void LoginUser(const AccountId& account_id); // Add user with |user_id| to session. - void AddUser(const std::string& user_id); + void AddUser(const AccountId& user_id); // Executes given JS |expression| in |web_contents_| and checks // that it is true. @@ -81,7 +83,9 @@ // For your convenience, the e-mail addresses for users that have been set up // in this way are provided below. static const char kEnterpriseUser1[]; + static const char kEnterpriseUser1GaiaId[]; static const char kEnterpriseUser2[]; + static const char kEnterpriseUser2GaiaId[]; protected: FakeGaia fake_gaia_;
diff --git a/chrome/browser/chromeos/login/login_ui_browsertest.cc b/chrome/browser/chromeos/login/login_ui_browsertest.cc index b1090a0..c16ac29d 100644 --- a/chrome/browser/chromeos/login/login_ui_browsertest.cc +++ b/chrome/browser/chromeos/login/login_ui_browsertest.cc
@@ -25,14 +25,22 @@ namespace { -const char kTestUser1[] = "test-user1@gmail.com"; -const char kTestUser2[] = "test-user2@gmail.com"; +struct { + const char* email; + const char* gaia_id; +} const kTestUsers[] = {{"test-user1@gmail.com", "1111111111"}, + {"test-user2@gmail.com", "2222222222"}}; } // namespace class LoginUITest : public chromeos::LoginManagerTest { public: LoginUITest() : LoginManagerTest(false) { + for (size_t i = 0; i < arraysize(kTestUsers); ++i) { + test_users_.emplace_back(AccountId::FromUserEmailGaiaId( + kTestUsers[i].email, kTestUsers[i].gaia_id)); + } + screenshot_testing_ = new ScreenshotTestingMixin; screenshot_testing_->IgnoreArea(areas::kClockArea); screenshot_testing_->IgnoreArea(areas::kFirstUserpod); @@ -42,12 +50,14 @@ ~LoginUITest() override {} protected: + std::vector<AccountId> test_users_; + ScreenshotTestingMixin* screenshot_testing_; }; IN_PROC_BROWSER_TEST_F(LoginUITest, PRE_LoginUIVisible) { - RegisterUser(kTestUser1); - RegisterUser(kTestUser2); + RegisterUser(test_users_[0]); + RegisterUser(test_users_[1]); StartupUtils::MarkOobeCompleted(); } @@ -58,10 +68,14 @@ JSExpect( "document.querySelectorAll('.pod:not(#user-pod-template)').length == 2"); - JSExpect("document.querySelectorAll('.pod:not(#user-pod-template)')[0]" - ".user.emailAddress == '" + std::string(kTestUser1) + "'"); - JSExpect("document.querySelectorAll('.pod:not(#user-pod-template)')[1]" - ".user.emailAddress == '" + std::string(kTestUser2) + "'"); + JSExpect( + "document.querySelectorAll('.pod:not(#user-pod-template)')[0]" + ".user.emailAddress == '" + + test_users_[0].GetUserEmail() + "'"); + JSExpect( + "document.querySelectorAll('.pod:not(#user-pod-template)')[1]" + ".user.emailAddress == '" + + test_users_[1].GetUserEmail() + "'"); screenshot_testing_->RunScreenshotTesting("LoginUITest-LoginUIVisible"); } @@ -83,8 +97,8 @@ } IN_PROC_BROWSER_TEST_F(LoginUITest, PRE_LoginNoExceptions) { - RegisterUser(kTestUser1); - RegisterUser(kTestUser2); + RegisterUser(test_users_[0]); + RegisterUser(test_users_[1]); StartupUtils::MarkOobeCompleted(); }
diff --git a/chrome/browser/chromeos/login/login_ui_keyboard_browsertest.cc b/chrome/browser/chromeos/login/login_ui_keyboard_browsertest.cc index 046c73a..ef826887 100644 --- a/chrome/browser/chromeos/login/login_ui_keyboard_browsertest.cc +++ b/chrome/browser/chromeos/login/login_ui_keyboard_browsertest.cc
@@ -24,9 +24,12 @@ namespace { -const char kTestUser1[] = "test-user1@gmail.com"; -const char kTestUser2[] = "test-user2@gmail.com"; -const char kTestUser3[] = "test-user3@gmail.com"; +constexpr char kTestUser1[] = "test-user1@gmail.com"; +constexpr char kTestUser1GaiaId[] = "1111111111"; +constexpr char kTestUser2[] = "test-user2@gmail.com"; +constexpr char kTestUser2GaiaId[] = "2222222222"; +constexpr char kTestUser3[] = "test-user3@gmail.com"; +constexpr char kTestUser3GaiaId[] = "3333333333"; void Append_en_US_InputMethods(std::vector<std::string>* out) { out->push_back("xkb:us::eng"); @@ -117,8 +120,8 @@ }; IN_PROC_BROWSER_TEST_F(LoginUIKeyboardTest, PRE_CheckPODScreenDefault) { - RegisterUser(kTestUser1); - RegisterUser(kTestUser2); + RegisterUser(AccountId::FromUserEmailGaiaId(kTestUser1, kTestUser1GaiaId)); + RegisterUser(AccountId::FromUserEmailGaiaId(kTestUser2, kTestUser2GaiaId)); StartupUtils::MarkOobeCompleted(); } @@ -137,8 +140,8 @@ } IN_PROC_BROWSER_TEST_F(LoginUIKeyboardTest, PRE_CheckPODScreenWithUsers) { - RegisterUser(kTestUser1); - RegisterUser(kTestUser2); + RegisterUser(AccountId::FromUserEmailGaiaId(kTestUser1, kTestUser1GaiaId)); + RegisterUser(AccountId::FromUserEmailGaiaId(kTestUser2, kTestUser2GaiaId)); InitUserLastInputMethod(); @@ -234,9 +237,9 @@ IN_PROC_BROWSER_TEST_F(LoginUIKeyboardTestWithUsersAndOwner, PRE_CheckPODScreenKeyboard) { - RegisterUser(kTestUser1); - RegisterUser(kTestUser2); - RegisterUser(kTestUser3); + RegisterUser(AccountId::FromUserEmailGaiaId(kTestUser1, kTestUser1GaiaId)); + RegisterUser(AccountId::FromUserEmailGaiaId(kTestUser2, kTestUser2GaiaId)); + RegisterUser(AccountId::FromUserEmailGaiaId(kTestUser3, kTestUser3GaiaId)); InitUserLastInputMethod();
diff --git a/chrome/browser/chromeos/login/proxy_auth_dialog_browsertest.cc b/chrome/browser/chromeos/login/proxy_auth_dialog_browsertest.cc index 4b70539..3c0fa46 100644 --- a/chrome/browser/chromeos/login/proxy_auth_dialog_browsertest.cc +++ b/chrome/browser/chromeos/login/proxy_auth_dialog_browsertest.cc
@@ -86,7 +86,8 @@ IN_PROC_BROWSER_TEST_F(ProxyAuthOnUserBoardScreenTest, PRE_ProxyAuthDialogOnUserBoardScreen) { - RegisterUser("test-user@gmail.com"); + RegisterUser( + AccountId::FromUserEmailGaiaId("test-user@gmail.com", "1234567890")); StartupUtils::MarkOobeCompleted(); }
diff --git a/chrome/browser/chromeos/login/reset_browsertest.cc b/chrome/browser/chromeos/login/reset_browsertest.cc index 33a1541..307fa76 100644 --- a/chrome/browser/chromeos/login/reset_browsertest.cc +++ b/chrome/browser/chromeos/login/reset_browsertest.cc
@@ -26,7 +26,8 @@ namespace { -const char kTestUser1[] = "test-user1@gmail.com"; +constexpr char kTestUser1[] = "test-user1@gmail.com"; +constexpr char kTestUser1GaiaId[] = "test-user1@gmail.com"; } // namespace @@ -61,7 +62,7 @@ } void RegisterSomeUser() { - RegisterUser(kTestUser1); + RegisterUser(AccountId::FromUserEmailGaiaId(kTestUser1, kTestUser1GaiaId)); StartupUtils::MarkOobeCompleted(); }
diff --git a/chrome/browser/chromeos/login/screens/user_selection_screen_browsertest.cc b/chrome/browser/chromeos/login/screens/user_selection_screen_browsertest.cc index 685f0b6..765d49b 100644 --- a/chrome/browser/chromeos/login/screens/user_selection_screen_browsertest.cc +++ b/chrome/browser/chromeos/login/screens/user_selection_screen_browsertest.cc
@@ -25,11 +25,16 @@ // Consumer user according to BrowserPolicyConnector::IsNonEnterpriseUser // (@gmail.com). constexpr char kTestUser1[] = "test-user1@gmail.com"; +constexpr char kTestUser1GaiaId[] = "1111111111"; + // Consumer user according to BrowserPolicyConnector::IsNonEnterpriseUser // (@gmail.com). constexpr char kTestUser2[] = "test-user2@gmail.com"; +constexpr char kTestUser2GaiaId[] = "2222222222"; + // No consumer user according to BrowserPolicyConnector::IsNonEnterpriseUser. constexpr char kManagedTestUser[] = "manager@example.com"; +constexpr char kManagedTestUserGaiaId[] = "3333333333"; } // namespace @@ -73,9 +78,10 @@ IN_PROC_BROWSER_TEST_F(UserSelectionScreenTest, PRE_ShowDircryptoMigrationBanner) { - RegisterUser(kTestUser1); - RegisterUser(kTestUser2); - RegisterUser(kManagedTestUser); + RegisterUser(AccountId::FromUserEmailGaiaId(kTestUser1, kTestUser1GaiaId)); + RegisterUser(AccountId::FromUserEmailGaiaId(kTestUser2, kTestUser2GaiaId)); + RegisterUser( + AccountId::FromUserEmailGaiaId(kManagedTestUser, kManagedTestUserGaiaId)); StartupUtils::MarkOobeCompleted(); }
diff --git a/chrome/browser/chromeos/login/session/chrome_session_manager_browsertest.cc b/chrome/browser/chromeos/login/session/chrome_session_manager_browsertest.cc index 11f060ec..cc46db0 100644 --- a/chrome/browser/chromeos/login/session/chrome_session_manager_browsertest.cc +++ b/chrome/browser/chromeos/login/session/chrome_session_manager_browsertest.cc
@@ -28,9 +28,12 @@ namespace { -const char* const kTestUsers[] = {"test-user1@consumer.example.com", - "test-user2@consumer.example.com", - "test-user3@consumer.example.com"}; +struct { + const char* email; + const char* gaia_id; +} const kTestUsers[] = {{"test-user1@consumer.example.com", "1111111111"}, + {"test-user2@consumer.example.com", "2222222222"}, + {"test-user3@consumer.example.com", "3333333333"}}; // Helper class to wait for user adding screen to finish. class UserAddingScreenWaiter : public UserAddingScreen::Observer { @@ -93,7 +96,8 @@ EXPECT_EQ(0u, manager->sessions().size()); // Login via fake gaia to add a new user. - fake_gaia_.SetFakeMergeSessionParams(kTestUsers[0], "fake_sid", "fake_lsid"); + fake_gaia_.SetFakeMergeSessionParams(kTestUsers[0].email, "fake_sid", + "fake_lsid"); StartSignInScreen(); content::WindowedNotificationObserver session_start_waiter( @@ -102,7 +106,7 @@ WebUILoginDisplay* login_display = static_cast<WebUILoginDisplay*>( ExistingUserController::current_controller()->login_display()); - login_display->ShowSigninScreenForCreds(kTestUsers[0], "fake_password"); + login_display->ShowSigninScreenForCreds(kTestUsers[0].email, "fake_password"); session_start_waiter.Wait(); @@ -112,8 +116,8 @@ } IN_PROC_BROWSER_TEST_F(ChromeSessionManagerTest, PRE_LoginExistingUsers) { - for (auto* user : kTestUsers) { - RegisterUser(user); + for (const auto& user : kTestUsers) { + RegisterUser(AccountId::FromUserEmailGaiaId(user.email, user.gaia_id)); } StartupUtils::MarkOobeCompleted(); } @@ -126,9 +130,12 @@ manager->session_state()); EXPECT_EQ(0u, manager->sessions().size()); + std::vector<AccountId> test_users; + test_users.push_back(AccountId::FromUserEmailGaiaId(kTestUsers[0].email, + kTestUsers[0].gaia_id)); // Verify that session state is ACTIVE with one user session after signing // in a user. - LoginUser(kTestUsers[0]); + LoginUser(test_users[0]); EXPECT_EQ(session_manager::SessionState::ACTIVE, manager->session_state()); EXPECT_EQ(1u, manager->sessions().size()); @@ -142,7 +149,9 @@ // Verify that session state is ACTIVE with 1+i user sessions after user // is added and new user session is started.. UserAddingScreenWaiter waiter; - AddUser(kTestUsers[i]); + test_users.push_back(AccountId::FromUserEmailGaiaId(kTestUsers[i].email, + kTestUsers[i].gaia_id)); + AddUser(test_users.back()); waiter.Wait(); base::RunLoop().RunUntilIdle(); @@ -151,10 +160,9 @@ } // Verify that session manager has the correct user session info. - ASSERT_EQ(arraysize(kTestUsers), manager->sessions().size()); - for (size_t i = 0; i < arraysize(kTestUsers); ++i) { - EXPECT_EQ(kTestUsers[i], - manager->sessions()[i].user_account_id.GetUserEmail()); + ASSERT_EQ(test_users.size(), manager->sessions().size()); + for (size_t i = 0; i < test_users.size(); ++i) { + EXPECT_EQ(test_users[i], manager->sessions()[i].user_account_id); } }
diff --git a/chrome/browser/chromeos/login/session_login_browsertest.cc b/chrome/browser/chromeos/login/session_login_browsertest.cc index 6f75f5b7..141be7f 100644 --- a/chrome/browser/chromeos/login/session_login_browsertest.cc +++ b/chrome/browser/chromeos/login/session_login_browsertest.cc
@@ -21,7 +21,8 @@ namespace { -const char kTestUser[] = "test-user@gmail.com"; +constexpr char kTestUser[] = "test-user@gmail.com"; +constexpr char kTestUserGaiaId[] = "1234567890"; } // namespace @@ -37,7 +38,7 @@ }; IN_PROC_BROWSER_TEST_F(BrowserLoginTest, PRE_BrowserActive) { - RegisterUser(kTestUser); + RegisterUser(AccountId::FromUserEmailGaiaId(kTestUser, kTestUserGaiaId)); EXPECT_EQ(session_manager::SessionState::OOBE, session_manager::SessionManager::Get()->session_state()); chromeos::StartupUtils::MarkOobeCompleted(); @@ -46,7 +47,7 @@ IN_PROC_BROWSER_TEST_F(BrowserLoginTest, BrowserActive) { EXPECT_EQ(session_manager::SessionState::LOGIN_PRIMARY, session_manager::SessionManager::Get()->session_state()); - LoginUser(kTestUser); + LoginUser(AccountId::FromUserEmailGaiaId(kTestUser, kTestUserGaiaId)); EXPECT_EQ(session_manager::SessionState::ACTIVE, session_manager::SessionManager::Get()->session_state());
diff --git a/chrome/browser/chromeos/login/supervised/supervised_user_test_base.cc b/chrome/browser/chromeos/login/supervised/supervised_user_test_base.cc index f81559d2..50bd0c6 100644 --- a/chrome/browser/chromeos/login/supervised/supervised_user_test_base.cc +++ b/chrome/browser/chromeos/login/supervised/supervised_user_test_base.cc
@@ -305,8 +305,10 @@ } void SupervisedUserTestBase::PrepareUsers() { - RegisterUser(kTestManager); - RegisterUser(kTestOtherUser); + RegisterUser( + AccountId::FromUserEmailGaiaId(kTestManager, kTestManagerGaiaId)); + RegisterUser( + AccountId::FromUserEmailGaiaId(kTestOtherUser, kTestOtherUserGaiaId)); chromeos::StartupUtils::MarkOobeCompleted(); } @@ -351,8 +353,8 @@ // Next button is now enabled. JSExpect("!$('supervised-user-creation-next-button').disabled"); - UserContext user_context(AccountId::FromUserEmailGaiaId( - kTestManager, GetGaiaIDForUserID(kTestManager))); + UserContext user_context( + AccountId::FromUserEmailGaiaId(kTestManager, kTestManagerGaiaId)); user_context.SetKey(Key(kTestManagerPassword)); SetExpectedCredentials(user_context); @@ -435,7 +437,7 @@ ChromeUserManager::Get()->GetSupervisedUserManager()) ->CheckForFirstRun(user->GetAccountId().GetUserEmail()); - LoginUser(user->GetAccountId().GetUserEmail()); + LoginUser(user->GetAccountId()); if (check_homedir_calls) ::testing::Mock::VerifyAndClearExpectations(mock_homedir_methods_); Profile* profile = ProfileHelper::Get()->GetProfileByUserUnsafe(user); @@ -453,7 +455,7 @@ // Created supervised user have to be first in a list. const user_manager::User* user = user_manager::UserManager::Get()->GetUsers().at(user_index); - LoginUser(user->GetAccountId().GetUserEmail()); + LoginUser(user->GetAccountId()); Profile* profile = ProfileHelper::Get()->GetProfileByUserUnsafe(user); shared_settings_adapter_.reset( new SupervisedUsersSharedSettingsSyncTestAdapter(profile));
diff --git a/chrome/browser/chromeos/login/supervised/supervised_user_test_base.h b/chrome/browser/chromeos/login/supervised/supervised_user_test_base.h index 581818c..9c7bec9 100644 --- a/chrome/browser/chromeos/login/supervised/supervised_user_test_base.h +++ b/chrome/browser/chromeos/login/supervised/supervised_user_test_base.h
@@ -23,12 +23,14 @@ namespace chromeos { -const char kTestManager[] = "test-manager@gmail.com"; -const char kTestOtherUser[] = "test-user@gmail.com"; +constexpr char kTestManager[] = "test-manager@gmail.com"; +constexpr char kTestManagerGaiaId[] = "0001110001"; +constexpr char kTestOtherUser[] = "test-user@gmail.com"; +constexpr char kTestOtherUserGaiaId[] = "0002220001"; -const char kTestManagerPassword[] = "password"; -const char kTestSupervisedUserDisplayName[] = "John Doe"; -const char kTestSupervisedUserPassword[] = "simplepassword"; +constexpr char kTestManagerPassword[] = "password"; +constexpr char kTestSupervisedUserDisplayName[] = "John Doe"; +constexpr char kTestSupervisedUserPassword[] = "simplepassword"; class SupervisedUsersSyncTestAdapter { public:
diff --git a/chrome/browser/chromeos/login/ui/user_adding_screen_browsertest.cc b/chrome/browser/chromeos/login/ui/user_adding_screen_browsertest.cc index da8d11b..d5287ea7 100644 --- a/chrome/browser/chromeos/login/ui/user_adding_screen_browsertest.cc +++ b/chrome/browser/chromeos/login/ui/user_adding_screen_browsertest.cc
@@ -26,19 +26,23 @@ using namespace testing; -namespace { - -const char* const kTestUsers[] = { - "test-user1@gmail.com", "test-user2@gmail.com", "test-user3@gmail.com"}; - -} // anonymous namespace - namespace chromeos { class UserAddingScreenTest : public LoginManagerTest, public UserAddingScreen::Observer { public: - UserAddingScreenTest() : LoginManagerTest(false) {} + UserAddingScreenTest() : LoginManagerTest(false) { + struct { + const char* email; + const char* gaia_id; + } const kTestUsers[] = {{"test-user1@gmail.com", "1111111111"}, + {"test-user2@gmail.com", "2222222222"}, + {"test-user3@gmail.com", "3333333333"}}; + for (size_t i = 0; i < arraysize(kTestUsers); ++i) { + test_users_.emplace_back(AccountId::FromUserEmailGaiaId( + kTestUsers[i].email, kTestUsers[i].gaia_id)); + } + } void SetUpInProcessBrowserTestFixture() override { LoginManagerTest::SetUpInProcessBrowserTestFixture(); @@ -88,6 +92,8 @@ int user_adding_finished() { return user_adding_finished_; } + std::vector<AccountId> test_users_; + private: int user_adding_started_ = 0; int user_adding_finished_ = 0; @@ -99,9 +105,9 @@ }; IN_PROC_BROWSER_TEST_F(UserAddingScreenTest, PRE_CancelAdding) { - RegisterUser(kTestUsers[0]); - RegisterUser(kTestUsers[1]); - RegisterUser(kTestUsers[2]); + RegisterUser(test_users_[0]); + RegisterUser(test_users_[1]); + RegisterUser(test_users_[2]); StartupUtils::MarkOobeCompleted(); } @@ -111,7 +117,7 @@ EXPECT_EQ(session_manager::SessionState::LOGIN_PRIMARY, session_manager::SessionManager::Get()->session_state()); - LoginUser(kTestUsers[0]); + LoginUser(test_users_[0]); EXPECT_EQ(1u, user_manager::UserManager::Get()->GetLoggedInUsers().size()); EXPECT_EQ(session_manager::SessionState::ACTIVE, session_manager::SessionManager::Get()->session_state()); @@ -131,23 +137,22 @@ EXPECT_TRUE(LoginDisplayHost::default_host() == nullptr); EXPECT_EQ(1u, user_manager::UserManager::Get()->GetLoggedInUsers().size()); - EXPECT_EQ(kTestUsers[0], user_manager::UserManager::Get() - ->GetActiveUser() - ->GetAccountId() - .GetUserEmail()); + EXPECT_EQ(test_users_[0], + user_manager::UserManager::Get()->GetActiveUser()->GetAccountId()); } IN_PROC_BROWSER_TEST_F(UserAddingScreenTest, PRE_AddingSeveralUsers) { - RegisterUser(kTestUsers[0]); - RegisterUser(kTestUsers[1]); - RegisterUser(kTestUsers[2]); + RegisterUser(test_users_[0]); + RegisterUser(test_users_[1]); + RegisterUser(test_users_[2]); StartupUtils::MarkOobeCompleted(); } IN_PROC_BROWSER_TEST_F(UserAddingScreenTest, AddingSeveralUsers) { EXPECT_EQ(session_manager::SessionState::LOGIN_PRIMARY, session_manager::SessionManager::Get()->session_state()); - LoginUser(kTestUsers[0]); + + LoginUser(test_users_[0]); EXPECT_EQ(session_manager::SessionState::ACTIVE, session_manager::SessionManager::Get()->session_state()); @@ -159,7 +164,7 @@ EXPECT_EQ(i, user_adding_started()); EXPECT_EQ(session_manager::SessionState::LOGIN_SECONDARY, session_manager::SessionManager::Get()->session_state()); - AddUser(kTestUsers[i]); + AddUser(test_users_[i]); WaitUntilUserAddingFinishedOrCancelled(); content::RunAllPendingInMessageLoop(); EXPECT_EQ(i, user_adding_finished()); @@ -203,12 +208,12 @@ MultiProfileUserController::kBehaviorUnrestricted); user_manager::UserList unlock_users = user_manager->GetUnlockUsers(); ASSERT_EQ(1UL, unlock_users.size()); - EXPECT_EQ(kTestUsers[0], unlock_users[0]->GetAccountId().GetUserEmail()); + EXPECT_EQ(test_users_[0], unlock_users[0]->GetAccountId()); prefs1->SetBoolean(prefs::kEnableAutoScreenLock, false); unlock_users = user_manager->GetUnlockUsers(); ASSERT_EQ(1UL, unlock_users.size()); - EXPECT_EQ(kTestUsers[0], unlock_users[0]->GetAccountId().GetUserEmail()); + EXPECT_EQ(test_users_[0], unlock_users[0]->GetAccountId()); // If all users have unrestricted policy then anyone can perform unlock. prefs1->SetString(prefs::kMultiProfileUserBehavior, @@ -216,21 +221,21 @@ unlock_users = user_manager->GetUnlockUsers(); ASSERT_EQ(3UL, unlock_users.size()); for (int i = 0; i < 3; ++i) - EXPECT_EQ(kTestUsers[i], unlock_users[i]->GetAccountId().GetUserEmail()); + EXPECT_EQ(test_users_[i], unlock_users[i]->GetAccountId()); // This preference doesn't affect list of unlock users. prefs2->SetBoolean(prefs::kEnableAutoScreenLock, true); unlock_users = user_manager->GetUnlockUsers(); ASSERT_EQ(3UL, unlock_users.size()); for (int i = 0; i < 3; ++i) - EXPECT_EQ(kTestUsers[i], unlock_users[i]->GetAccountId().GetUserEmail()); + EXPECT_EQ(test_users_[i], unlock_users[i]->GetAccountId()); // Now one of the users is unable to unlock. SetUserCanLock(user_manager->GetLoggedInUsers()[2], false); unlock_users = user_manager->GetUnlockUsers(); ASSERT_EQ(2UL, unlock_users.size()); for (int i = 0; i < 2; ++i) - EXPECT_EQ(kTestUsers[i], unlock_users[i]->GetAccountId().GetUserEmail()); + EXPECT_EQ(test_users_[i], unlock_users[i]->GetAccountId()); SetUserCanLock(user_manager->GetLoggedInUsers()[2], true); // Now one of the users has not-allowed policy. @@ -242,18 +247,18 @@ unlock_users = user_manager->GetUnlockUsers(); ASSERT_EQ(2UL, unlock_users.size()); for (int i = 0; i < 2; ++i) - EXPECT_EQ(kTestUsers[i], unlock_users[i]->GetAccountId().GetUserEmail()); + EXPECT_EQ(test_users_[i], unlock_users[i]->GetAccountId()); } IN_PROC_BROWSER_TEST_F(UserAddingScreenTest, PRE_ScreenVisibility) { - RegisterUser(kTestUsers[0]); - RegisterUser(kTestUsers[1]); + RegisterUser(test_users_[0]); + RegisterUser(test_users_[1]); StartupUtils::MarkOobeCompleted(); } // Trying to catch http://crbug.com/362153. IN_PROC_BROWSER_TEST_F(UserAddingScreenTest, ScreenVisibility) { - LoginUser(kTestUsers[0]); + LoginUser(test_users_[0]); UserAddingScreen::Get()->Start(); content::RunAllPendingInMessageLoop();
diff --git a/chrome/browser/chromeos/login/users/avatar/user_image_manager_browsertest.cc b/chrome/browser/chromeos/login/users/avatar/user_image_manager_browsertest.cc index 6ce5dc5..41b32097 100644 --- a/chrome/browser/chromeos/login/users/avatar/user_image_manager_browsertest.cc +++ b/chrome/browser/chromeos/login/users/avatar/user_image_manager_browsertest.cc
@@ -86,8 +86,10 @@ // Because policy is not needed in some tests it is better to use e-mails that // are definitely not enterprise. This lets us to avoid faking of policy fetch // procedure. -const char kTestUser1[] = "test-user@gmail.com"; -const char kTestUser2[] = "test-user2@gmail.com"; +constexpr char kTestUser1[] = "test-user@gmail.com"; +constexpr char kTestUser1GaiaId[] = "1111111111"; +constexpr char kTestUser2[] = "test-user2@gmail.com"; +constexpr char kTestUser2GaiaId[] = "2222222222"; policy::CloudPolicyStore* GetStoreForUser(const user_manager::User* user) { Profile* profile = ProfileHelper::Get()->GetProfileByUserUnsafe(user); @@ -302,10 +304,12 @@ std::unique_ptr<base::RunLoop> run_loop_; - const AccountId test_account_id1_ = AccountId::FromUserEmail(kTestUser1); - const AccountId test_account_id2_ = AccountId::FromUserEmail(kTestUser2); + const AccountId test_account_id1_ = + AccountId::FromUserEmailGaiaId(kTestUser1, kTestUser1GaiaId); + const AccountId test_account_id2_ = + AccountId::FromUserEmailGaiaId(kTestUser2, kTestUser2GaiaId); const AccountId enterprise_account_id_ = - AccountId::FromUserEmail(kEnterpriseUser1); + AccountId::FromUserEmailGaiaId(kEnterpriseUser1, kEnterpriseUser1GaiaId); const cryptohome::Identification cryptohome_id_ = cryptohome::Identification(enterprise_account_id_); @@ -314,7 +318,7 @@ }; IN_PROC_BROWSER_TEST_F(UserImageManagerTest, PRE_SaveAndLoadUserImage) { - RegisterUser(test_account_id1_.GetUserEmail()); + RegisterUser(test_account_id1_); // Setup a user with JPEG image. run_loop_.reset(new base::RunLoop); @@ -346,7 +350,7 @@ } IN_PROC_BROWSER_TEST_F(UserImageManagerTest, PRE_SaveUserDefaultImageIndex) { - RegisterUser(test_account_id1_.GetUserEmail()); + RegisterUser(test_account_id1_); } // Verifies that SaveUserDefaultImageIndex() correctly sets and persists the @@ -373,7 +377,7 @@ } IN_PROC_BROWSER_TEST_F(UserImageManagerTest, PRE_SaveUserImage) { - RegisterUser(test_account_id1_.GetUserEmail()); + RegisterUser(test_account_id1_); } // Verifies that SaveUserImage() correctly sets and persists the chosen user @@ -414,7 +418,7 @@ } IN_PROC_BROWSER_TEST_F(UserImageManagerTest, PRE_SaveUserImageFromFile) { - RegisterUser(test_account_id1_.GetUserEmail()); + RegisterUser(test_account_id1_); } // Verifies that SaveUserImageFromFile() correctly sets and persists the chosen @@ -484,7 +488,7 @@ IN_PROC_BROWSER_TEST_F(UserImageManagerTest, PRE_SaveUserImageFromProfileImage) { - RegisterUser(test_account_id1_.GetUserEmail()); + RegisterUser(test_account_id1_); chromeos::StartupUtils::MarkOobeCompleted(); } @@ -496,7 +500,7 @@ ASSERT_TRUE(user); UserImageManagerImpl::IgnoreProfileDataDownloadDelayForTesting(); - LoginUser(test_account_id1_.GetUserEmail()); + LoginUser(test_account_id1_); Profile* profile = ProfileHelper::Get()->GetProfileByUserUnsafe(user); SeedAccountTrackerService(test_account_id1_, profile); @@ -530,7 +534,7 @@ IN_PROC_BROWSER_TEST_F(UserImageManagerTest, PRE_ProfileImageDownloadDoesNotClobber) { - RegisterUser(test_account_id1_.GetUserEmail()); + RegisterUser(test_account_id1_); chromeos::StartupUtils::MarkOobeCompleted(); } @@ -548,7 +552,7 @@ default_user_image::kFirstDefaultImageIndex); UserImageManagerImpl::IgnoreProfileDataDownloadDelayForTesting(); - LoginUser(test_account_id1_.GetUserEmail()); + LoginUser(test_account_id1_); Profile* profile = ProfileHelper::Get()->GetProfileByUserUnsafe(user); SeedAccountTrackerService(test_account_id1_, profile); @@ -667,7 +671,7 @@ }; IN_PROC_BROWSER_TEST_F(UserImageManagerPolicyTest, PRE_SetAndClear) { - RegisterUser(enterprise_account_id_.GetUserEmail()); + RegisterUser(enterprise_account_id_); chromeos::StartupUtils::MarkOobeCompleted(); } @@ -680,7 +684,7 @@ user_manager::UserManager::Get()->FindUser(enterprise_account_id_); ASSERT_TRUE(user); - LoginUser(enterprise_account_id_.GetUserEmail()); + LoginUser(enterprise_account_id_); base::RunLoop().RunUntilIdle(); policy::CloudPolicyStore* store = GetStoreForUser(user); @@ -758,7 +762,7 @@ } IN_PROC_BROWSER_TEST_F(UserImageManagerPolicyTest, PRE_PolicyOverridesUser) { - RegisterUser(enterprise_account_id_.GetUserEmail()); + RegisterUser(enterprise_account_id_); chromeos::StartupUtils::MarkOobeCompleted(); } @@ -770,7 +774,7 @@ user_manager::UserManager::Get()->FindUser(enterprise_account_id_); ASSERT_TRUE(user); - LoginUser(enterprise_account_id_.GetUserEmail()); + LoginUser(enterprise_account_id_); base::RunLoop().RunUntilIdle(); policy::CloudPolicyStore* store = GetStoreForUser(user); @@ -822,7 +826,7 @@ IN_PROC_BROWSER_TEST_F(UserImageManagerPolicyTest, PRE_UserDoesNotOverridePolicy) { - RegisterUser(enterprise_account_id_.GetUserEmail()); + RegisterUser(enterprise_account_id_); chromeos::StartupUtils::MarkOobeCompleted(); } @@ -834,7 +838,7 @@ user_manager::UserManager::Get()->FindUser(enterprise_account_id_); ASSERT_TRUE(user); - LoginUser(enterprise_account_id_.GetUserEmail()); + LoginUser(enterprise_account_id_); base::RunLoop().RunUntilIdle(); policy::CloudPolicyStore* store = GetStoreForUser(user);
diff --git a/chrome/browser/chromeos/login/users/user_manager_unittest.cc b/chrome/browser/chromeos/login/users/user_manager_unittest.cc index 2fe119a..bd2f1e3 100644 --- a/chrome/browser/chromeos/login/users/user_manager_unittest.cc +++ b/chrome/browser/chromeos/login/users/user_manager_unittest.cc
@@ -150,11 +150,11 @@ } const AccountId owner_account_id_at_invalid_domain_ = - AccountId::FromUserEmail("owner@invalid.domain"); + AccountId::FromUserEmailGaiaId("owner@invalid.domain", "1234567890"); const AccountId account_id0_at_invalid_domain_ = - AccountId::FromUserEmail("user0@invalid.domain"); + AccountId::FromUserEmailGaiaId("user0@invalid.domain", "0123456789"); const AccountId account_id1_at_invalid_domain_ = - AccountId::FromUserEmail("user1@invalid.domain"); + AccountId::FromUserEmailGaiaId("user1@invalid.domain", "9012345678"); protected: std::unique_ptr<WallpaperControllerClient> wallpaper_controller_client_; @@ -282,7 +282,8 @@ // Clear the stored user data - when UserManager loads again, it should // migrate existing users by setting session_initialized to true for them. - user_manager::known_user::RemovePrefsForTesting((*users)[0]->GetAccountId()); + user_manager::known_user::RemoveSetProfileEverInitializedPrefForTesting( + (*users)[0]->GetAccountId()); ResetUserManager(); users = &user_manager::UserManager::Get()->GetUsers(); ASSERT_EQ(1U, users->size());
diff --git a/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager_browsertest.cc b/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager_browsertest.cc index dabd2a8..caaa944f 100644 --- a/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager_browsertest.cc +++ b/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager_browsertest.cc
@@ -54,15 +54,17 @@ namespace { -int kLargeWallpaperWidth = 256; -int kLargeWallpaperHeight = chromeos::kLargeWallpaperMaxHeight; -int kSmallWallpaperWidth = 256; -int kSmallWallpaperHeight = chromeos::kSmallWallpaperMaxHeight; +constexpr int kLargeWallpaperWidth = 256; +const int kLargeWallpaperHeight = chromeos::kLargeWallpaperMaxHeight; +constexpr int kSmallWallpaperWidth = 256; +const int kSmallWallpaperHeight = chromeos::kSmallWallpaperMaxHeight; -const char kTestUser1[] = "test1@domain.com"; -const char kTestUser1Hash[] = "test1@domain.com-hash"; -const char kTestUser2[] = "test2@domain.com"; -const char kTestUser2Hash[] = "test2@domain.com-hash"; +constexpr char kTestUser1[] = "test1@domain.com"; +constexpr char kTestUser1GaiaId[] = "0000000001"; +constexpr char kTestUser1Hash[] = "test1@domain.com-hash"; +constexpr char kTestUser2[] = "test2@domain.com"; +constexpr char kTestUser2GaiaId[] = "0000000002"; +constexpr char kTestUser2Hash[] = "test2@domain.com-hash"; // Helper function to get wallpaper files id. wallpaper::WallpaperFilesId GetFilesId(const AccountId& account_id) { @@ -206,8 +208,10 @@ // wallpaper images. std::unique_ptr<base::ScopedTempDir> wallpaper_dir_; - const AccountId test_account_id1_ = AccountId::FromUserEmail(kTestUser1); - const AccountId test_account_id2_ = AccountId::FromUserEmail(kTestUser2); + const AccountId test_account_id1_ = + AccountId::FromUserEmailGaiaId(kTestUser1, kTestUser1GaiaId); + const AccountId test_account_id2_ = + AccountId::FromUserEmailGaiaId(kTestUser2, kTestUser2GaiaId); const wallpaper::WallpaperFilesId test_account1_wallpaper_files_id_ = wallpaper::WallpaperFilesId::FromString(kTestUser1Hash);
diff --git a/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager_policy_browsertest.cc b/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager_policy_browsertest.cc index e9790412..de49627 100644 --- a/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager_policy_browsertest.cc +++ b/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager_policy_browsertest.cc
@@ -150,10 +150,12 @@ wallpaper_change_count_(0), owner_key_util_(new ownership::MockOwnerKeyUtil()), fake_session_manager_client_(new FakeSessionManagerClient) { - testUsers_.push_back( - AccountId::FromUserEmail(LoginManagerTest::kEnterpriseUser1)); - testUsers_.push_back( - AccountId::FromUserEmail(LoginManagerTest::kEnterpriseUser2)); + testUsers_.push_back(AccountId::FromUserEmailGaiaId( + LoginManagerTest::kEnterpriseUser1, + LoginManagerTest::kEnterpriseUser1GaiaId)); + testUsers_.push_back(AccountId::FromUserEmailGaiaId( + LoginManagerTest::kEnterpriseUser2, + LoginManagerTest::kEnterpriseUser2GaiaId)); } std::unique_ptr<policy::UserPolicyBuilder> GetUserPolicyBuilder( @@ -329,8 +331,8 @@ }; IN_PROC_BROWSER_TEST_F(WallpaperManagerPolicyTest, PRE_SetResetClear) { - RegisterUser(testUsers_[0].GetUserEmail()); - RegisterUser(testUsers_[1].GetUserEmail()); + RegisterUser(testUsers_[0]); + RegisterUser(testUsers_[1]); StartupUtils::MarkOobeCompleted(); } @@ -341,7 +343,7 @@ IN_PROC_BROWSER_TEST_F(WallpaperManagerPolicyTest, SetResetClear) { SetSystemSalt(); wallpaper::WallpaperInfo info; - LoginUser(testUsers_[0].GetUserEmail()); + LoginUser(testUsers_[0]); base::RunLoop().RunUntilIdle(); // First user: Wait until default wallpaper has been loaded (happens @@ -382,14 +384,14 @@ IN_PROC_BROWSER_TEST_F(WallpaperManagerPolicyTest, DISABLED_PRE_PRE_PRE_WallpaperOnLoginScreen) { - RegisterUser(testUsers_[0].GetUserEmail()); - RegisterUser(testUsers_[1].GetUserEmail()); + RegisterUser(testUsers_[0]); + RegisterUser(testUsers_[1]); StartupUtils::MarkOobeCompleted(); } IN_PROC_BROWSER_TEST_F(WallpaperManagerPolicyTest, DISABLED_PRE_PRE_WallpaperOnLoginScreen) { - LoginUser(testUsers_[0].GetUserEmail()); + LoginUser(testUsers_[0]); // Wait until default wallpaper has been loaded. RunUntilWallpaperChangeCount(1); @@ -404,7 +406,7 @@ IN_PROC_BROWSER_TEST_F(WallpaperManagerPolicyTest, DISABLED_PRE_WallpaperOnLoginScreen) { - LoginUser(testUsers_[1].GetUserEmail()); + LoginUser(testUsers_[1]); // Wait until default wallpaper has been loaded. RunUntilWallpaperChangeCount(1); @@ -434,13 +436,13 @@ IN_PROC_BROWSER_TEST_F(WallpaperManagerPolicyTest, PRE_PRE_PersistOverLogout) { SetSystemSalt(); - RegisterUser(testUsers_[0].GetUserEmail()); + RegisterUser(testUsers_[0]); StartupUtils::MarkOobeCompleted(); } IN_PROC_BROWSER_TEST_F(WallpaperManagerPolicyTest, PRE_PersistOverLogout) { SetSystemSalt(); - LoginUser(testUsers_[0].GetUserEmail()); + LoginUser(testUsers_[0]); // Wait until default wallpaper has been loaded. RunUntilWallpaperChangeCount(1); @@ -455,7 +457,7 @@ } IN_PROC_BROWSER_TEST_F(WallpaperManagerPolicyTest, PersistOverLogout) { - LoginUser(testUsers_[0].GetUserEmail()); + LoginUser(testUsers_[0]); // Wait until wallpaper has been loaded. RunUntilWallpaperChangeCount(1); @@ -464,7 +466,7 @@ IN_PROC_BROWSER_TEST_F(WallpaperManagerPolicyTest, PRE_DevicePolicyTest) { SetSystemSalt(); - RegisterUser(testUsers_[0].GetUserEmail()); + RegisterUser(testUsers_[0]); StartupUtils::MarkOobeCompleted(); } @@ -486,7 +488,7 @@ // Log in a test user and set the user wallpaper policy. The user policy // controlled wallpaper shows up in the user session. - LoginUser(testUsers_[0].GetUserEmail()); + LoginUser(testUsers_[0]); InjectPolicy(0, kGreenImageFileName); RunUntilWallpaperChangeCount(3); EXPECT_EQ(kGreenImageColor, GetAverageWallpaperColor());
diff --git a/chrome/browser/chromeos/net/network_portal_detector_impl_browsertest.cc b/chrome/browser/chromeos/net/network_portal_detector_impl_browsertest.cc index f9948acc..d8e968b 100644 --- a/chrome/browser/chromeos/net/network_portal_detector_impl_browsertest.cc +++ b/chrome/browser/chromeos/net/network_portal_detector_impl_browsertest.cc
@@ -25,6 +25,7 @@ #include "chromeos/network/portal_detector/network_portal_detector_strategy.h" #include "components/captive_portal/captive_portal_testing_utils.h" #include "components/prefs/pref_service.h" +#include "components/signin/core/account_id/account_id.h" #include "components/sync_preferences/pref_service_syncable.h" #include "content/public/test/test_utils.h" #include "dbus/object_path.h" @@ -50,9 +51,10 @@ const char* const kUserActionMetric = NetworkPortalNotificationController::kUserActionMetric; -const char kTestUser[] = "test-user@gmail.com"; -const char kWifiServicePath[] = "/service/wifi"; -const char kWifiGuid[] = "wifi"; +constexpr char kTestUser[] = "test-user@gmail.com"; +constexpr char kTestUserGaiaId[] = "1234567890"; +constexpr char kWifiServicePath[] = "/service/wifi"; +constexpr char kWifiGuid[] = "wifi"; void ErrorCallbackFunction(const std::string& error_name, const std::string& error_message) { @@ -110,7 +112,11 @@ public captive_portal::CaptivePortalDetectorTestBase { public: NetworkPortalDetectorImplBrowserTest() - : LoginManagerTest(false), network_portal_detector_(NULL) {} + : LoginManagerTest(false), + test_account_id_( + AccountId::FromUserEmailGaiaId(kTestUser, kTestUserGaiaId)), + network_portal_detector_(NULL) {} + ~NetworkPortalDetectorImplBrowserTest() override {} void SetUpOnMainThread() override { @@ -163,6 +169,9 @@ ->GetDialogForTesting(); } + protected: + AccountId test_account_id_; + private: NetworkPortalDetectorImpl* network_portal_detector_; @@ -171,7 +180,7 @@ IN_PROC_BROWSER_TEST_F(NetworkPortalDetectorImplBrowserTest, PRE_InSessionDetection) { - RegisterUser(kTestUser); + RegisterUser(test_account_id_); StartupUtils::MarkOobeCompleted(); ASSERT_EQ(PortalDetectorStrategy::STRATEGY_ID_LOGIN_SCREEN, strategy()->Id()); } @@ -187,7 +196,7 @@ EnumHistogramChecker action_checker( kUserActionMetric, Controller::USER_ACTION_METRIC_COUNT, NULL); - LoginUser(kTestUser); + LoginUser(test_account_id_); content::RunAllPendingInMessageLoop(); // User connects to wifi. @@ -250,7 +259,7 @@ EnumHistogramChecker action_checker( kUserActionMetric, Controller::USER_ACTION_METRIC_COUNT, nullptr); - LoginUser(kTestUser); + LoginUser(test_account_id_); content::RunAllPendingInMessageLoop(); SetIgnoreNoNetworkForTesting(); @@ -292,7 +301,7 @@ IN_PROC_BROWSER_TEST_P(NetworkPortalDetectorImplBrowserTestIgnoreProxy, PRE_TestWithPreference) { - RegisterUser(kTestUser); + RegisterUser(test_account_id_); StartupUtils::MarkOobeCompleted(); EXPECT_EQ(PortalDetectorStrategy::STRATEGY_ID_LOGIN_SCREEN, strategy()->Id()); }
diff --git a/chrome/browser/chromeos/policy/affiliation_test_helper.cc b/chrome/browser/chromeos/policy/affiliation_test_helper.cc index 27b051a..912166d 100644 --- a/chrome/browser/chromeos/policy/affiliation_test_helper.cc +++ b/chrome/browser/chromeos/policy/affiliation_test_helper.cc
@@ -32,6 +32,9 @@ #include "components/policy/core/common/cloud/policy_builder.h" #include "components/prefs/pref_service.h" #include "components/prefs/scoped_user_pref_update.h" +#include "components/signin/core/account_id/account_id.h" +#include "components/user_manager/known_user.h" +#include "components/user_manager/user_manager.h" #include "content/public/browser/notification_service.h" #include "content/public/test/test_utils.h" #include "crypto/rsa_private_key.h" @@ -41,8 +44,9 @@ namespace affiliation_test_helper { -const char kFakeRefreshToken[] = "fake-refresh-token"; -const char kEnterpriseUser[] = "testuser@example.com"; +constexpr char kFakeRefreshToken[] = "fake-refresh-token"; +constexpr char kEnterpriseUserEmail[] = "testuser@example.com"; +constexpr char kEnterpriseUserGaiaId[] = "01234567890"; void SetUserKeys(policy::UserPolicyBuilder* user_policy) { const AccountId account_id = @@ -97,21 +101,24 @@ cryptohome::Identification(account_id), user_policy->GetBlob()); } -void PreLoginUser(const std::string& user_id) { +void PreLoginUser(const AccountId& account_id) { ListPrefUpdate users_pref(g_browser_process->local_state(), "LoggedInUsers"); - users_pref->AppendIfNotPresent(base::MakeUnique<base::Value>(user_id)); + users_pref->AppendIfNotPresent( + base::MakeUnique<base::Value>(account_id.GetUserEmail())); + if (user_manager::UserManager::IsInitialized()) + user_manager::known_user::SetProfileEverInitialized(account_id, false); + chromeos::StartupUtils::MarkOobeCompleted(); } -void LoginUser(const std::string& user_id) { +void LoginUser(const AccountId& account_id) { chromeos::test::UserSessionManagerTestApi session_manager_test_api( chromeos::UserSessionManager::GetInstance()); session_manager_test_api.SetShouldObtainTokenHandleInTests(false); - chromeos::UserContext user_context( - AccountId::FromUserEmailGaiaId(user_id, "gaia-id-" + user_id)); + chromeos::UserContext user_context(account_id); user_context.SetKey(chromeos::Key("password")); - if (user_id == kEnterpriseUser) { + if (account_id.GetUserEmail() == kEnterpriseUserEmail) { user_context.SetRefreshToken(kFakeRefreshToken); } chromeos::ExistingUserController* controller = @@ -130,7 +137,8 @@ if ((*it)->GetAccountId() == user_context.GetAccountId()) return; } - ADD_FAILURE() << user_id << " was not added via PreLoginUser()"; + ADD_FAILURE() << account_id.Serialize() + << " was not added via PreLoginUser()"; } void AppendCommandLineSwitchesForLoginManager(base::CommandLine* command_line) {
diff --git a/chrome/browser/chromeos/policy/affiliation_test_helper.h b/chrome/browser/chromeos/policy/affiliation_test_helper.h index d379d829..d875609 100644 --- a/chrome/browser/chromeos/policy/affiliation_test_helper.h +++ b/chrome/browser/chromeos/policy/affiliation_test_helper.h
@@ -9,6 +9,8 @@ #include <string> #include "components/policy/core/common/cloud/policy_builder.h" +class AccountId; + namespace base { class CommandLine; } // namespace base @@ -87,19 +89,21 @@ const std::string& user_email, const std::set<std::string>& user_affiliation_ids); -// Registers the user with the given |user_id| on the device and marks OOBE +// Registers the user with the given |account_id| on the device and marks OOBE // as completed. This method should be called in PRE_* test. -void PreLoginUser(const std::string& user_id); +void PreLoginUser(const AccountId& account_id); -// Log in user with |user_id|. User should be registered using PreLoginUser(). -void LoginUser(const std::string& user_id); +// Log in user with |account_id|. User should be registered using +// PreLoginUser(). +void LoginUser(const AccountId& user_id); // Set necessary for login command line switches. Execute it in // SetUpCommandLine(). void AppendCommandLineSwitchesForLoginManager(base::CommandLine* command_line); extern const char kFakeRefreshToken[]; -extern const char kEnterpriseUser[]; +extern const char kEnterpriseUserEmail[]; +extern const char kEnterpriseUserGaiaId[]; } // namespace affiliation_test_helper
diff --git a/chrome/browser/chromeos/policy/unaffiliated_arc_allowed_browsertest.cc b/chrome/browser/chromeos/policy/unaffiliated_arc_allowed_browsertest.cc index 2868363..c186001 100644 --- a/chrome/browser/chromeos/policy/unaffiliated_arc_allowed_browsertest.cc +++ b/chrome/browser/chromeos/policy/unaffiliated_arc_allowed_browsertest.cc
@@ -31,9 +31,10 @@ namespace { -const char kAffiliatedUser[] = "affiliated-user@example.com"; -const char kAffiliationID[] = "some-affiliation-id"; -const char kAnotherAffiliationID[] = "another-affiliation-id"; +constexpr char kAffiliatedUserEmail[] = "affiliated-user@example.com"; +constexpr char kAffiliatedUserGaiaId[] = "affiliated-user@example.com"; +constexpr char kAffiliationID[] = "some-affiliation-id"; +constexpr char kAnotherAffiliationID[] = "another-affiliation-id"; struct Params { explicit Params(bool affiliated) : affiliated_(affiliated) {} @@ -46,7 +47,12 @@ : public DevicePolicyCrosBrowserTest, public ::testing::WithParamInterface<Params> { public: - UnaffiliatedArcAllowedTest() { set_exit_when_last_browser_closes(false); } + UnaffiliatedArcAllowedTest() + : affiliated_account_id_( + AccountId::FromUserEmailGaiaId(kAffiliatedUserEmail, + kAffiliatedUserGaiaId)) { + set_exit_when_last_browser_closes(false); + } void SetUpCommandLine(base::CommandLine* command_line) override { DevicePolicyCrosBrowserTest::SetUpCommandLine(command_line); @@ -72,8 +78,8 @@ user_affiliation_ids.insert(kAnotherAffiliationID); affiliation_test_helper::SetUserAffiliationIDs( - &user_policy, session_manager_client(), kAffiliatedUser, - user_affiliation_ids); + &user_policy, session_manager_client(), + affiliated_account_id_.GetUserEmail(), user_affiliation_ids); } void TearDownOnMainThread() override { @@ -104,18 +110,20 @@ run_loop.Run(); } + const AccountId affiliated_account_id_; + private: DISALLOW_COPY_AND_ASSIGN(UnaffiliatedArcAllowedTest); }; IN_PROC_BROWSER_TEST_P(UnaffiliatedArcAllowedTest, PRE_ProfileTest) { - affiliation_test_helper::PreLoginUser(kAffiliatedUser); + affiliation_test_helper::PreLoginUser(affiliated_account_id_); } IN_PROC_BROWSER_TEST_P(UnaffiliatedArcAllowedTest, ProfileTest) { - affiliation_test_helper::LoginUser(kAffiliatedUser); - const user_manager::User* user = user_manager::UserManager::Get()->FindUser( - AccountId::FromUserEmail(kAffiliatedUser)); + affiliation_test_helper::LoginUser(affiliated_account_id_); + const user_manager::User* user = + user_manager::UserManager::Get()->FindUser(affiliated_account_id_); const Profile* profile = chromeos::ProfileHelper::Get()->GetProfileByUser(user); const bool affiliated = GetParam().affiliated_;
diff --git a/chrome/browser/chromeos/policy/user_affiliation_browsertest.cc b/chrome/browser/chromeos/policy/user_affiliation_browsertest.cc index ebdf387..7a49cb6a 100644 --- a/chrome/browser/chromeos/policy/user_affiliation_browsertest.cc +++ b/chrome/browser/chromeos/policy/user_affiliation_browsertest.cc
@@ -12,6 +12,7 @@ #include "chromeos/dbus/fake_session_manager_client.h" #include "chromeos/dbus/session_manager_client.h" #include "components/policy/core/common/cloud/device_management_service.h" +#include "components/signin/core/account_id/account_id.h" #include "components/user_manager/user.h" #include "components/user_manager/user_manager.h" #include "content/public/test/test_utils.h" @@ -21,9 +22,11 @@ namespace { -const char kAffiliatedUser[] = "affiliated-user@example.com"; -const char kAffiliationID[] = "some-affiliation-id"; -const char kAnotherAffiliationID[] = "another-affiliation-id"; +constexpr char kAffiliatedUser[] = "affiliated-user@example.com"; +constexpr char kAffiliatedUserGaiaId[] = "1234567890"; +constexpr char kAffiliationID[] = "some-affiliation-id"; +constexpr char kAnotherAffiliationID[] = "another-affiliation-id"; + struct Params { explicit Params(bool affiliated) : affiliated_(affiliated) {} bool affiliated_; @@ -35,7 +38,11 @@ : public InProcessBrowserTest, public ::testing::WithParamInterface<Params> { public: - UserAffiliationBrowserTest() { set_exit_when_last_browser_closes(false); } + UserAffiliationBrowserTest() + : account_id_(AccountId::FromUserEmailGaiaId(kAffiliatedUser, + kAffiliatedUserGaiaId)) { + set_exit_when_last_browser_closes(false); + } protected: // InProcessBrowserTest @@ -67,27 +74,28 @@ user_affiliation_ids.insert(kAnotherAffiliationID); } affiliation_test_helper::SetUserAffiliationIDs( - &user_policy, fake_session_manager_client, kAffiliatedUser, + &user_policy, fake_session_manager_client, account_id_.GetUserEmail(), user_affiliation_ids); // Set retry delay to prevent timeouts. policy::DeviceManagementService::SetRetryDelayForTesting(0); } + const AccountId account_id_; + private: DISALLOW_COPY_AND_ASSIGN(UserAffiliationBrowserTest); }; IN_PROC_BROWSER_TEST_P(UserAffiliationBrowserTest, PRE_Affiliated) { - affiliation_test_helper::PreLoginUser(kAffiliatedUser); + affiliation_test_helper::PreLoginUser(account_id_); } IN_PROC_BROWSER_TEST_P(UserAffiliationBrowserTest, Affiliated) { - affiliation_test_helper::LoginUser(kAffiliatedUser); - EXPECT_EQ(GetParam().affiliated_, - user_manager::UserManager::Get() - ->FindUser(AccountId::FromUserEmail(kAffiliatedUser)) - ->IsAffiliated()); + affiliation_test_helper::LoginUser(account_id_); + EXPECT_EQ( + GetParam().affiliated_, + user_manager::UserManager::Get()->FindUser(account_id_)->IsAffiliated()); } INSTANTIATE_TEST_CASE_P(AffiliationCheck,
diff --git a/chrome/browser/chromeos/preferences_chromeos_browsertest.cc b/chrome/browser/chromeos/preferences_chromeos_browsertest.cc index 3c59ca5..e9e516eb 100644 --- a/chrome/browser/chromeos/preferences_chromeos_browsertest.cc +++ b/chrome/browser/chromeos/preferences_chromeos_browsertest.cc
@@ -42,19 +42,18 @@ namespace chromeos { -namespace { - -const char* const kTestUsers[] = {"test-user1@gmail.com", - "test-user2@gmail.com"}; - -} // namespace - class PreferencesTest : public LoginManagerTest { public: PreferencesTest() : LoginManagerTest(true), input_settings_(nullptr), keyboard_(nullptr) { + struct { + const char* email; + const char* gaia_id; + } const kTestUsers[] = {{"test-user1@gmail.com", "1111111111"}, + {"test-user2@gmail.com", "2222222222"}}; for (size_t i = 0; i < arraysize(kTestUsers); ++i) { - test_users_.push_back(AccountId::FromUserEmail(kTestUsers[i])); + test_users_.push_back(AccountId::FromUserEmailGaiaId( + kTestUsers[i].email, kTestUsers[i].gaia_id)); } } @@ -198,8 +197,8 @@ }; IN_PROC_BROWSER_TEST_F(PreferencesTest, PRE_MultiProfiles) { - RegisterUser(test_users_[0].GetUserEmail()); - RegisterUser(test_users_[1].GetUserEmail()); + RegisterUser(test_users_[0]); + RegisterUser(test_users_[1]); chromeos::StartupUtils::MarkOobeCompleted(); } @@ -208,7 +207,7 @@ // Add first user and init its preferences. Check that corresponding // settings has been changed. - LoginUser(test_users_[0].GetUserEmail()); + LoginUser(test_users_[0]); const user_manager::User* user1 = user_manager->FindUser(test_users_[0]); PrefService* prefs1 = ProfileHelper::Get()->GetProfileByUserUnsafe(user1)->GetPrefs(); @@ -219,7 +218,7 @@ // Add second user and init its prefs with different values. UserAddingScreen::Get()->Start(); content::RunAllPendingInMessageLoop(); - AddUser(test_users_[1].GetUserEmail()); + AddUser(test_users_[1]); content::RunAllPendingInMessageLoop(); const user_manager::User* user2 = user_manager->FindUser(test_users_[1]); EXPECT_TRUE(user2->is_active());
diff --git a/chrome/browser/extensions/active_tab_unittest.cc b/chrome/browser/extensions/active_tab_unittest.cc index c20a2e17..95b12728 100644 --- a/chrome/browser/extensions/active_tab_unittest.cc +++ b/chrome/browser/extensions/active_tab_unittest.cc
@@ -463,8 +463,8 @@ chromeos::WallpaperManager::Initialize(); g_browser_process->local_state()->SetString( "PublicAccountPendingDataRemoval", user_email); - user_manager::UserManager::Get()->UserLoggedIn( - account_id, user_id_hash, true); + user_manager::UserManager::Get()->UserLoggedIn(account_id, user_id_hash, + true); GURL google("http://www.google.com"); NavigateAndCommit(google);
diff --git a/chrome/browser/extensions/api/braille_display_private/braille_display_private_apitest.cc b/chrome/browser/extensions/api/braille_display_private/braille_display_private_apitest.cc index 3f507ef..8c71f0bb 100644 --- a/chrome/browser/extensions/api/braille_display_private/braille_display_private_apitest.cc +++ b/chrome/browser/extensions/api/braille_display_private/braille_display_private_apitest.cc
@@ -38,7 +38,8 @@ namespace { -const char kTestUserName[] = "owner@invalid.domain"; +constexpr char kTestUserName[] = "owner@invalid.domain"; +constexpr char kTestUserGaiaId[] = "0123456789"; // Used to make ReadKeys return an error. brlapi_keyCode_t kErrorKeyCode = BRLAPI_KEY_MAX; @@ -338,7 +339,8 @@ std::unique_ptr<ScreenLockerTester> tester(ScreenLocker::GetTester()); // Log in. session_manager::SessionManager::Get()->CreateSession( - AccountId::FromUserEmail(kTestUserName), kTestUserName); + AccountId::FromUserEmailGaiaId(kTestUserName, kTestUserGaiaId), + kTestUserName); g_browser_process->profile_manager()->GetProfile( ProfileHelper::Get()->GetProfilePathByUserIdHash(kTestUserName)); session_manager::SessionManager::Get()->SessionStarted();
diff --git a/chrome/browser/extensions/api/enterprise_device_attributes/enterprise_device_attributes_apitest.cc b/chrome/browser/extensions/api/enterprise_device_attributes/enterprise_device_attributes_apitest.cc index f0d5b67..a83c8672 100644 --- a/chrome/browser/extensions/api/enterprise_device_attributes/enterprise_device_attributes_apitest.cc +++ b/chrome/browser/extensions/api/enterprise_device_attributes/enterprise_device_attributes_apitest.cc
@@ -29,20 +29,21 @@ namespace { -const char kDeviceId[] = "device_id"; -const base::FilePath::CharType kTestExtensionDir[] = +constexpr char kDeviceId[] = "device_id"; +constexpr base::FilePath::CharType kTestExtensionDir[] = FILE_PATH_LITERAL("extensions/api_test/enterprise_device_attributes"); -const base::FilePath::CharType kUpdateManifestFileName[] = +constexpr base::FilePath::CharType kUpdateManifestFileName[] = FILE_PATH_LITERAL("update_manifest.xml"); -const char kAffiliatedUserEmail[] = "user@example.com"; -const char kAffiliationID[] = "some-affiliation-id"; -const char kAnotherAffiliationID[] = "another-affiliation-id"; +constexpr char kAffiliatedUserEmail[] = "user@example.com"; +constexpr char kAffiliatedUserGaiaId[] = "1029384756"; +constexpr char kAffiliationID[] = "some-affiliation-id"; +constexpr char kAnotherAffiliationID[] = "another-affiliation-id"; // The managed_storage extension has a key defined in its manifest, so that // its extension ID is well-known and the policy system can push policies for // the extension. -const char kTestExtensionID[] = "nbiliclbejdndfpchgkbmfoppjplbdok"; +constexpr char kTestExtensionID[] = "nbiliclbejdndfpchgkbmfoppjplbdok"; struct Params { explicit Params(bool affiliated) : affiliated_(affiliated) {} @@ -127,10 +128,8 @@ void SetUpOnMainThread() override { const base::ListValue* users = g_browser_process->local_state()->GetList("LoggedInUsers"); - if (!users->empty()) { - policy::affiliation_test_helper::LoginUser( - affiliated_account_id_.GetUserEmail()); - } + if (!users->empty()) + policy::affiliation_test_helper::LoginUser(affiliated_account_id_); ExtensionApiTest::SetUpOnMainThread(); } @@ -184,7 +183,8 @@ } const AccountId affiliated_account_id_ = - AccountId::FromUserEmail(kAffiliatedUserEmail); + AccountId::FromUserEmailGaiaId(kAffiliatedUserEmail, + kAffiliatedUserGaiaId); private: policy::MockConfigurationPolicyProvider policy_provider_; @@ -192,8 +192,7 @@ }; IN_PROC_BROWSER_TEST_P(EnterpriseDeviceAttributesTest, PRE_Success) { - policy::affiliation_test_helper::PreLoginUser( - affiliated_account_id_.GetUserEmail()); + policy::affiliation_test_helper::PreLoginUser(affiliated_account_id_); } IN_PROC_BROWSER_TEST_P(EnterpriseDeviceAttributesTest, Success) {
diff --git a/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_apitest_nss.cc b/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_apitest_nss.cc index 5269baa..a3661f06 100644 --- a/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_apitest_nss.cc +++ b/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_apitest_nss.cc
@@ -162,7 +162,8 @@ const char kAffiliationID[] = "some-affiliation-id"; const char kTestUserinfoToken[] = "fake-userinfo-token"; -using policy::affiliation_test_helper::kEnterpriseUser; +using policy::affiliation_test_helper::kEnterpriseUserEmail; +using policy::affiliation_test_helper::kEnterpriseUserGaiaId; enum SystemToken { SYSTEM_TOKEN_EXISTS, @@ -196,7 +197,9 @@ : public ExtensionApiTest, public ::testing::WithParamInterface<Params> { public: - EnterprisePlatformKeysTest() { + EnterprisePlatformKeysTest() + : account_id_(AccountId::FromUserEmailGaiaId(kEnterpriseUserEmail, + kEnterpriseUserGaiaId)) { // Command line should not be tweaked as if user is already logged in. set_chromeos_user_ = false; // We log in without running browser. @@ -268,7 +271,7 @@ user_affiliation_ids.insert(kAffiliationID); policy::UserPolicyBuilder user_policy; policy::affiliation_test_helper::SetUserAffiliationIDs( - &user_policy, fake_session_manager_client, kEnterpriseUser, + &user_policy, fake_session_manager_client, account_id_.GetUserEmail(), user_affiliation_ids); } @@ -291,7 +294,7 @@ token_info.scopes.insert(GaiaConstants::kOAuthWrapBridgeUserInfoScope); token_info.audience = GaiaUrls::GetInstance()->oauth2_chrome_client_id(); token_info.token = kTestUserinfoToken; - token_info.email = kEnterpriseUser; + token_info.email = account_id_.GetUserEmail(); fake_gaia_.IssueOAuthToken( policy::affiliation_test_helper::kFakeRefreshToken, token_info); @@ -305,7 +308,7 @@ // This condition is not held in PRE_ test. if (!users->empty()) - policy::affiliation_test_helper::LoginUser(kEnterpriseUser); + policy::affiliation_test_helper::LoginUser(account_id_); if (GetParam().system_token_ == SYSTEM_TOKEN_EXISTS) { base::RunLoop loop; @@ -419,6 +422,10 @@ content::BrowserThread::UI, FROM_HERE, done_callback); } + protected: + const AccountId account_id_; + + private: policy::DevicePolicyCrosTestHelper device_policy_test_helper_; std::unique_ptr<crypto::ScopedTestSystemNSSKeySlot> test_system_slot_; policy::MockConfigurationPolicyProvider policy_provider_; @@ -429,7 +436,7 @@ } // namespace IN_PROC_BROWSER_TEST_P(EnterprisePlatformKeysTest, PRE_Basic) { - policy::affiliation_test_helper::PreLoginUser(kEnterpriseUser); + policy::affiliation_test_helper::PreLoginUser(account_id_); } IN_PROC_BROWSER_TEST_P(EnterprisePlatformKeysTest, Basic) {
diff --git a/chrome/browser/net/nss_context_chromeos_browsertest.cc b/chrome/browser/net/nss_context_chromeos_browsertest.cc index a6def613..31d4b3c7 100644 --- a/chrome/browser/net/nss_context_chromeos_browsertest.cc +++ b/chrome/browser/net/nss_context_chromeos_browsertest.cc
@@ -19,8 +19,10 @@ namespace { -const char kTestUser1[] = "test-user1@gmail.com"; -const char kTestUser2[] = "test-user2@gmail.com"; +constexpr char kTestUser1[] = "test-user1@gmail.com"; +constexpr char kTestUser1GaiaId[] = "1111111111"; +constexpr char kTestUser2[] = "test-user2@gmail.com"; +constexpr char kTestUser2GaiaId[] = "2222222222"; void NotCalledDbCallback(net::NSSCertDatabase* db) { ASSERT_TRUE(false); } @@ -164,8 +166,8 @@ IN_PROC_BROWSER_TEST_F(NSSContextChromeOSBrowserTest, PRE_TwoUsers) { // Initialization for ChromeOS multi-profile test infrastructure. - RegisterUser(kTestUser1); - RegisterUser(kTestUser2); + RegisterUser(AccountId::FromUserEmailGaiaId(kTestUser1, kTestUser1GaiaId)); + RegisterUser(AccountId::FromUserEmailGaiaId(kTestUser2, kTestUser2GaiaId)); chromeos::StartupUtils::MarkOobeCompleted(); } @@ -173,9 +175,11 @@ user_manager::UserManager* user_manager = user_manager::UserManager::Get(); // Log in first user and get their DB. - LoginUser(kTestUser1); + const AccountId account_id1( + AccountId::FromUserEmailGaiaId(kTestUser1, kTestUser1GaiaId)); + LoginUser(account_id1); Profile* profile1 = chromeos::ProfileHelper::Get()->GetProfileByUserUnsafe( - user_manager->FindUser(AccountId::FromUserEmail(kTestUser1))); + user_manager->FindUser(account_id1)); ASSERT_TRUE(profile1); DBTester tester1(profile1); @@ -185,11 +189,14 @@ UserAddingFinishObserver observer; chromeos::UserAddingScreen::Get()->Start(); base::RunLoop().RunUntilIdle(); - AddUser(kTestUser2); + + const AccountId account_id2( + AccountId::FromUserEmailGaiaId(kTestUser2, kTestUser2GaiaId)); + AddUser(account_id2); observer.WaitUntilUserAddingFinishedOrCancelled(); Profile* profile2 = chromeos::ProfileHelper::Get()->GetProfileByUserUnsafe( - user_manager->FindUser(AccountId::FromUserEmail(kTestUser2))); + user_manager->FindUser(account_id2)); ASSERT_TRUE(profile2); DBTester tester2(profile2);
diff --git a/chrome/browser/notifications/login_state_notification_blocker_chromeos_browsertest.cc b/chrome/browser/notifications/login_state_notification_blocker_chromeos_browsertest.cc index a7516d71..5d162f82 100644 --- a/chrome/browser/notifications/login_state_notification_blocker_chromeos_browsertest.cc +++ b/chrome/browser/notifications/login_state_notification_blocker_chromeos_browsertest.cc
@@ -22,9 +22,6 @@ namespace { -const char* kTestUsers[] = {"test-user@gmail.com", - "test-user1@gmail.com"}; - class UserAddingFinishObserver : public chromeos::UserAddingScreen::Observer { public: UserAddingFinishObserver() { @@ -64,7 +61,18 @@ public message_center::MessageCenterObserver { public: LoginStateNotificationBlockerChromeOSBrowserTest() - : chromeos::LoginManagerTest(false) {} + : chromeos::LoginManagerTest(false) { + struct { + const char* email; + const char* gaia_id; + } const kTestUsers[] = {{"test-user@gmail.com", "1110001111"}, + {"test-user1@gmail.com", "1111111111"}}; + for (size_t i = 0; i < arraysize(kTestUsers); ++i) { + test_users_.emplace_back(AccountId::FromUserEmailGaiaId( + kTestUsers[i].email, kTestUsers[i].gaia_id)); + } + } + ~LoginStateNotificationBlockerChromeOSBrowserTest() override {} void SetUpOnMainThread() override { @@ -127,6 +135,8 @@ return new_count == initial_count + 1; } + std::vector<AccountId> test_users_; + private: int state_changed_count_ = 0; @@ -138,8 +148,8 @@ IN_PROC_BROWSER_TEST_F(LoginStateNotificationBlockerChromeOSBrowserTest, PRE_BaseTest) { - RegisterUser(kTestUsers[0]); - RegisterUser(kTestUsers[1]); + RegisterUser(test_users_[0]); + RegisterUser(test_users_[1]); chromeos::StartupUtils::MarkOobeCompleted(); } @@ -147,10 +157,10 @@ BaseTest) { message_center::NotifierId notifier_id( message_center::NotifierId::APPLICATION, "test-notifier"); - notifier_id.profile_id = kTestUsers[0]; + notifier_id.profile_id = test_users_[0].GetUserEmail(); // Logged in as a normal user. - LoginUser(kTestUsers[0]); + LoginUser(test_users_[0]); // One state change from LoginStateNotificationBloker plus one state change // for the InactiveUserNotificationBlocker. @@ -174,8 +184,8 @@ IN_PROC_BROWSER_TEST_F(LoginStateNotificationBlockerChromeOSBrowserTest, PRE_AlwaysAllowedNotifier) { - RegisterUser(kTestUsers[0]); - RegisterUser(kTestUsers[1]); + RegisterUser(test_users_[0]); + RegisterUser(test_users_[1]); chromeos::StartupUtils::MarkOobeCompleted(); } @@ -185,10 +195,10 @@ message_center::NotifierId notifier_id( message_center::NotifierId::SYSTEM_COMPONENT, ash::system_notifier::kNotifierDisplay); - notifier_id.profile_id = kTestUsers[0]; + notifier_id.profile_id = test_users_[0].GetUserEmail(); // Logged in as a normal user. - LoginUser(kTestUsers[0]); + LoginUser(test_users_[0]); // One state change from LoginStateNotificationBloker plus one state change // for the InactiveUserNotificationBlocker.
diff --git a/chrome/browser/profiles/profile_manager_unittest.cc b/chrome/browser/profiles/profile_manager_unittest.cc index 972f8c0..fef20e4f 100644 --- a/chrome/browser/profiles/profile_manager_unittest.cc +++ b/chrome/browser/profiles/profile_manager_unittest.cc
@@ -209,12 +209,13 @@ #if defined(OS_CHROMEOS) // Helper function to register an user with id |user_id| and create profile // with a correct path. - void RegisterUser(const std::string& user_id) { + void RegisterUser(const AccountId& account_id) { chromeos::ProfileHelper* profile_helper = chromeos::ProfileHelper::Get(); const std::string user_id_hash = - profile_helper->GetUserIdHashByUserIdForTesting(user_id); - user_manager::UserManager::Get()->UserLoggedIn( - AccountId::FromUserEmail(user_id), user_id_hash, false); + profile_helper->GetUserIdHashByUserIdForTesting( + account_id.GetUserEmail()); + user_manager::UserManager::Get()->UserLoggedIn(account_id, user_id_hash, + false); g_browser_process->profile_manager()->GetProfile( profile_helper->GetProfilePathByUserIdHash(user_id_hash)); } @@ -280,8 +281,10 @@ EXPECT_EQ(expected_default.value(), profile_manager->GetInitialProfileDir().value()); - const char kTestUserName[] = "test-user@example.com"; - const AccountId test_account_id(AccountId::FromUserEmail(kTestUserName)); + constexpr char kTestUserName[] = "test-user@example.com"; + constexpr char kTestUserGaiaId[] = "0123456789"; + const AccountId test_account_id( + AccountId::FromUserEmailGaiaId(kTestUserName, kTestUserGaiaId)); chromeos::FakeChromeUserManager* user_manager = new chromeos::FakeChromeUserManager(); user_manager::ScopedUserManager enabler(base::WrapUnique(user_manager)); @@ -322,10 +325,11 @@ // User signs in but user profile loading has not started. const std::string user_id = "test-user@example.com"; + const std::string gaia_id = "0123456789"; const std::string user_id_hash = ProfileHelper::Get()->GetUserIdHashByUserIdForTesting(user_id); user_manager::UserManager::Get()->UserLoggedIn( - AccountId::FromUserEmail(user_id), user_id_hash, false); + AccountId::FromUserEmailGaiaId(user_id, gaia_id), user_id_hash, false); // Sign-in profile should be returned at this stage. Otherwise, login code // ends up in an invalid state. Strange things as in http://crbug.com/728683 @@ -608,9 +612,17 @@ session_type_ = extensions::ScopedCurrentFeatureSessionType( extensions::GetCurrentFeatureSessionType()); - RegisterUser(user_manager::kGuestUserName); + RegisterUser(GetFakeUserManager()->GetGuestAccountId()); #endif } + + private: +#if defined(OS_CHROMEOS) + chromeos::FakeChromeUserManager* GetFakeUserManager() const { + return static_cast<chromeos::FakeChromeUserManager*>( + user_manager::UserManager::Get()); + } +#endif }; TEST_F(ProfileManagerGuestTest, GetLastUsedProfileAllowedByPolicy) { @@ -758,7 +770,8 @@ // On CrOS, profile returned by GetLastUsedProfile is a sign-in profile that // is forced to be incognito. That's why we need to create at least one user // to get a regular profile. - RegisterUser("test-user@example.com"); + RegisterUser( + AccountId::FromUserEmailGaiaId("test-user@example.com", "1234567890")); #endif Profile* profile = profile_manager->GetLastUsedProfileAllowedByPolicy();
diff --git a/chrome/browser/profiling_host/profiling_process_host.cc b/chrome/browser/profiling_host/profiling_process_host.cc index 0adf8a8..82782b7d 100644 --- a/chrome/browser/profiling_host/profiling_process_host.cc +++ b/chrome/browser/profiling_host/profiling_process_host.cc
@@ -154,6 +154,13 @@ void UploadTraceToCrashServer(std::string file_contents, std::string trigger_name) { + // Traces has been observed as small as 4k. Seems likely to be a bug. To + // account for all potentially too-small traces, we set the lower bounds to + // 512 bytes. The upper bounds is set to 300MB as an extra-high threshold, + // just in case something goes wrong. + UMA_HISTOGRAM_CUSTOM_COUNTS("OutOfProcessHeapProfiling.UploadTrace.Size", + file_contents.size(), 512, 300 * 1024 * 1024, 50); + base::Value rules_list(base::Value::Type::LIST); base::Value rule(base::Value::Type::DICTIONARY); rule.SetKey("rule", base::Value("MEMLOG")); @@ -488,6 +495,8 @@ auto finish_report_callback = base::BindOnce( [](std::string trigger_name, bool success, std::string trace) { + UMA_HISTOGRAM_BOOLEAN("OutOfProcessHeapProfiling.RecordTrace.Success", + success); if (success) { UploadTraceToCrashServer(std::move(trace), std::move(trigger_name)); } @@ -549,10 +558,12 @@ DCHECK(!dump_process_for_tracing_callback_); dump_process_for_tracing_callback_ = std::move(stop_tracing_closure); } else { - // Wait 10 seconds, then end the trace. + // Wait 30 seconds, then end the trace. 10 seconds has been observed to not + // be sufficient time for the profiling service to dump its data to the + // trace. base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( FROM_HERE, std::move(stop_tracing_closure), - base::TimeDelta::FromSeconds(10)); + base::TimeDelta::FromSeconds(30)); } }
diff --git a/chrome/browser/resources/md_extensions/item.html b/chrome/browser/resources/md_extensions/item.html index a832300..27f2390 100644 --- a/chrome/browser/resources/md_extensions/item.html +++ b/chrome/browser/resources/md_extensions/item.html
@@ -26,10 +26,32 @@ <template> <style include= "iron-flex cr-hidden-style cr-icons action-link paper-button-style"> + .bounded-text, + .multiline-clippable-text, + .clippable-flex-text { + /** Ensure that the text does not overflow its container. */ + overflow: hidden; + text-overflow: ellipsis; + } + + .bounded-text, + .clippable-flex-text { + white-space: nowrap; + } + + .clipppable-flex-text { + /** + * These labels can be arbitrarily long. We want to ensure that these + * shrink, rather than the neighboring content. + */ + flex-shrink: 1; + } + #icon-wrapper { align-self: flex-start; display: flex; padding: 6px; + position: relative; } #icon { @@ -53,15 +75,16 @@ #main { display: flex; - flex-grow: 1; + flex: 1; padding: 16px 20px 17px; } #content { -webkit-margin-start: 24px; display: flex; + flex: 1; flex-direction: column; - width: 100%; + overflow: hidden; } #name-and-version { @@ -73,9 +96,13 @@ -webkit-margin-end: 8px; } - #description, + #description { + flex: 1; + } + #warnings { - flex-grow: 1; + color: var(--google-red-700); + flex: 1; margin-bottom: 8px; } @@ -89,11 +116,25 @@ font-weight: 400; } + #extension-id { + flex-shrink: 0; + } + + #inspect-views { + display: flex; + white-space: nowrap; + } + + #inspect-views > span { + -webkit-margin-end: 4px; + } + #button-strip { /* Avoid ripple from overlapping container. */ -webkit-margin-end: 20px; border-top: var(--cr-separator-line); box-sizing: border-box; + flex-shrink: 0; height: var(--cr-section-min-height); padding-bottom: 8px; padding-top: 8px; @@ -108,10 +149,6 @@ text-decoration: none; } - #icon-wrapper { - position: relative; - } - #source-indicator { -webkit-margin-start: 24px; margin-top: 24px; @@ -155,10 +192,6 @@ -webkit-margin-end: 12px; } - #warnings { - color: var(--google-red-700); - } - #blacklisted-warning:empty { display: none; } @@ -192,13 +225,18 @@ </paper-tooltip> </template> <div id="content"> - <div id="name-and-version" class="layout horizontal center"> - <div id="name">[[data.name]]</div> - <span id="version" hidden$="[[!inDevMode]]"> - [[data.version]] - </span> + <!--Note: We wrap inspect-views in a div so that the outer div + doesn't shrink (because it's not display: flex).--> + <div> + <div id="name-and-version" class="layout horizontal center"> + <div id="name" class="clippable-flex-text">[[data.name]]</div> + <span id="version" hidden$="[[!inDevMode]]"> + [[data.version]] + </span> + </div> </div> - <div id="description" hidden$="[[hasWarnings_(data.*)]]"> + <div id="description" class="multiline-clippable-text" + hidden$="[[hasWarnings_(data.*)]]"> [[data.description]] </div> <template is="dom-if" if="[[hasWarnings_(data.*)]]"> @@ -221,19 +259,25 @@ </div> </template> <template is="dom-if" if="[[inDevMode]]"> - <div id="extension-id">[[data.id]]</div> + <div id="extension-id" class="bounded-text">[[data.id]]</div> <template is="dom-if" if="[[!computeInspectViewsHidden_(data.views)]]"> - <div id="inspect-views"> - <span>$i18n{itemInspectViews}</span> - <a is="action-link" on-tap="onInspectTap_"> - [[computeFirstInspectLabel_(data.views)]] - </a> - <a is="action-link" - hidden$="[[computeExtraViewsHidden_(data.views)]]" - on-tap="onExtraInspectTap_"> - [[computeExtraInspectLabel_(data.views)]] - </a> + <!--Note: We wrap inspect-views in a div so that the outer div + doesn't shrink (because it's not display: flex).--> + <div> + <div id="inspect-views"> + <span>$i18n{itemInspectViews}</span> + <a class="clippable-flex-text" is="action-link" + title="[[computeFirstInspectTitle_(data.views)]]" + on-tap="onInspectTap_"> + [[computeFirstInspectLabel_(data.views)]] + </a> + <a is="action-link" + hidden$="[[computeExtraViewsHidden_(data.views)]]" + on-tap="onExtraInspectTap_"> + [[computeExtraInspectLabel_(data.views)]] + </a> + </div> </div> </template> </template>
diff --git a/chrome/browser/resources/md_extensions/item.js b/chrome/browser/resources/md_extensions/item.js index a433f35..37a95fc 100644 --- a/chrome/browser/resources/md_extensions/item.js +++ b/chrome/browser/resources/md_extensions/item.js
@@ -273,18 +273,24 @@ * @return {string} * @private */ - computeFirstInspectLabel_: function() { + computeFirstInspectTitle_: function() { // Note: theoretically, this wouldn't be called without any inspectable // views (because it's in a dom-if="!computeInspectViewsHidden_()"). // However, due to the recycling behavior of iron list, it seems that // sometimes it can. Even when it is, the UI behaves properly, but we // need to handle the case gracefully. - if (this.data.views.length == 0) - return ''; - let label = extensions.computeInspectableViewLabel(this.data.views[0]); - if (this.data.views.length > 1) - label += ','; - return label; + return this.data.views.length > 0 ? + extensions.computeInspectableViewLabel(this.data.views[0]) : + ''; + }, + + /** + * @return {string} + * @private + */ + computeFirstInspectLabel_: function() { + let label = this.computeFirstInspectTitle_(); + return label && this.data.views.length > 1 ? label + ',' : label; }, /**
diff --git a/chrome/browser/resources/md_extensions/keyboard_shortcuts.html b/chrome/browser/resources/md_extensions/keyboard_shortcuts.html index 854db355..5fcde2f5 100644 --- a/chrome/browser/resources/md_extensions/keyboard_shortcuts.html +++ b/chrome/browser/resources/md_extensions/keyboard_shortcuts.html
@@ -20,17 +20,18 @@ } .shortcut-card { - margin: 0 auto 16px auto; - max-width: var(--card-max-width); - min-width: var(--card-min-width); - width: 90%; - } - - .shortcut-card { @apply --cr-primary-text; @apply --shadow-elevation-2dp; background-color: white; + margin: 0 auto 16px auto; + max-width: var(--card-max-width); + min-width: var(--card-min-width); padding-bottom: 8px; + width: 90%; + } + + .shortcut-card:last-of-type { + margin-bottom: 64px; } #container {
diff --git a/chrome/browser/resources/media_router/elements/route_controls/route_controls.css b/chrome/browser/resources/media_router/elements/route_controls/route_controls.css index c2e56bd6..42b845b 100644 --- a/chrome/browser/resources/media_router/elements/route_controls/route_controls.css +++ b/chrome/browser/resources/media_router/elements/route_controls/route_controls.css
@@ -84,12 +84,9 @@ } #hangouts-local-present-controls { - -webkit-font-smoothing: antialiased; - -webkit-tap-highlight-color: transparent; cursor: pointer; display: inline-block; float: right; - font-family: 'Roboto', 'Noto', sans-serif; padding-top: 10.5px; white-space: nowrap; } @@ -105,16 +102,14 @@ width: 249px; } -#always-use-mirroring-checkbox { - --paper-checkbox-vertical-align: middle; - --paper-checkbox-label-spacing: 10%; - padding: 0.3em 0 0.3em 0; - width: 100%; -} - -#media-remoting-enabled-controls { +#mirroring-fullscreen-video-controls { display: inline-block; font-size: 0.8em; - margin: 2px 8px; - width: 100%; + margin: 15px 8px 3px 8px; + vertical-align: middle; + white-space: nowrap; +} + +#mirroring-fullscreen-video-dropdown { + width: auto; }
diff --git a/chrome/browser/resources/media_router/elements/route_controls/route_controls.html b/chrome/browser/resources/media_router/elements/route_controls/route_controls.html index b9ecc9eb..f20cbbc 100644 --- a/chrome/browser/resources/media_router/elements/route_controls/route_controls.html +++ b/chrome/browser/resources/media_router/elements/route_controls/route_controls.html
@@ -1,3 +1,4 @@ +<link rel="import" href="chrome://resources/html/md_select_css.html"> <link rel="import" href="chrome://resources/html/polymer.html"> <link rel="import" href="chrome://resources/html/i18n_behavior.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-icons/av-icons.html"> @@ -7,6 +8,7 @@ <link rel="import" type="css" href="../../media_router_common.css"> <link rel="import" type="css" href="route_controls.css"> <template> + <style include="md-select"></style> <div id="media-controls"> <div class="ellipsis" id="route-description" title="[[routeDescription_]]"> @@ -81,14 +83,22 @@ </paper-checkbox> </div> </div> - <div id="media-remoting-enabled-controls" + <div id="mirroring-fullscreen-video-controls" hidden="[[!routeStatus.mirroringExtraData]]"> - <paper-checkbox - checked="[[!mediaRemotingEnabled_]]" - id="always-use-mirroring-checkbox" - on-change="onMediaRemotingEnabledChange_"> - <span>[[i18n('alwaysUseMirroringTitle')]]</span> - </paper-checkbox> + [[i18n('fullscreenVideosDropdownTitle')]] + <span class="md-select-wrapper"> + <select class="md-select" + id="mirroring-fullscreen-video-dropdown" + on-change="onFullscreenVideoDropdownChange_"> + <option value="[[FullscreenVideoOption_.REMOTE_SCREEN]]"> + [[i18n('fullscreenVideosRemoteScreen')]] + </option> + <option value="[[FullscreenVideoOption_.BOTH_SCREENS]]"> + [[i18n('fullscreenVideosBothScreens')]] + </option> + </select> + <span class="md-select-underline"></span> + </span> </div> </div> </div>
diff --git a/chrome/browser/resources/media_router/elements/route_controls/route_controls.js b/chrome/browser/resources/media_router/elements/route_controls/route_controls.js index d84188e..ab724032 100644 --- a/chrome/browser/resources/media_router/elements/route_controls/route_controls.js +++ b/chrome/browser/resources/media_router/elements/route_controls/route_controls.js
@@ -12,6 +12,20 @@ properties: { /** + * Set of possible options for playing fullscreen videos when mirroring. + * @private {!Object} + */ + FullscreenVideoOption_: { + type: Object, + value: { + // Play on remote screen only. + REMOTE_SCREEN: 'remote_screen', + // Play on both remote and local screens. + BOTH_SCREENS: 'both_screens' + } + }, + + /** * The current time displayed in seconds, before formatting. * @private {number} */ @@ -371,8 +385,16 @@ } this.hangoutsLocalPresent_ = !!newRouteStatus.hangoutsExtraData && newRouteStatus.hangoutsExtraData.localPresent; - this.mediaRemotingEnabled_ = !!newRouteStatus.mirroringExtraData && - newRouteStatus.mirroringExtraData.mediaRemotingEnabled; + if (newRouteStatus.mirroringExtraData) { + // Manually update the selected value on the + // mirroring-fullscreen-video-dropdown dropbox. + // TODO(imcheng): Avoid doing this by wrapping the dropbox in a Polymer + // template, or introduce <paper-dropdown-menu> to the Polymer library. + this.$['mirroring-fullscreen-video-dropdown'].value = + newRouteStatus.mirroringExtraData.mediaRemotingEnabled ? + this.FullscreenVideoOption_.REMOTE_SCREEN : + this.FullscreenVideoOption_.BOTH_SCREENS; + } }, /** @@ -446,13 +468,16 @@ }, /** - * Called when the "always use mirroring" box is changed by the user. - * @param {!Event} e "always use mirroring" paper-checkbox's change event + * Called when the value on the mirroring-fullscreen-video-dropdown dropdown + * menu changes. + * @param {!Event} e * @private */ - onMediaRemotingEnabledChange_: function(e) { - this.mediaRemotingEnabled_ = !e.target.checked; - media_router.browserApi.setMediaRemotingEnabled(this.mediaRemotingEnabled_); + onFullscreenVideoDropdownChange_: function(e) { + /** @const */ var dropdownValue = + this.$['mirroring-fullscreen-video-dropdown'].value; + media_router.browserApi.setMediaRemotingEnabled( + dropdownValue == this.FullscreenVideoOption_.REMOTE_SCREEN); }, /**
diff --git a/chrome/browser/resources/media_router/media_router.css b/chrome/browser/resources/media_router/media_router.css index ad517c4..4b3904a 100644 --- a/chrome/browser/resources/media_router/media_router.css +++ b/chrome/browser/resources/media_router/media_router.css
@@ -3,7 +3,6 @@ * found in the LICENSE file. */ body { - font-family: Roboto; font-size: 0.75em; margin: 0; }
diff --git a/chrome/browser/resources/media_router/media_router_common.css b/chrome/browser/resources/media_router/media_router_common.css index ee07e9d..3006f99 100644 --- a/chrome/browser/resources/media_router/media_router_common.css +++ b/chrome/browser/resources/media_router/media_router_common.css
@@ -8,6 +8,9 @@ --dialog-width: 340px; --navigation-icon-button-size: 36px; --non-navigation-icon-size: 16px; + -webkit-font-smoothing: antialiased; + -webkit-tap-highlight-color: transparent; + font-family: 'Roboto', 'Noto', sans-serif; } .button {
diff --git a/chrome/browser/signin/chromeos_mirror_account_consistency_browsertest.cc b/chrome/browser/signin/chromeos_mirror_account_consistency_browsertest.cc index 52bea883..dbdf3ad 100644 --- a/chrome/browser/signin/chromeos_mirror_account_consistency_browsertest.cc +++ b/chrome/browser/signin/chromeos_mirror_account_consistency_browsertest.cc
@@ -37,6 +37,7 @@ constexpr char kGaiaUrl[] = "https://accounts.google.com"; constexpr char kChromeConnectedHeader[] = "X-Chrome-Connected"; constexpr char kUserEmail[] = "user@gmail.com"; +constexpr char kUserGaiaId[] = "1234567890"; void CheckRequestHeader(net::URLRequest* url_request, const char* header_name, @@ -95,7 +96,7 @@ ChromeOsMirrorAccountConsistencyTest() : LoginManagerTest(false), - account_id_(AccountId::FromUserEmail(kUserEmail)) {} + account_id_(AccountId::FromUserEmailGaiaId(kUserEmail, kUserGaiaId)) {} const AccountId account_id_; @@ -105,7 +106,7 @@ IN_PROC_BROWSER_TEST_F(ChromeOsMirrorAccountConsistencyTest, PRE_TestMirrorRequestChromeOsChildAccount) { - RegisterUser(account_id_.GetUserEmail()); + RegisterUser(account_id_); chromeos::StartupUtils::MarkOobeCompleted(); } @@ -115,7 +116,7 @@ // On Chrome OS this is false. ASSERT_FALSE(signin::IsAccountConsistencyMirrorEnabled()); // Child user. - LoginUser(account_id_.GetUserEmail()); + LoginUser(account_id_); user_manager::User* user = user_manager::UserManager::Get()->GetActiveUser(); ASSERT_EQ(user, user_manager::UserManager::Get()->GetPrimaryUser()); @@ -144,7 +145,7 @@ IN_PROC_BROWSER_TEST_F(ChromeOsMirrorAccountConsistencyTest, PRE_TestMirrorRequestChromeOsNotChildAccount) { - RegisterUser(account_id_.GetUserEmail()); + RegisterUser(account_id_); chromeos::StartupUtils::MarkOobeCompleted(); } @@ -154,7 +155,7 @@ // On Chrome OS this is false. ASSERT_FALSE(signin::IsAccountConsistencyMirrorEnabled()); // Not a child user. - LoginUser(account_id_.GetUserEmail()); + LoginUser(account_id_); user_manager::User* user = user_manager::UserManager::Get()->GetActiveUser(); ASSERT_EQ(user, user_manager::UserManager::Get()->GetPrimaryUser());
diff --git a/chrome/browser/ui/ash/chrome_new_window_client_browsertest.cc b/chrome/browser/ui/ash/chrome_new_window_client_browsertest.cc index ea52ecf..f41e7bf 100644 --- a/chrome/browser/ui/ash/chrome_new_window_client_browsertest.cc +++ b/chrome/browser/ui/ash/chrome_new_window_client_browsertest.cc
@@ -17,8 +17,10 @@ namespace { -const char kTestUserName1[] = "test1@test.com"; -const char kTestUserName2[] = "test2@test.com"; +constexpr char kTestUserName1[] = "test1@test.com"; +constexpr char kTestUser1GaiaId[] = "1111111111"; +constexpr char kTestUserName2[] = "test2@test.com"; +constexpr char kTestUser2GaiaId[] = "2222222222"; void CreateAndStartUserSession(const AccountId& account_id) { using chromeos::ProfileHelper; @@ -45,7 +47,8 @@ // should open a new window. IN_PROC_BROWSER_TEST_F(ChromeNewWindowClientBrowserTest, NewWindowForActiveWindowProfileTest) { - CreateAndStartUserSession(AccountId::FromUserEmail(kTestUserName1)); + CreateAndStartUserSession( + AccountId::FromUserEmailGaiaId(kTestUserName1, kTestUser1GaiaId)); Profile* profile1 = ProfileManager::GetActiveUserProfile(); Browser* browser1 = CreateBrowser(profile1); // The newly created window should be created for the current active profile. @@ -53,7 +56,8 @@ EXPECT_EQ(GetLastActiveBrowser()->profile(), profile1); // Login another user and make sure the current active user changes. - CreateAndStartUserSession(AccountId::FromUserEmail(kTestUserName2)); + CreateAndStartUserSession( + AccountId::FromUserEmailGaiaId(kTestUserName2, kTestUser2GaiaId)); Profile* profile2 = ProfileManager::GetActiveUserProfile(); EXPECT_NE(profile1, profile2); @@ -84,7 +88,8 @@ } IN_PROC_BROWSER_TEST_F(ChromeNewWindowClientBrowserTest, IncognitoDisabled) { - CreateAndStartUserSession(AccountId::FromUserEmail(kTestUserName1)); + CreateAndStartUserSession( + AccountId::FromUserEmailGaiaId(kTestUserName1, kTestUser2GaiaId)); Profile* profile = ProfileManager::GetActiveUserProfile(); EXPECT_EQ(1u, chrome::GetTotalBrowserCount());
diff --git a/chrome/browser/ui/ash/session_controller_client_unittest.cc b/chrome/browser/ui/ash/session_controller_client_unittest.cc index c243c200..966fcf4 100644 --- a/chrome/browser/ui/ash/session_controller_client_unittest.cc +++ b/chrome/browser/ui/ash/session_controller_client_unittest.cc
@@ -42,7 +42,8 @@ namespace { -const char* kUser = "user@test.com"; +constexpr char kUser[] = "user@test.com"; +constexpr char kUserGaiaId[] = "0123456789"; // Weak ptr to PolicyCertVerifier - object is freed in test destructor once // we've ensured the profile has been shut down. @@ -207,12 +208,11 @@ } // Add and log in a user to the session. - void UserAddedToSession(std::string user) { - const AccountId account_id(AccountId::FromUserEmail(user)); + void UserAddedToSession(const AccountId& account_id) { user_manager()->AddUser(account_id); session_manager_.CreateSession( - account_id, - chromeos::ProfileHelper::GetUserIdHashByUserIdForTesting(user)); + account_id, chromeos::ProfileHelper::GetUserIdHashByUserIdForTesting( + account_id.GetUserEmail())); session_manager_.SetSessionState(SessionState::ACTIVE); } @@ -228,7 +228,8 @@ // Adds a regular user with a profile. TestingProfile* InitForMultiProfile() { - const AccountId account_id(AccountId::FromUserEmail(kUser)); + const AccountId account_id( + AccountId::FromUserEmailGaiaId(kUser, kUserGaiaId)); const user_manager::User* user = user_manager()->AddUser(account_id); // Note that user profiles are created after user login in reality. @@ -267,7 +268,8 @@ // Make sure that cycling one user does not cause any harm. TEST_F(SessionControllerClientTest, CyclingOneUser) { - UserAddedToSession("firstuser@test.com"); + UserAddedToSession( + AccountId::FromUserEmailGaiaId("firstuser@test.com", "1111111111")); EXPECT_EQ("firstuser@test.com", GetActiveUserEmail()); SessionControllerClient::DoCycleActiveUser(ash::CycleUserDirection::NEXT); @@ -284,11 +286,16 @@ client.session_controller_ = session_controller.CreateInterfacePtrAndBind(); client.Init(); - UserAddedToSession("firstuser@test.com"); - UserAddedToSession("seconduser@test.com"); - UserAddedToSession("thirduser@test.com"); - user_manager()->SwitchActiveUser( - AccountId::FromUserEmail("firstuser@test.com")); + const AccountId first_user = + AccountId::FromUserEmailGaiaId("firstuser@test.com", "1111111111"); + const AccountId second_user = + AccountId::FromUserEmailGaiaId("seconduser@test.com", "2222222222"); + const AccountId third_user = + AccountId::FromUserEmailGaiaId("thirduser@test.com", "3333333333"); + UserAddedToSession(first_user); + UserAddedToSession(second_user); + UserAddedToSession(third_user); + user_manager()->SwitchActiveUser(first_user); SessionControllerClient::FlushForTesting(); // Cycle forward. @@ -322,12 +329,14 @@ TestingProfile* user_profile = InitForMultiProfile(); EXPECT_EQ(ash::AddUserSessionPolicy::ALLOWED, SessionControllerClient::GetAddUserSessionPolicy()); - const AccountId account_id(AccountId::FromUserEmail(kUser)); + const AccountId account_id( + AccountId::FromUserEmailGaiaId(kUser, kUserGaiaId)); user_manager()->LoginUser(account_id); EXPECT_EQ(ash::AddUserSessionPolicy::ERROR_NO_ELIGIBLE_USERS, SessionControllerClient::GetAddUserSessionPolicy()); - user_manager()->AddUser(AccountId::FromUserEmail("bb@b.b")); + user_manager()->AddUser( + AccountId::FromUserEmailGaiaId("bb@b.b", "4444444444")); EXPECT_EQ(ash::AddUserSessionPolicy::ALLOWED, SessionControllerClient::GetAddUserSessionPolicy()); @@ -342,9 +351,11 @@ TEST_F(SessionControllerClientTest, MultiProfileDisallowedByPolicyCertificates) { InitForMultiProfile(); - user_manager()->AddUser(AccountId::FromUserEmail("bb@b.b")); + user_manager()->AddUser( + AccountId::FromUserEmailGaiaId("bb@b.b", "4444444444")); - const AccountId account_id(AccountId::FromUserEmail(kUser)); + const AccountId account_id( + AccountId::FromUserEmailGaiaId(kUser, kUserGaiaId)); user_manager()->LoginUser(account_id); EXPECT_EQ(ash::AddUserSessionPolicy::ALLOWED, SessionControllerClient::GetAddUserSessionPolicy()); @@ -361,9 +372,11 @@ TEST_F(SessionControllerClientTest, MultiProfileDisallowedByPrimaryUserCertificatesInMemory) { TestingProfile* user_profile = InitForMultiProfile(); - user_manager()->AddUser(AccountId::FromUserEmail("bb@b.b")); + user_manager()->AddUser( + AccountId::FromUserEmailGaiaId("bb@b.b", "4444444444")); - const AccountId account_id(AccountId::FromUserEmail(kUser)); + const AccountId account_id( + AccountId::FromUserEmailGaiaId(kUser, kUserGaiaId)); user_manager()->LoginUser(account_id); EXPECT_EQ(ash::AddUserSessionPolicy::ALLOWED, SessionControllerClient::GetAddUserSessionPolicy()); @@ -397,11 +410,11 @@ EXPECT_EQ(ash::AddUserSessionPolicy::ALLOWED, SessionControllerClient::GetAddUserSessionPolicy()); - AccountId account_id(AccountId::FromUserEmail(kUser)); + AccountId account_id(AccountId::FromUserEmailGaiaId(kUser, kUserGaiaId)); user_manager()->LoginUser(account_id); while (user_manager()->GetLoggedInUsers().size() < session_manager::kMaximumNumberOfUserSessions) { - account_id = AccountId::FromUserEmail("bb@b.b"); + account_id = AccountId::FromUserEmailGaiaId("bb@b.b", "4444444444"); user_manager()->AddUser(account_id); user_manager()->LoginUser(account_id); } @@ -417,9 +430,10 @@ EXPECT_EQ(ash::AddUserSessionPolicy::ALLOWED, SessionControllerClient::GetAddUserSessionPolicy()); - const AccountId account_id(AccountId::FromUserEmail(kUser)); + const AccountId account_id( + AccountId::FromUserEmailGaiaId(kUser, kUserGaiaId)); user_manager()->LoginUser(account_id); - UserAddedToSession("bb@b.b"); + UserAddedToSession(AccountId::FromUserEmailGaiaId("bb@b.b", "4444444444")); EXPECT_EQ(ash::AddUserSessionPolicy::ERROR_NO_ELIGIBLE_USERS, SessionControllerClient::GetAddUserSessionPolicy()); } @@ -431,12 +445,14 @@ EXPECT_EQ(ash::AddUserSessionPolicy::ALLOWED, SessionControllerClient::GetAddUserSessionPolicy()); - const AccountId account_id(AccountId::FromUserEmail(kUser)); + const AccountId account_id( + AccountId::FromUserEmailGaiaId(kUser, kUserGaiaId)); user_manager()->LoginUser(account_id); user_profile->GetPrefs()->SetString( prefs::kMultiProfileUserBehavior, chromeos::MultiProfileUserController::kBehaviorNotAllowed); - user_manager()->AddUser(AccountId::FromUserEmail("bb@b.b")); + user_manager()->AddUser( + AccountId::FromUserEmailGaiaId("bb@b.b", "4444444444")); EXPECT_EQ(ash::AddUserSessionPolicy::ERROR_NOT_ALLOWED_PRIMARY_USER, SessionControllerClient::GetAddUserSessionPolicy()); } @@ -453,11 +469,12 @@ EXPECT_EQ(0, session_controller.update_user_session_count()); // Simulate login. - const AccountId account_id(AccountId::FromUserEmail("user@test.com")); + const AccountId account_id( + AccountId::FromUserEmailGaiaId("user@test.com", "5555555555")); user_manager()->AddUser(account_id); session_manager_.CreateSession( account_id, chromeos::ProfileHelper::GetUserIdHashByUserIdForTesting( - "user@test.com")); + account_id.GetUserEmail())); session_manager_.SetSessionState(SessionState::ACTIVE); SessionControllerClient::FlushForTesting(); @@ -542,11 +559,12 @@ SessionControllerClient::FlushForTesting(); // Simulate login. - const AccountId account_id(AccountId::FromUserEmail("user@test.com")); + const AccountId account_id( + AccountId::FromUserEmailGaiaId("user@test.com", "5555555555")); const user_manager::User* user = user_manager()->AddUser(account_id); session_manager_.CreateSession( account_id, chromeos::ProfileHelper::GetUserIdHashByUserIdForTesting( - "user@test.com")); + account_id.GetUserEmail())); session_manager_.SetSessionState(SessionState::ACTIVE); SessionControllerClient::FlushForTesting();
diff --git a/chrome/browser/ui/ash/system_tray_client_browsertest.cc b/chrome/browser/ui/ash/system_tray_client_browsertest.cc index 51144ba1..38753ea7 100644 --- a/chrome/browser/ui/ash/system_tray_client_browsertest.cc +++ b/chrome/browser/ui/ash/system_tray_client_browsertest.cc
@@ -167,8 +167,10 @@ SystemTrayClientClockTest() : LoginManagerTest(false /* should_launch_browser */), // Use consumer emails to avoid having to fake a policy fetch. - account_id1_(AccountId::FromUserEmail("user1@gmail.com")), - account_id2_(AccountId::FromUserEmail("user2@gmail.com")) {} + account_id1_( + AccountId::FromUserEmailGaiaId("user1@gmail.com", "1111111111")), + account_id2_( + AccountId::FromUserEmailGaiaId("user2@gmail.com", "2222222222")) {} ~SystemTrayClientClockTest() override = default; @@ -190,8 +192,8 @@ IN_PROC_BROWSER_TEST_F(SystemTrayClientClockTest, PRE_TestMultiProfile24HourClock) { - RegisterUser(account_id1_.GetUserEmail()); - RegisterUser(account_id2_.GetUserEmail()); + RegisterUser(account_id1_); + RegisterUser(account_id2_); chromeos::StartupUtils::MarkOobeCompleted(); } @@ -205,7 +207,7 @@ ash::mojom::SystemTrayTestApiAsyncWaiter wait_for(tray_test_api.get()); // Login a user with a 24-hour clock. - LoginUser(account_id1_.GetUserEmail()); + LoginUser(account_id1_); SetupUserProfile(account_id1_, true /* use_24_hour_clock */); bool is_24_hour = false; wait_for.Is24HourClock(&is_24_hour); @@ -214,7 +216,7 @@ // Add a user with a 12-hour clock. chromeos::UserAddingScreen::Get()->Start(); content::RunAllPendingInMessageLoop(); - AddUser(account_id2_.GetUserEmail()); + AddUser(account_id2_); SetupUserProfile(account_id2_, false /* use_24_hour_clock */); wait_for.Is24HourClock(&is_24_hour); EXPECT_FALSE(is_24_hour);
diff --git a/chrome/browser/ui/webui/media_router/media_router_localized_strings_provider.cc b/chrome/browser/ui/webui/media_router/media_router_localized_strings_provider.cc index 0f5892d..f709b87 100644 --- a/chrome/browser/ui/webui/media_router/media_router_localized_strings_provider.cc +++ b/chrome/browser/ui/webui/media_router/media_router_localized_strings_provider.cc
@@ -62,6 +62,15 @@ html_source->AddLocalizedString( "alwaysUseMirroringTitle", IDS_MEDIA_ROUTER_ROUTE_DETAILS_ALWAYS_USE_MIRRORING_TITLE); + html_source->AddLocalizedString( + "fullscreenVideosDropdownTitle", + IDS_MEDIA_ROUTER_ROUTE_DETAILS_FULLSCREEN_VIDEOS_DROPDOWN_TITLE); + html_source->AddLocalizedString( + "fullscreenVideosRemoteScreen", + IDS_MEDIA_ROUTER_ROUTE_DETAILS_FULLSCREEN_VIDEOS_REMOTE_SCREEN); + html_source->AddLocalizedString( + "fullscreenVideosBothScreens", + IDS_MEDIA_ROUTER_ROUTE_DETAILS_FULLSCREEN_VIDEOS_BOTH_SCREENS); } void AddIssuesStrings(content::WebUIDataSource* html_source) {
diff --git a/chrome/test/data/webui/media_router/route_controls_tests.js b/chrome/test/data/webui/media_router/route_controls_tests.js index c681514..f221dd08 100644 --- a/chrome/test/data/webui/media_router/route_controls_tests.js +++ b/chrome/test/data/webui/media_router/route_controls_tests.js
@@ -273,24 +273,29 @@ }); test('set media remoting enabled', function(done) { - assertElementHidden('media-remoting-enabled-controls'); + assertElementHidden('mirroring-fullscreen-video-controls'); let routeStatus = createRouteStatus(); controls.routeStatus = routeStatus; - assertElementHidden('media-remoting-enabled-controls'); + assertElementHidden('mirroring-fullscreen-video-controls'); routeStatus = createRouteStatus(); routeStatus.mirroringExtraData = {mediaRemotingEnabled: true}; controls.routeStatus = routeStatus; - assertElementShown('media-remoting-enabled-controls'); - assertFalse(controls.$$('#always-use-mirroring-checkbox').checked); + assertElementShown('mirroring-fullscreen-video-controls'); + assertEquals(controls.FullscreenVideoOption_.REMOTE_SCREEN, + controls.$$('#mirroring-fullscreen-video-dropdown').value); document.addEventListener('mock-set-media-remoting-enabled', function(e) { + assertFalse(e.detail.enabled); done(); }); - MockInteractions.tap(controls.$$('#always-use-mirroring-checkbox')); - assertTrue(controls.$$('#always-use-mirroring-checkbox').checked); + // Simulate changing the dropdown menu value. + controls.$$('#mirroring-fullscreen-video-dropdown').value = + controls.FullscreenVideoOption_.BOTH_SCREENS; + controls.$$('#mirroring-fullscreen-video-dropdown').dispatchEvent( + new Event('change')); }); test('hangouts local present mode', function(done) {
diff --git a/components/arc/arc_session_impl_unittest.cc b/components/arc/arc_session_impl_unittest.cc index 93b5515b..d9e7133e 100644 --- a/components/arc/arc_session_impl_unittest.cc +++ b/components/arc/arc_session_impl_unittest.cc
@@ -27,6 +27,7 @@ namespace { constexpr char kFakeGmail[] = "user@gmail.com"; +constexpr char kFakeGmailGaiaId[] = "1234567890"; class FakeDelegate : public ArcSessionImpl::Delegate { public: @@ -127,13 +128,15 @@ GetSessionManagerClient()->set_arc_available(true); // Create a user and set it as the primary user. - const AccountId account_id = AccountId::FromUserEmail(kFakeGmail); + const AccountId account_id = + AccountId::FromUserEmailGaiaId(kFakeGmail, kFakeGmailGaiaId); const user_manager::User* user = GetUserManager()->AddUser(account_id); GetUserManager()->UserLoggedIn(account_id, user->username_hash(), false); } ~ArcSessionImplTest() override { - GetUserManager()->RemoveUserFromList(AccountId::FromUserEmail(kFakeGmail)); + GetUserManager()->RemoveUserFromList( + AccountId::FromUserEmailGaiaId(kFakeGmail, kFakeGmailGaiaId)); chromeos::DBusThreadManager::Shutdown(); }
diff --git a/components/arc/arc_util_unittest.cc b/components/arc/arc_util_unittest.cc index c739f35..e653428 100644 --- a/components/arc/arc_util_unittest.cc +++ b/components/arc/arc_util_unittest.cc
@@ -47,7 +47,7 @@ class FakeUser : public user_manager::User { public: explicit FakeUser(user_manager::UserType user_type) - : User(AccountId::FromUserEmail("user@test.com")), + : User(AccountId::FromUserEmailGaiaId("user@test.com", "1234567890")), user_type_(user_type) {} ~FakeUser() override = default; @@ -210,8 +210,9 @@ // An ephemeral user is a logged in user but unknown to UserManager when // ephemeral policy is set. fake_user_manager->SetEphemeralUsersEnabled(true); - fake_user_manager->UserLoggedIn(AccountId::FromUserEmail("test@test.com"), - "test@test.com-hash", false); + fake_user_manager->UserLoggedIn( + AccountId::FromUserEmailGaiaId("test@test.com", "9876543210"), + "test@test.com-hash", false); const user_manager::User* ephemeral_user = fake_user_manager->GetActiveUser(); ASSERT_TRUE(ephemeral_user); ASSERT_TRUE(fake_user_manager->IsUserCryptohomeDataEphemeral(
diff --git a/components/user_manager/known_user.cc b/components/user_manager/known_user.cc index 5e0a156..8763f42 100644 --- a/components/user_manager/known_user.cc +++ b/components/user_manager/known_user.cc
@@ -526,8 +526,20 @@ } // Exported so tests can call this from other components. -void RemovePrefsForTesting(const AccountId& account_id) { - RemovePrefs(account_id); +void RemoveSetProfileEverInitializedPrefForTesting( + const AccountId& account_id) { + const base::DictionaryValue* prefs = nullptr; + if (!FindPrefs(account_id, &prefs)) + return; + + if (!prefs->HasKey(kProfileEverInitialized)) + return; + + std::unique_ptr<base::DictionaryValue> new_prefs(prefs->CreateDeepCopy()); + if (!new_prefs->RemoveKey(kProfileEverInitialized)) + return; + + UpdatePrefs(account_id, *new_prefs, true); } void RegisterPrefs(PrefRegistrySimple* registry) {
diff --git a/components/user_manager/known_user.h b/components/user_manager/known_user.h index 22d9c4bf..3c3473d 100644 --- a/components/user_manager/known_user.h +++ b/components/user_manager/known_user.h
@@ -159,9 +159,11 @@ // Removes all user preferences associated with |account_id|. // Not exported as code should not be calling this outside this component -// (with the exception of tests, so a test-only API is exposed). void RemovePrefs(const AccountId& account_id); -void USER_MANAGER_EXPORT RemovePrefsForTesting(const AccountId& account_id); + +// Clears kProfileEverInitialized for a user. +void USER_MANAGER_EXPORT +RemoveSetProfileEverInitializedPrefForTesting(const AccountId& account_id); // Register known user prefs. void USER_MANAGER_EXPORT RegisterPrefs(PrefRegistrySimple* registry);
diff --git a/net/http/http_stream_factory_impl_job_controller_unittest.cc b/net/http/http_stream_factory_impl_job_controller_unittest.cc index 5553121..df7a00d 100644 --- a/net/http/http_stream_factory_impl_job_controller_unittest.cc +++ b/net/http/http_stream_factory_impl_job_controller_unittest.cc
@@ -1507,6 +1507,11 @@ EXPECT_TRUE(job_controller_->main_job()); request_.reset(); + // Reset task environment back to the default type. + // TODO(xunjieli): Remove this temporary workaround once crbug.com/791831 is + // fixed. + NetTestSuite::SetScopedTaskEnvironment( + base::test::ScopedTaskEnvironment::MainThreadType::IO); } // Test that main job is blocked for kMaxDelayTimeForMainJob(3s) if
diff --git a/third_party/WebKit/LayoutTests/fast/harness/results.html b/third_party/WebKit/LayoutTests/fast/harness/results.html index 5d22946..71188ab 100644 --- a/third_party/WebKit/LayoutTests/fast/harness/results.html +++ b/third_party/WebKit/LayoutTests/fast/harness/results.html
@@ -272,9 +272,9 @@ <div id="dashboard"> <div> <span class="fix-width">Query</span> - <button id="button_unexpected_fail" onclick="javascript:Query.query('Unexpected failures', Filters.unexpectedFailure, true)"> - Unexpected Failure - <span id="count_unexpected_fail"></span> + <button id="button_regressions" onclick="javascript:Query.query('Regressions', Filters.regression, true)"> + Regressions + <span id="count_regressions"></span> </button> <button onclick="javascript:Query.query('Unexpected passes', Filters.unexpectedPass, true)"> Unexpected Pass @@ -400,8 +400,7 @@ this.resultCounts[node.actualFinal]++; action(node, path, this); } - } - else { + } else { for (let p of node.keys()) this._helper(node.get(p), path + "/" + p, filter, action); } @@ -416,11 +415,10 @@ class PathParser { constructor(path) { this.path = path; - let [href, dir, file] = path.match("/(.*)/(.*)"); - this.dir = dir; - this.file = file; - let tmp; - [tmp, this.basename, this.extension] = file.match(/(.*)\.(\w+)/); + let href; + [href, this.dir, this.file] = path.match("/(.*/)?(.*)"); + this.dir = this.dir || ""; + [, this.basename, this.extension] = this.file.match(/(.*)\.(\w+)/); this.testHref = this.testBaseHref() + href.replace(/\/virtual\/[^\/]*/, ""); } @@ -430,7 +428,7 @@ } resultLink(resultName) { - return this.dir + "/" + this.basename + resultName; + return this.dir + this.basename + resultName; } repaintOverlayLink() { @@ -485,7 +483,7 @@ let html = ` <div class='expect' tabindex='0' data-id='${test.expectId}'> <div class='details'></div>${Report.printFlag(test)} - ${pathParser.dir}/<a target='test' tabindex='-1' href='${pathParser.testHref}'>${pathParser.file}</a> + ${pathParser.dir}<a target='test' tabindex='-1' href='${pathParser.testHref}'>${pathParser.file}</a> </div>`; traversal.html.push(html); }, @@ -541,7 +539,7 @@ let key = test[key_title]; let html = "" + `${Report.printFlag(test)}` - + pathParser.dir + "/" + + pathParser.dir + "<a target='test' tabindex='-1' href='" + pathParser.testHref + "'>" + pathParser.file + "</a>"; html = "<div class='expect' tabindex='0' data-id='"+ test.expectId +"'><div class='details'></div>" + html + "</div>"; @@ -851,7 +849,7 @@ unexpectedPass: test => { return !Filters.containsPass(test.expectedMap) && Filters.containsPass(test.actualMap); }, - unexpectedFailure: test => { + regression: test => { if (Filters.containsPass(test.actualMap)) return false; if (test.expectedMap.has("NEEDSMANUALREBASELINE") @@ -873,7 +871,7 @@ return false; break; case "MISSING": - return false; + break; default: console.error("Unexpected test result", est.actualMap.keys().next().value); } @@ -903,8 +901,8 @@ GUI.printSummary(globalResults); GUI.initEvents(); PathParser.initGlobals(results); - // Show unexpected failures on startup. - document.querySelector("#button_unexpected_fail").click(); + // Show regressions on startup. + document.querySelector("#button_regressions").click(); }, convertToMap: function(o) { @@ -1146,7 +1144,7 @@ let singleLine = ""; new Traversal(globalResults.tests).traverse(Query.lastReport.filter, (_, path) => { let pathParser = new PathParser(path); - singleLine += pathParser.dir + "/" + pathParser.file + " "; + singleLine += pathParser.dir + pathParser.file + " "; }); let pre = document.createElement("pre"); pre.setAttribute("style", "overflow: hidden; color: white; height: 1px"); @@ -1174,7 +1172,7 @@ // Initialize query counts. let counts = { "count_unexpected_pass": 0, - "count_unexpected_fail": 0, + "count_regressions": 0, "count_testexpectations": 0, "count_flaky": 0, "count_all": 0, @@ -1184,13 +1182,17 @@ counts.count_all++; if (Filters.unexpectedPass(test)) counts.count_unexpected_pass++; - if (Filters.unexpectedFailure(test)) - counts.count_unexpected_fail++; + if (Filters.regression(test)) + counts.count_regressions++; if (Filters.notpass(test)) counts.count_testexpectations++; if (Filters.flaky(test)) counts.count_flaky++; }); + console.assert( + counts.count_regressions == fullResults.num_regressions, + "Numbers of regressions mismatch: in fullResult:" + fullResults.num_regressions + + " filtered:" + counts.count_regressions); for (let p in counts) document.querySelector("#" + p).innerText = counts[p];
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp index d917bde..998281d 100644 --- a/third_party/WebKit/Source/core/dom/Document.cpp +++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -6250,13 +6250,9 @@ void Document::EnforceSandboxFlags(SandboxFlags mask) { scoped_refptr<SecurityOrigin> stand_in_origin = GetSecurityOrigin(); - ApplySandboxFlags(mask); - // Send a notification if the origin has been updated. - if (stand_in_origin && !stand_in_origin->IsUnique() && - GetSecurityOrigin()->IsUnique()) { - GetSecurityOrigin()->SetUniqueOriginIsPotentiallyTrustworthy( - stand_in_origin->IsPotentiallyTrustworthy()); - } + bool is_potentially_trustworthy = + stand_in_origin && stand_in_origin->IsPotentiallyTrustworthy(); + ApplySandboxFlags(mask, is_potentially_trustworthy); } void Document::UpdateSecurityOrigin(scoped_refptr<SecurityOrigin> origin) {
diff --git a/third_party/WebKit/Source/core/dom/SecurityContext.cpp b/third_party/WebKit/Source/core/dom/SecurityContext.cpp index 7816b2bb6..f59b4c3 100644 --- a/third_party/WebKit/Source/core/dom/SecurityContext.cpp +++ b/third_party/WebKit/Source/core/dom/SecurityContext.cpp
@@ -61,12 +61,17 @@ ApplySandboxFlags(mask); } -void SecurityContext::ApplySandboxFlags(SandboxFlags mask) { +void SecurityContext::ApplySandboxFlags(SandboxFlags mask, + bool is_potentially_trustworthy) { sandbox_flags_ |= mask; if (IsSandboxed(kSandboxOrigin) && GetSecurityOrigin() && !GetSecurityOrigin()->IsUnique()) { - SetSecurityOrigin(SecurityOrigin::CreateUnique()); + scoped_refptr<SecurityOrigin> security_origin = + SecurityOrigin::CreateUnique(); + security_origin->SetUniqueOriginIsPotentiallyTrustworthy( + is_potentially_trustworthy); + SetSecurityOrigin(std::move(security_origin)); DidUpdateSecurityOrigin(); } }
diff --git a/third_party/WebKit/Source/core/dom/SecurityContext.h b/third_party/WebKit/Source/core/dom/SecurityContext.h index e9b7e12a..d6febff 100644 --- a/third_party/WebKit/Source/core/dom/SecurityContext.h +++ b/third_party/WebKit/Source/core/dom/SecurityContext.h
@@ -102,7 +102,10 @@ const FeaturePolicy* parent_feature_policy); void UpdateFeaturePolicyOrigin(); - void ApplySandboxFlags(SandboxFlags mask); + // Apply the sandbox flag, and also maybe update the security origin + // to the newly created unique one with |is_potentially_trustworthy|. + void ApplySandboxFlags(SandboxFlags mask, + bool is_potentially_trustworthy = false); protected: SecurityContext();
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index b908abf..abfe457 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -31661,6 +31661,9 @@ <int value="0" label="None"/> <int value="1" label="Minimal"/> <int value="2" label="All"/> + <int value="3" label="Browser"/> + <int value="4" label="Gpu"/> + <int value="5" label="Renderer Sampling"/> </enum> <enum name="OutOfProcessHeapProfilingProcessType">
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index ddc42c84..b2811b30 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -55929,6 +55929,23 @@ </summary> </histogram> +<histogram name="OutOfProcessHeapProfiling.RecordTrace.Success" + enum="BooleanSuccess"> + <owner>erikchen@chromium.org</owner> + <summary> + The metric is emitted each time Chrome attempts to record a memory-infra + trace to upload an out-of-process heap-profiling memory dump. + </summary> +</histogram> + +<histogram name="OutOfProcessHeapProfiling.UploadTrace.Size" units="bytes"> + <owner>erikchen@chromium.org</owner> + <summary> + The metric is emitted each time Chrome uploads a trace. It reflects the + uncompressed size of the trace. + </summary> +</histogram> + <histogram name="Overscroll.Cancelled" enum="NavigationDirection"> <obsolete> Deprecated as of Chrome 59 in favour of Overscroll.Cancelled3.