Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "chrome/browser/chromeos/login/login_manager_test.h" | 8 #include "chrome/browser/chromeos/login/login_manager_test.h" |
| 9 #include "chrome/browser/chromeos/login/startup_utils.h" | 9 #include "chrome/browser/chromeos/login/startup_utils.h" |
| 10 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" | 10 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" |
| 11 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 11 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 12 #include "chrome/browser/chromeos/settings/cros_settings.h" | 12 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 13 #include "chrome/browser/chromeos/settings/stub_cros_settings_provider.h" | 13 #include "chrome/browser/chromeos/settings/stub_cros_settings_provider.h" |
| 14 #include "chrome/browser/signin/signin_manager_factory.h" | |
| 14 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
| 15 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 16 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 16 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
| 17 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
| 18 #include "chrome/test/base/ui_test_utils.h" | 19 #include "chrome/test/base/ui_test_utils.h" |
| 19 #include "chromeos/settings/cros_settings_names.h" | 20 #include "chromeos/settings/cros_settings_names.h" |
| 21 #include "components/signin/core/browser/signin_manager.h" | |
| 20 #include "components/user_manager/user_manager.h" | 22 #include "components/user_manager/user_manager.h" |
| 21 #include "content/public/browser/web_contents.h" | 23 #include "content/public/browser/web_contents.h" |
| 22 #include "content/public/test/browser_test_utils.h" | 24 #include "content/public/test/browser_test_utils.h" |
| 23 #include "content/public/test/test_utils.h" | 25 #include "content/public/test/test_utils.h" |
| 24 | 26 |
| 25 namespace chromeos { | 27 namespace chromeos { |
| 26 | 28 |
| 27 namespace { | 29 namespace { |
| 28 | 30 |
| 29 const char* kTestUsers[] = { "test-user1@gmail.com", "test-user2@gmail.com" }; | 31 const char* kTestUsers[] = { "test-user1@gmail.com", "test-user2@gmail.com" }; |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 56 LoginManagerTest::TearDownOnMainThread(); | 58 LoginManagerTest::TearDownOnMainThread(); |
| 57 } | 59 } |
| 58 | 60 |
| 59 virtual void SetUpCommandLine(CommandLine* command_line) override { | 61 virtual void SetUpCommandLine(CommandLine* command_line) override { |
| 60 LoginManagerTest::SetUpCommandLine(command_line); | 62 LoginManagerTest::SetUpCommandLine(command_line); |
| 61 } | 63 } |
| 62 | 64 |
| 63 protected: | 65 protected: |
| 64 void CheckAccountsUI(const user_manager::User* user, bool is_owner) { | 66 void CheckAccountsUI(const user_manager::User* user, bool is_owner) { |
| 65 Profile* profile = ProfileHelper::Get()->GetProfileByUserUnsafe(user); | 67 Profile* profile = ProfileHelper::Get()->GetProfileByUserUnsafe(user); |
| 66 profile->GetPrefs()->SetString(prefs::kGoogleServicesUsername, | 68 SigninManagerFactory::GetForProfile(profile)-> |
| 67 user->email()); | 69 SetAuthenticatedUsername(user->email()); |
|
xiyuan
2014/12/04 19:02:29
I am not sure why we need to do this explicitly. L
Roger Tawa OOO till Jul 10th
2014/12/04 22:26:47
Yup, you are correct. No need to set authenticated
| |
| 68 | 70 |
| 69 ui_test_utils::BrowserAddedObserver observer; | 71 ui_test_utils::BrowserAddedObserver observer; |
| 70 Browser* browser = CreateBrowser(profile); | 72 Browser* browser = CreateBrowser(profile); |
| 71 observer.WaitForSingleNewBrowser(); | 73 observer.WaitForSingleNewBrowser(); |
| 72 | 74 |
| 73 ui_test_utils::NavigateToURL(browser, | 75 ui_test_utils::NavigateToURL(browser, |
| 74 GURL("chrome://settings-frame/accounts")); | 76 GURL("chrome://settings-frame/accounts")); |
| 75 content::WebContents* contents = | 77 content::WebContents* contents = |
| 76 browser->tab_strip_model()->GetActiveWebContents(); | 78 browser->tab_strip_model()->GetActiveWebContents(); |
| 77 | 79 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 137 AddUser(kTestUsers[1]); | 139 AddUser(kTestUsers[1]); |
| 138 | 140 |
| 139 user_manager::UserManager* manager = user_manager::UserManager::Get(); | 141 user_manager::UserManager* manager = user_manager::UserManager::Get(); |
| 140 ASSERT_EQ(2u, manager->GetLoggedInUsers().size()); | 142 ASSERT_EQ(2u, manager->GetLoggedInUsers().size()); |
| 141 | 143 |
| 142 CheckAccountsUI(manager->FindUser(kTestUsers[0]), true /* is_owner */); | 144 CheckAccountsUI(manager->FindUser(kTestUsers[0]), true /* is_owner */); |
| 143 CheckAccountsUI(manager->FindUser(kTestUsers[1]), false /* is_owner */); | 145 CheckAccountsUI(manager->FindUser(kTestUsers[1]), false /* is_owner */); |
| 144 } | 146 } |
| 145 | 147 |
| 146 } // namespace chromeos | 148 } // namespace chromeos |
| OLD | NEW |