Commit 0254b569 authored by bartfab@chromium.org's avatar bartfab@chromium.org

Do not set kGoogleServicesUsername for device-local accounts

The kGoogleServicesUsername pref indicates that Chrome is signed in with a
GAIA account. Since device-local accounts do not have GAIA credentials,
this pref should not be set for them.

BUG=327849
TEST=Extended browser tests

Review URL: https://codereview.chromium.org/251703004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@266529 0039d316-1c4b-4281-b951-d872f2087c98
parent de1e8a41
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include "chrome/browser/chromeos/login/login_wizard.h" #include "chrome/browser/chromeos/login/login_wizard.h"
#include "chrome/browser/chromeos/login/screen_locker.h" #include "chrome/browser/chromeos/login/screen_locker.h"
#include "chrome/browser/chromeos/login/startup_utils.h" #include "chrome/browser/chromeos/login/startup_utils.h"
#include "chrome/browser/chromeos/login/user.h"
#include "chrome/browser/chromeos/login/user_manager.h" #include "chrome/browser/chromeos/login/user_manager.h"
#include "chrome/browser/chromeos/login/wallpaper_manager.h" #include "chrome/browser/chromeos/login/wallpaper_manager.h"
#include "chrome/browser/chromeos/login/wizard_controller.h" #include "chrome/browser/chromeos/login/wizard_controller.h"
...@@ -52,6 +53,7 @@ ...@@ -52,6 +53,7 @@
#include "chrome/browser/chromeos/net/network_portal_detector.h" #include "chrome/browser/chromeos/net/network_portal_detector.h"
#include "chrome/browser/chromeos/options/cert_library.h" #include "chrome/browser/chromeos/options/cert_library.h"
#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
#include "chrome/browser/chromeos/policy/device_local_account.h"
#include "chrome/browser/chromeos/power/idle_action_warning_observer.h" #include "chrome/browser/chromeos/power/idle_action_warning_observer.h"
#include "chrome/browser/chromeos/power/peripheral_battery_observer.h" #include "chrome/browser/chromeos/power/peripheral_battery_observer.h"
#include "chrome/browser/chromeos/power/power_button_observer.h" #include "chrome/browser/chromeos/power/power_button_observer.h"
...@@ -163,10 +165,13 @@ class StubLogin : public LoginStatusConsumer, ...@@ -163,10 +165,13 @@ class StubLogin : public LoginStatusConsumer,
// LoginUtils::Delegate implementation: // LoginUtils::Delegate implementation:
virtual void OnProfilePrepared(Profile* profile) OVERRIDE { virtual void OnProfilePrepared(Profile* profile) OVERRIDE {
std::string login_user = const std::string login_user =
CommandLine::ForCurrentProcess()->GetSwitchValueASCII( CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
chromeos::switches::kLoginUser); chromeos::switches::kLoginUser);
profile->GetPrefs()->SetString(prefs::kGoogleServicesUsername, login_user); if (!policy::IsDeviceLocalAccountUser(login_user, NULL)) {
profile->GetPrefs()->SetString(prefs::kGoogleServicesUsername,
login_user);
}
profile_prepared_ = true; profile_prepared_ = true;
LoginUtils::Get()->DoBrowserLaunch(profile, NULL); LoginUtils::Get()->DoBrowserLaunch(profile, NULL);
delete this; delete this;
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "ash/shell.h" #include "ash/shell.h"
#include "base/file_util.h" #include "base/file_util.h"
#include "base/path_service.h" #include "base/path_service.h"
#include "base/prefs/pref_service.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
...@@ -38,6 +39,7 @@ ...@@ -38,6 +39,7 @@
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
#include "chromeos/chromeos_switches.h" #include "chromeos/chromeos_switches.h"
#include "chromeos/dbus/cryptohome_client.h" #include "chromeos/dbus/cryptohome_client.h"
#include "components/signin/core/common/signin_pref_names.h"
#include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_registrar.h"
#include "content/public/browser/notification_service.h" #include "content/public/browser/notification_service.h"
...@@ -540,6 +542,18 @@ IN_PROC_BROWSER_TEST_F(KioskTest, InstallAndLaunchApp) { ...@@ -540,6 +542,18 @@ IN_PROC_BROWSER_TEST_F(KioskTest, InstallAndLaunchApp) {
WaitForAppLaunchSuccess(); WaitForAppLaunchSuccess();
} }
IN_PROC_BROWSER_TEST_F(KioskTest, NotSignedInWithGAIAAccount) {
// Tests that the kiosk session is not considered to be logged in with a GAIA
// account.
StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure());
WaitForAppLaunchSuccess();
Profile* app_profile = ProfileManager::GetPrimaryUserProfile();
ASSERT_TRUE(app_profile);
EXPECT_FALSE(app_profile->GetPrefs()->HasPrefPath(
prefs::kGoogleServicesUsername));
}
IN_PROC_BROWSER_TEST_F(KioskTest, PRE_LaunchAppNetworkDown) { IN_PROC_BROWSER_TEST_F(KioskTest, PRE_LaunchAppNetworkDown) {
// Tests the network down case for the initial app download and launch. // Tests the network down case for the initial app download and launch.
RunAppLaunchNetworkDownTest(); RunAppLaunchNetworkDownTest();
...@@ -1203,6 +1217,13 @@ IN_PROC_BROWSER_TEST_F(KioskEnterpriseTest, EnterpriseKioskApp) { ...@@ -1203,6 +1217,13 @@ IN_PROC_BROWSER_TEST_F(KioskEnterpriseTest, EnterpriseKioskApp) {
&result)); &result));
EXPECT_EQ(kTestAccessToken, result); EXPECT_EQ(kTestAccessToken, result);
// Verify that the session is not considered to be logged in with a GAIA
// account.
Profile* app_profile = ProfileManager::GetPrimaryUserProfile();
ASSERT_TRUE(app_profile);
EXPECT_FALSE(app_profile->GetPrefs()->HasPrefPath(
prefs::kGoogleServicesUsername));
// Terminate the app. // Terminate the app.
window->GetBaseWindow()->Close(); window->GetBaseWindow()->Close();
content::RunAllPendingInMessageLoop(); content::RunAllPendingInMessageLoop();
......
...@@ -465,7 +465,7 @@ void LoginUtilsImpl::InitProfilePreferences(Profile* user_profile, ...@@ -465,7 +465,7 @@ void LoginUtilsImpl::InitProfilePreferences(Profile* user_profile,
user_profile->GetPrefs()->SetString(prefs::kManagedUserId, user_profile->GetPrefs()->SetString(prefs::kManagedUserId,
managed_user_sync_id); managed_user_sync_id);
} else { } else if (UserManager::Get()->IsLoggedInAsRegularUser()) {
// Make sure that the google service username is properly set (we do this // Make sure that the google service username is properly set (we do this
// on every sign in, not just the first login, to deal with existing // on every sign in, not just the first login, to deal with existing
// profiles that might not have it set yet). // profiles that might not have it set yet).
......
...@@ -91,6 +91,7 @@ ...@@ -91,6 +91,7 @@
#include "components/policy/core/common/policy_namespace.h" #include "components/policy/core/common/policy_namespace.h"
#include "components/policy/core/common/policy_service.h" #include "components/policy/core/common/policy_service.h"
#include "components/policy/core/common/policy_switches.h" #include "components/policy/core/common/policy_switches.h"
#include "components/signin/core/common/signin_pref_names.h"
#include "content/public/browser/notification_details.h" #include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_service.h" #include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_source.h" #include "content/public/browser/notification_source.h"
...@@ -621,6 +622,13 @@ IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, StartSession) { ...@@ -621,6 +622,13 @@ IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, StartSession) {
EXPECT_EQ(GURL(kStartupURLs[i]), EXPECT_EQ(GURL(kStartupURLs[i]),
tabs->GetWebContentsAt(i)->GetVisibleURL()); tabs->GetWebContentsAt(i)->GetVisibleURL());
} }
// Verify that the session is not considered to be logged in with a GAIA
// account.
Profile* profile = GetProfileForTest();
ASSERT_TRUE(profile);
EXPECT_FALSE(profile->GetPrefs()->HasPrefPath(
prefs::kGoogleServicesUsername));
} }
IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, FullscreenDisallowed) { IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, FullscreenDisallowed) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment