Index: chrome/browser/ui/webui/local_discovery/local_discovery_ui_browsertest.cc |
diff --git a/chrome/browser/ui/webui/local_discovery/local_discovery_ui_browsertest.cc b/chrome/browser/ui/webui/local_discovery/local_discovery_ui_browsertest.cc |
index 64733b64c4d640928fd604aae82c81643c0fa924..0dcba841b281376fa47fecc13bdc95490a93b926 100644 |
--- a/chrome/browser/ui/webui/local_discovery/local_discovery_ui_browsertest.cc |
+++ b/chrome/browser/ui/webui/local_discovery/local_discovery_ui_browsertest.cc |
@@ -15,10 +15,12 @@ |
#include "chrome/browser/signin/signin_manager_factory.h" |
#include "chrome/browser/ui/browser.h" |
#include "chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.h" |
+#include "chrome/common/chrome_constants.h" |
#include "chrome/common/chrome_switches.h" |
#include "chrome/common/url_constants.h" |
#include "chrome/test/base/ui_test_utils.h" |
#include "chrome/test/base/web_ui_browser_test.h" |
+#include "chromeos/chromeos_switches.h" |
#include "components/signin/core/browser/profile_oauth2_token_service.h" |
#include "components/signin/core/browser/signin_manager.h" |
#include "components/signin/core/browser/signin_manager_base.h" |
@@ -361,12 +363,6 @@ class LocalDiscoveryUITest : public WebUIBrowserTest { |
SigninManagerBase* signin_manager = |
SigninManagerFactory::GetForProfile(browser()->profile()); |
-#if defined(OS_CHROMEOS) |
- // Chrome OS initializes prefs::kGoogleServicesUsername to "stub user" so |
- // we need to override it as well. |
- browser()->profile()->GetPrefs()-> |
- SetString(prefs::kGoogleServicesUsername, kSampleUser); |
-#endif |
DCHECK(signin_manager); |
signin_manager->SetAuthenticatedUsername(kSampleUser); |
@@ -429,6 +425,14 @@ class LocalDiscoveryUITest : public WebUIBrowserTest { |
} |
virtual void SetUpCommandLine(CommandLine* command_line) override { |
+#if defined(OS_CHROMEOS) |
+ // On chromeos, don't sign in with the stub-user automatically. Use the |
+ // kLoginUser instead. |
+ command_line->AppendSwitchASCII(chromeos::switches::kLoginUser, |
+ kSampleUser); |
+ command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, |
+ chrome::kTestUserProfileDir); |
+#endif |
WebUIBrowserTest::SetUpCommandLine(command_line); |
} |