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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 EXPECT_FALSE(IsArcAllowedForProfile(profile())); | 230 EXPECT_FALSE(IsArcAllowedForProfile(profile())); |
231 } | 231 } |
232 | 232 |
233 // User without GAIA account. | 233 // User without GAIA account. |
234 TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_PublicAccount) { | 234 TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_PublicAccount) { |
235 base::CommandLine::ForCurrentProcess()->InitFromArgv( | 235 base::CommandLine::ForCurrentProcess()->InitFromArgv( |
236 {"", "--arc-availability=officially-supported"}); | 236 {"", "--arc-availability=officially-supported"}); |
237 ScopedLogIn login(GetFakeUserManager(), | 237 ScopedLogIn login(GetFakeUserManager(), |
238 AccountId::FromUserEmail("public_user@gmail.com"), | 238 AccountId::FromUserEmail("public_user@gmail.com"), |
239 user_manager::USER_TYPE_PUBLIC_ACCOUNT); | 239 user_manager::USER_TYPE_PUBLIC_ACCOUNT); |
240 EXPECT_FALSE(IsArcAllowedForProfile(profile())); | 240 EXPECT_FALSE(chromeos::ProfileHelper::Get() |
| 241 ->GetUserByProfile(profile()) |
| 242 ->HasGaiaAccount()); |
| 243 EXPECT_TRUE(IsArcAllowedForProfile(profile())); |
241 } | 244 } |
242 | 245 |
243 TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_ActiveDirectoryEnabled) { | 246 TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_ActiveDirectoryEnabled) { |
244 base::CommandLine::ForCurrentProcess()->InitFromArgv( | 247 base::CommandLine::ForCurrentProcess()->InitFromArgv( |
245 {"", "--arc-availability=officially-supported"}); | 248 {"", "--arc-availability=officially-supported"}); |
246 ScopedLogIn login( | 249 ScopedLogIn login( |
247 GetFakeUserManager(), | 250 GetFakeUserManager(), |
248 AccountId::AdFromObjGuid("f04557de-5da2-40ce-ae9d-b8874d8da96e"), | 251 AccountId::AdFromObjGuid("f04557de-5da2-40ce-ae9d-b8874d8da96e"), |
249 user_manager::USER_TYPE_ACTIVE_DIRECTORY); | 252 user_manager::USER_TYPE_ACTIVE_DIRECTORY); |
250 EXPECT_FALSE(chromeos::ProfileHelper::Get() | 253 EXPECT_FALSE(chromeos::ProfileHelper::Get() |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 EXPECT_FALSE(IsArcAllowedForProfile(profile())); | 314 EXPECT_FALSE(IsArcAllowedForProfile(profile())); |
312 GetFakeUserManager()->ResetUserFlow(manager_id); | 315 GetFakeUserManager()->ResetUserFlow(manager_id); |
313 } | 316 } |
314 | 317 |
315 // Guest account is interpreted as EphemeralDataUser. | 318 // Guest account is interpreted as EphemeralDataUser. |
316 TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_GuestAccount) { | 319 TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_GuestAccount) { |
317 base::CommandLine::ForCurrentProcess()->InitFromArgv( | 320 base::CommandLine::ForCurrentProcess()->InitFromArgv( |
318 {"", "--arc-availability=officially-supported"}); | 321 {"", "--arc-availability=officially-supported"}); |
319 ScopedLogIn login(GetFakeUserManager(), | 322 ScopedLogIn login(GetFakeUserManager(), |
320 GetFakeUserManager()->GetGuestAccountId()); | 323 GetFakeUserManager()->GetGuestAccountId()); |
321 EXPECT_FALSE(IsArcAllowedForProfile(profile())); | 324 EXPECT_TRUE(IsArcAllowedForProfile(profile())); |
322 } | 325 } |
323 | 326 |
324 // Demo account is interpreted as EphemeralDataUser. | 327 // Demo account is interpreted as EphemeralDataUser. |
325 TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_DemoAccount) { | 328 TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_DemoAccount) { |
326 base::CommandLine::ForCurrentProcess()->InitFromArgv( | 329 base::CommandLine::ForCurrentProcess()->InitFromArgv( |
327 {"", "--arc-availability=officially-supported"}); | 330 {"", "--arc-availability=officially-supported"}); |
328 ScopedLogIn login(GetFakeUserManager(), user_manager::DemoAccountId()); | 331 ScopedLogIn login(GetFakeUserManager(), user_manager::DemoAccountId()); |
329 EXPECT_FALSE(IsArcAllowedForProfile(profile())); | 332 EXPECT_TRUE(IsArcAllowedForProfile(profile())); |
330 } | 333 } |
331 | 334 |
332 TEST_F(ChromeArcUtilTest, IsArcCompatibleFileSystemUsedForProfile) { | 335 TEST_F(ChromeArcUtilTest, IsArcCompatibleFileSystemUsedForProfile) { |
333 base::CommandLine::ForCurrentProcess()->InitFromArgv( | 336 base::CommandLine::ForCurrentProcess()->InitFromArgv( |
334 {"", "--arc-availability=officially-supported"}); | 337 {"", "--arc-availability=officially-supported"}); |
335 | 338 |
336 const AccountId id(AccountId::FromUserEmailGaiaId( | 339 const AccountId id(AccountId::FromUserEmailGaiaId( |
337 profile()->GetProfileUserName(), kTestGaiaId)); | 340 profile()->GetProfileUserName(), kTestGaiaId)); |
338 ScopedLogIn login(GetFakeUserManager(), id); | 341 ScopedLogIn login(GetFakeUserManager(), id); |
339 | 342 |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 ResetArcMigrationAllowedForTesting(); | 555 ResetArcMigrationAllowedForTesting(); |
553 auto* const command_line = base::CommandLine::ForCurrentProcess(); | 556 auto* const command_line = base::CommandLine::ForCurrentProcess(); |
554 command_line->InitFromArgv({"", "--need-arc-migration-policy-check", | 557 command_line->InitFromArgv({"", "--need-arc-migration-policy-check", |
555 "--arc-availability=officially-supported"}); | 558 "--arc-availability=officially-supported"}); |
556 SetDeviceIsEnterpriseManaged(true); | 559 SetDeviceIsEnterpriseManaged(true); |
557 EXPECT_FALSE(IsArcMigrationAllowed()); | 560 EXPECT_FALSE(IsArcMigrationAllowed()); |
558 } | 561 } |
559 | 562 |
560 } // namespace util | 563 } // namespace util |
561 } // namespace arc | 564 } // namespace arc |
OLD | NEW |