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

Unified Diff: chrome/browser/chromeos/arc/arc_util_unittest.cc

Issue 2710273002: Split DisabledForEphemeralDataUsers tests into ChromeArcUtilTest. (Closed)
Patch Set: Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/arc/arc_util_unittest.cc
diff --git a/chrome/browser/chromeos/arc/arc_util_unittest.cc b/chrome/browser/chromeos/arc/arc_util_unittest.cc
index d01fabc9800c8e0c25706bc137c1ceec7652281b..ef9845b19772a30f4df9dcce131a3c46acc02b37 100644
--- a/chrome/browser/chromeos/arc/arc_util_unittest.cc
+++ b/chrome/browser/chromeos/arc/arc_util_unittest.cc
@@ -23,6 +23,7 @@
#include "components/signin/core/account_id/account_id.h"
#include "components/sync_preferences/testing_pref_service_syncable.h"
#include "components/user_manager/user_manager.h"
+#include "components/user_manager/user_names.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -46,6 +47,9 @@ class ScopedLogIn {
case user_manager::USER_TYPE_ACTIVE_DIRECTORY:
LogIn();
break;
+ case user_manager::USER_TYPE_PUBLIC_ACCOUNT:
+ LogInAsPublicAccount();
+ break;
case user_manager::USER_TYPE_ARC_KIOSK_APP:
LogInArcKioskApp();
break;
@@ -62,6 +66,11 @@ class ScopedLogIn {
fake_user_manager_->LoginUser(account_id_);
}
+ void LogInAsPublicAccount() {
+ fake_user_manager_->AddPublicAccountUser(account_id_);
+ fake_user_manager_->LoginUser(account_id_);
+ }
+
void LogInArcKioskApp() {
fake_user_manager_->AddArcKioskAppUser(account_id_);
fake_user_manager_->LoginUser(account_id_);
@@ -159,6 +168,14 @@ TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_NonPrimaryProfile) {
EXPECT_FALSE(IsArcAllowedForProfile(profile()));
}
+// User without GAIA account.
+TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_PublicAccount) {
+ ScopedLogIn login(GetFakeUserManager(),
+ AccountId::FromUserEmail("public_user@gmail.com"),
+ user_manager::USER_TYPE_PUBLIC_ACCOUNT);
+ EXPECT_FALSE(IsArcAllowedForProfile(profile()));
+}
+
TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_ActiveDirectoryEnabled) {
base::CommandLine::ForCurrentProcess()->InitFromArgv(
{"", "--arc-availability=officially-supported-with-active-directory"});
@@ -226,8 +243,18 @@ TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_SupervisedUserFlow) {
GetFakeUserManager()->ResetUserFlow(manager_id);
}
-// TODO(hidehiko): Add test for Ephemeral users. There seems no way to easily
-// simulate ephemeral user.
+// Guest account is interpreted as EphemeralDataUser.
+TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_GuestAccount) {
+ ScopedLogIn login(GetFakeUserManager(),
+ GetFakeUserManager()->GetGuestAccountId());
+ EXPECT_FALSE(IsArcAllowedForProfile(profile()));
+}
+
+// Demo account is interpreted as EphemeralDataUser.
+TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_DemoAccount) {
+ ScopedLogIn login(GetFakeUserManager(), user_manager::DemoAccountId());
+ EXPECT_FALSE(IsArcAllowedForProfile(profile()));
+}
TEST_F(ChromeArcUtilTest, ArcPlayStoreEnabledForProfile) {
// Ensure IsAllowedForProfile() true.

Powered by Google App Engine
This is Rietveld 408576698