Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "chrome/browser/chromeos/arc/arc_util.h" | 5 #include "chrome/browser/chromeos/arc/arc_util.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 193 ScopedLogIn login( | 193 ScopedLogIn login( |
| 194 GetFakeUserManager(), | 194 GetFakeUserManager(), |
| 195 AccountId::AdFromObjGuid("f04557de-5da2-40ce-ae9d-b8874d8da96e"), | 195 AccountId::AdFromObjGuid("f04557de-5da2-40ce-ae9d-b8874d8da96e"), |
| 196 user_manager::USER_TYPE_ACTIVE_DIRECTORY); | 196 user_manager::USER_TYPE_ACTIVE_DIRECTORY); |
| 197 EXPECT_FALSE(chromeos::ProfileHelper::Get() | 197 EXPECT_FALSE(chromeos::ProfileHelper::Get() |
| 198 ->GetUserByProfile(profile()) | 198 ->GetUserByProfile(profile()) |
| 199 ->HasGaiaAccount()); | 199 ->HasGaiaAccount()); |
| 200 EXPECT_FALSE(IsArcAllowedForProfile(profile())); | 200 EXPECT_FALSE(IsArcAllowedForProfile(profile())); |
| 201 } | 201 } |
| 202 | 202 |
| 203 TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_KioskArcEnabled) { | 203 TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_KioskArcNotAvailable) { |
| 204 ScopedLogIn login(GetFakeUserManager(), | |
| 205 AccountId::FromUserEmail(profile()->GetProfileUserName()), | |
| 206 user_manager::USER_TYPE_ARC_KIOSK_APP); | |
| 207 EXPECT_FALSE(chromeos::ProfileHelper::Get() | |
| 208 ->GetUserByProfile(profile()) | |
| 209 ->HasGaiaAccount()); | |
| 210 EXPECT_TRUE(IsArcAllowedForProfile(profile())); | |
| 211 } | |
| 212 | |
| 213 TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_KioskArcDisabled) { | |
| 214 base::CommandLine::ForCurrentProcess()->InitFromArgv({""}); | 204 base::CommandLine::ForCurrentProcess()->InitFromArgv({""}); |
| 215 ScopedLogIn login(GetFakeUserManager(), | 205 ScopedLogIn login(GetFakeUserManager(), |
| 216 AccountId::FromUserEmail(profile()->GetProfileUserName()), | 206 AccountId::FromUserEmail(profile()->GetProfileUserName()), |
| 217 user_manager::USER_TYPE_ARC_KIOSK_APP); | 207 user_manager::USER_TYPE_ARC_KIOSK_APP); |
| 218 EXPECT_FALSE(chromeos::ProfileHelper::Get() | 208 EXPECT_FALSE(chromeos::ProfileHelper::Get() |
| 219 ->GetUserByProfile(profile()) | 209 ->GetUserByProfile(profile()) |
| 220 ->HasGaiaAccount()); | 210 ->HasGaiaAccount()); |
| 221 EXPECT_FALSE(IsArcAllowedForProfile(profile())); | 211 EXPECT_FALSE(IsArcAllowedForProfile(profile())); |
| 222 } | 212 } |
| 223 | 213 |
| 224 TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_KioskOnlyEnabled) { | 214 TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_KioskArcInstalled) { |
| 225 base::CommandLine::ForCurrentProcess()->InitFromArgv( | 215 base::CommandLine::ForCurrentProcess()->InitFromArgv( |
| 226 {"", "--arc-availability=installed-only-kiosk-supported"}); | 216 {"", "--arc-availability=installed"}); |
| 227 ScopedLogIn login(GetFakeUserManager(), | 217 ScopedLogIn login(GetFakeUserManager(), |
| 228 AccountId::FromUserEmail(profile()->GetProfileUserName()), | 218 AccountId::FromUserEmail(profile()->GetProfileUserName()), |
| 229 user_manager::USER_TYPE_ARC_KIOSK_APP); | 219 user_manager::USER_TYPE_ARC_KIOSK_APP); |
| 220 EXPECT_FALSE(chromeos::ProfileHelper::Get() | |
| 221 ->GetUserByProfile(profile()) | |
| 222 ->HasGaiaAccount()); | |
| 223 EXPECT_TRUE(IsArcAllowedForProfile(profile())); | |
| 224 } | |
| 225 | |
| 226 TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_KioskArcSupported) { | |
| 227 base::CommandLine::ForCurrentProcess()->InitFromArgv( | |
| 228 {"", "--arc-availability=officially-supported", "--enable-arc"}); | |
|
Luis Héctor Chávez
2017/03/02 18:42:00
Does this work even after leaving out the "--enabl
elijahtaylor1
2017/03/02 19:16:48
yes, you're right I should remove --enable-arc, ev
| |
| 229 ScopedLogIn login(GetFakeUserManager(), | |
| 230 AccountId::FromUserEmail(profile()->GetProfileUserName()), | |
| 231 user_manager::USER_TYPE_ARC_KIOSK_APP); | |
| 230 EXPECT_FALSE(chromeos::ProfileHelper::Get() | 232 EXPECT_FALSE(chromeos::ProfileHelper::Get() |
| 231 ->GetUserByProfile(profile()) | 233 ->GetUserByProfile(profile()) |
| 232 ->HasGaiaAccount()); | 234 ->HasGaiaAccount()); |
| 233 EXPECT_TRUE(IsArcAllowedForProfile(profile())); | 235 EXPECT_TRUE(IsArcAllowedForProfile(profile())); |
| 234 } | 236 } |
| 235 | 237 |
| 236 TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_SupervisedUserFlow) { | 238 TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_SupervisedUserFlow) { |
| 237 auto manager_id = AccountId::FromUserEmailGaiaId( | 239 auto manager_id = AccountId::FromUserEmailGaiaId( |
| 238 profile()->GetProfileUserName(), kTestGaiaId); | 240 profile()->GetProfileUserName(), kTestGaiaId); |
| 239 ScopedLogIn login(GetFakeUserManager(), manager_id); | 241 ScopedLogIn login(GetFakeUserManager(), manager_id); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 322 EXPECT_TRUE(IsArcPlayStoreEnabledPreferenceManagedForProfile(profile())); | 324 EXPECT_TRUE(IsArcPlayStoreEnabledPreferenceManagedForProfile(profile())); |
| 323 EXPECT_FALSE(IsArcPlayStoreEnabledForProfile(profile())); | 325 EXPECT_FALSE(IsArcPlayStoreEnabledForProfile(profile())); |
| 324 | 326 |
| 325 // Remove managed state. | 327 // Remove managed state. |
| 326 profile()->GetTestingPrefService()->RemoveManagedPref(prefs::kArcEnabled); | 328 profile()->GetTestingPrefService()->RemoveManagedPref(prefs::kArcEnabled); |
| 327 EXPECT_FALSE(IsArcPlayStoreEnabledPreferenceManagedForProfile(profile())); | 329 EXPECT_FALSE(IsArcPlayStoreEnabledPreferenceManagedForProfile(profile())); |
| 328 } | 330 } |
| 329 | 331 |
| 330 } // namespace util | 332 } // namespace util |
| 331 } // namespace arc | 333 } // namespace arc |
| OLD | NEW |