Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(326)

Side by Side Diff: chrome/browser/chromeos/arc/arc_util_unittest.cc

Issue 2926893002: arc: Start ARC for Public Session users.
Patch Set: Update unit tests. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 EXPECT_FALSE(IsArcAllowedForProfile(profile())); 210 EXPECT_FALSE(IsArcAllowedForProfile(profile()));
211 } 211 }
212 212
213 // User without GAIA account. 213 // User without GAIA account.
214 TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_PublicAccount) { 214 TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_PublicAccount) {
215 base::CommandLine::ForCurrentProcess()->InitFromArgv( 215 base::CommandLine::ForCurrentProcess()->InitFromArgv(
216 {"", "--arc-availability=officially-supported"}); 216 {"", "--arc-availability=officially-supported"});
217 ScopedLogIn login(GetFakeUserManager(), 217 ScopedLogIn login(GetFakeUserManager(),
218 AccountId::FromUserEmail("public_user@gmail.com"), 218 AccountId::FromUserEmail("public_user@gmail.com"),
219 user_manager::USER_TYPE_PUBLIC_ACCOUNT); 219 user_manager::USER_TYPE_PUBLIC_ACCOUNT);
220 EXPECT_FALSE(IsArcAllowedForProfile(profile())); 220 EXPECT_FALSE(chromeos::ProfileHelper::Get()
221 ->GetUserByProfile(profile())
222 ->HasGaiaAccount());
223 EXPECT_TRUE(IsArcAllowedForProfile(profile()));
221 } 224 }
222 225
223 TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_ActiveDirectoryEnabled) { 226 TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_ActiveDirectoryEnabled) {
224 base::CommandLine::ForCurrentProcess()->InitFromArgv( 227 base::CommandLine::ForCurrentProcess()->InitFromArgv(
225 {"", "--arc-availability=officially-supported"}); 228 {"", "--arc-availability=officially-supported"});
226 ScopedLogIn login( 229 ScopedLogIn login(
227 GetFakeUserManager(), 230 GetFakeUserManager(),
228 AccountId::AdFromObjGuid("f04557de-5da2-40ce-ae9d-b8874d8da96e"), 231 AccountId::AdFromObjGuid("f04557de-5da2-40ce-ae9d-b8874d8da96e"),
229 user_manager::USER_TYPE_ACTIVE_DIRECTORY); 232 user_manager::USER_TYPE_ACTIVE_DIRECTORY);
230 EXPECT_FALSE(chromeos::ProfileHelper::Get() 233 EXPECT_FALSE(chromeos::ProfileHelper::Get()
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 EXPECT_FALSE(IsArcAllowedForProfile(profile())); 294 EXPECT_FALSE(IsArcAllowedForProfile(profile()));
292 GetFakeUserManager()->ResetUserFlow(manager_id); 295 GetFakeUserManager()->ResetUserFlow(manager_id);
293 } 296 }
294 297
295 // Guest account is interpreted as EphemeralDataUser. 298 // Guest account is interpreted as EphemeralDataUser.
296 TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_GuestAccount) { 299 TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_GuestAccount) {
297 base::CommandLine::ForCurrentProcess()->InitFromArgv( 300 base::CommandLine::ForCurrentProcess()->InitFromArgv(
298 {"", "--arc-availability=officially-supported"}); 301 {"", "--arc-availability=officially-supported"});
299 ScopedLogIn login(GetFakeUserManager(), 302 ScopedLogIn login(GetFakeUserManager(),
300 GetFakeUserManager()->GetGuestAccountId()); 303 GetFakeUserManager()->GetGuestAccountId());
301 EXPECT_FALSE(IsArcAllowedForProfile(profile())); 304 EXPECT_TRUE(IsArcAllowedForProfile(profile()));
302 } 305 }
303 306
304 // Demo account is interpreted as EphemeralDataUser. 307 // Demo account is interpreted as EphemeralDataUser.
305 TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_DemoAccount) { 308 TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_DemoAccount) {
306 base::CommandLine::ForCurrentProcess()->InitFromArgv( 309 base::CommandLine::ForCurrentProcess()->InitFromArgv(
307 {"", "--arc-availability=officially-supported"}); 310 {"", "--arc-availability=officially-supported"});
308 ScopedLogIn login(GetFakeUserManager(), user_manager::DemoAccountId()); 311 ScopedLogIn login(GetFakeUserManager(), user_manager::DemoAccountId());
309 EXPECT_FALSE(IsArcAllowedForProfile(profile())); 312 EXPECT_TRUE(IsArcAllowedForProfile(profile()));
310 } 313 }
311 314
312 TEST_F(ChromeArcUtilTest, IsArcCompatibleFileSystemUsedForProfile) { 315 TEST_F(ChromeArcUtilTest, IsArcCompatibleFileSystemUsedForProfile) {
313 base::CommandLine::ForCurrentProcess()->InitFromArgv( 316 base::CommandLine::ForCurrentProcess()->InitFromArgv(
314 {"", "--arc-availability=officially-supported"}); 317 {"", "--arc-availability=officially-supported"});
315 318
316 const AccountId id(AccountId::FromUserEmailGaiaId( 319 const AccountId id(AccountId::FromUserEmailGaiaId(
317 profile()->GetProfileUserName(), kTestGaiaId)); 320 profile()->GetProfileUserName(), kTestGaiaId));
318 ScopedLogIn login(GetFakeUserManager(), id); 321 ScopedLogIn login(GetFakeUserManager(), id);
319 322
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 EXPECT_FALSE(AreArcAllOptInPreferencesManagedForProfile(profile())); 472 EXPECT_FALSE(AreArcAllOptInPreferencesManagedForProfile(profile()));
470 473
471 // Both OptIn prefs are set to managed values, and the function returns true. 474 // Both OptIn prefs are set to managed values, and the function returns true.
472 profile()->GetTestingPrefService()->SetManagedPref( 475 profile()->GetTestingPrefService()->SetManagedPref(
473 prefs::kArcBackupRestoreEnabled, base::MakeUnique<base::Value>(false)); 476 prefs::kArcBackupRestoreEnabled, base::MakeUnique<base::Value>(false));
474 EXPECT_TRUE(AreArcAllOptInPreferencesManagedForProfile(profile())); 477 EXPECT_TRUE(AreArcAllOptInPreferencesManagedForProfile(profile()));
475 } 478 }
476 479
477 } // namespace util 480 } // namespace util
478 } // namespace arc 481 } // namespace arc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698