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

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

Issue 2806443002: arc: Add IsArcAllowedInAppListForProfile. (Closed)
Patch Set: Test Created 3 years, 8 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 f3f885bed9fd2bea92b403758f5533925e6bd0fa..5bfd6f813e8d6a9d3219be1aea9918737edec3bc 100644
--- a/chrome/browser/chromeos/arc/arc_util_unittest.cc
+++ b/chrome/browser/chromeos/arc/arc_util_unittest.cc
@@ -9,6 +9,7 @@
#include "base/command_line.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
+#include "base/sys_info.h"
#include "base/test/scoped_command_line.h"
#include "base/values.h"
#include "chrome/browser/chromeos/login/supervised/supervised_user_creation_flow.h"
@@ -138,16 +139,21 @@ TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile) {
AccountId::FromUserEmailGaiaId(
profile()->GetProfileUserName(), kTestGaiaId));
EXPECT_TRUE(IsArcAllowedForProfile(profile()));
+ EXPECT_TRUE(IsArcAllowedInAppListForProfile(profile()));
// false for nullptr.
EXPECT_FALSE(IsArcAllowedForProfile(nullptr));
+ EXPECT_FALSE(IsArcAllowedInAppListForProfile(nullptr));
// false for incognito mode profile.
EXPECT_FALSE(IsArcAllowedForProfile(profile()->GetOffTheRecordProfile()));
+ EXPECT_FALSE(
+ IsArcAllowedInAppListForProfile(profile()->GetOffTheRecordProfile()));
// false for Legacy supervised user.
profile()->SetSupervisedUserId("foo");
EXPECT_FALSE(IsArcAllowedForProfile(profile()));
+ EXPECT_FALSE(IsArcAllowedInAppListForProfile(profile()));
}
TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_DisableArc) {
@@ -156,6 +162,7 @@ TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_DisableArc) {
AccountId::FromUserEmailGaiaId(
profile()->GetProfileUserName(), kTestGaiaId));
EXPECT_FALSE(IsArcAllowedForProfile(profile()));
+ EXPECT_FALSE(IsArcAllowedInAppListForProfile(profile()));
}
TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_NonPrimaryProfile) {
@@ -166,6 +173,7 @@ TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_NonPrimaryProfile) {
AccountId::FromUserEmailGaiaId(
profile()->GetProfileUserName(), kTestGaiaId));
EXPECT_FALSE(IsArcAllowedForProfile(profile()));
+ EXPECT_FALSE(IsArcAllowedInAppListForProfile(profile()));
}
// User without GAIA account.
@@ -174,6 +182,7 @@ TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_PublicAccount) {
AccountId::FromUserEmail("public_user@gmail.com"),
user_manager::USER_TYPE_PUBLIC_ACCOUNT);
EXPECT_FALSE(IsArcAllowedForProfile(profile()));
+ EXPECT_FALSE(IsArcAllowedInAppListForProfile(profile()));
}
TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_ActiveDirectoryEnabled) {
@@ -187,6 +196,7 @@ TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_ActiveDirectoryEnabled) {
->GetUserByProfile(profile())
->HasGaiaAccount());
EXPECT_TRUE(IsArcAllowedForProfile(profile()));
+ EXPECT_TRUE(IsArcAllowedInAppListForProfile(profile()));
}
TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_ActiveDirectoryDisabled) {
@@ -198,6 +208,7 @@ TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_ActiveDirectoryDisabled) {
->GetUserByProfile(profile())
->HasGaiaAccount());
EXPECT_FALSE(IsArcAllowedForProfile(profile()));
+ EXPECT_FALSE(IsArcAllowedInAppListForProfile(profile()));
}
TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_KioskArcNotAvailable) {
@@ -209,6 +220,7 @@ TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_KioskArcNotAvailable) {
->GetUserByProfile(profile())
->HasGaiaAccount());
EXPECT_FALSE(IsArcAllowedForProfile(profile()));
+ EXPECT_FALSE(IsArcAllowedInAppListForProfile(profile()));
}
TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_KioskArcInstalled) {
@@ -221,6 +233,7 @@ TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_KioskArcInstalled) {
->GetUserByProfile(profile())
->HasGaiaAccount());
EXPECT_TRUE(IsArcAllowedForProfile(profile()));
+ EXPECT_TRUE(IsArcAllowedInAppListForProfile(profile()));
}
TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_KioskArcSupported) {
@@ -233,6 +246,7 @@ TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_KioskArcSupported) {
->GetUserByProfile(profile())
->HasGaiaAccount());
EXPECT_TRUE(IsArcAllowedForProfile(profile()));
+ EXPECT_TRUE(IsArcAllowedInAppListForProfile(profile()));
}
TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_SupervisedUserFlow) {
@@ -250,12 +264,58 @@ TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_GuestAccount) {
ScopedLogIn login(GetFakeUserManager(),
GetFakeUserManager()->GetGuestAccountId());
EXPECT_FALSE(IsArcAllowedForProfile(profile()));
+ EXPECT_FALSE(IsArcAllowedInAppListForProfile(profile()));
}
// Demo account is interpreted as EphemeralDataUser.
TEST_F(ChromeArcUtilTest, IsArcAllowedForProfile_DemoAccount) {
ScopedLogIn login(GetFakeUserManager(), user_manager::DemoAccountId());
EXPECT_FALSE(IsArcAllowedForProfile(profile()));
+ EXPECT_FALSE(IsArcAllowedInAppListForProfile(profile()));
+}
+
+TEST_F(ChromeArcUtilTest, IsProfileVerifiedToBeOnArcCompatibleFilesystem) {
+ // TODO(kinaba): Come up with some way to test the conditions below
+ // causes differences in the return values of IsArcAllowedForProfile()
+ // and IsArcAllowedInAppListForProfile().
+ ScopedLogIn login(GetFakeUserManager(),
+ AccountId::FromUserEmailGaiaId(
+ profile()->GetProfileUserName(), kTestGaiaId));
+
+ // Unconfirmed + Old ARC
+ profile()->GetPrefs()->ClearPref(prefs::kArcCompatibleFilesystemChosen);
+ base::SysInfo::SetChromeOSVersionInfoForTest(
+ "CHROMEOS_ARC_ANDROID_SDK_VERSION=23", base::Time::Now());
+ EXPECT_TRUE(IsProfileVerifiedToBeOnArcCompatibleFilesystem(profile()));
+
+ // Unconfirmed + New ARC
+ base::SysInfo::SetChromeOSVersionInfoForTest(
+ "CHROMEOS_ARC_ANDROID_SDK_VERSION=25", base::Time::Now());
+ EXPECT_FALSE(IsProfileVerifiedToBeOnArcCompatibleFilesystem(profile()));
+
+ // Old FS + Old ARC
+ profile()->GetPrefs()->SetBoolean(prefs::kArcCompatibleFilesystemChosen,
+ false);
+ base::SysInfo::SetChromeOSVersionInfoForTest(
+ "CHROMEOS_ARC_ANDROID_SDK_VERSION=23", base::Time::Now());
+ EXPECT_TRUE(IsProfileVerifiedToBeOnArcCompatibleFilesystem(profile()));
+
+ // Old FS + New ARC
+ base::SysInfo::SetChromeOSVersionInfoForTest(
+ "CHROMEOS_ARC_ANDROID_SDK_VERSION=25", base::Time::Now());
+ EXPECT_FALSE(IsProfileVerifiedToBeOnArcCompatibleFilesystem(profile()));
+
+ // New FS + Old ARC
+ profile()->GetPrefs()->SetBoolean(prefs::kArcCompatibleFilesystemChosen,
+ true);
+ base::SysInfo::SetChromeOSVersionInfoForTest(
+ "CHROMEOS_ARC_ANDROID_SDK_VERSION=23", base::Time::Now());
+ EXPECT_TRUE(IsProfileVerifiedToBeOnArcCompatibleFilesystem(profile()));
+
+ // New FS + New ARC
+ base::SysInfo::SetChromeOSVersionInfoForTest(
+ "CHROMEOS_ARC_ANDROID_SDK_VERSION=25", base::Time::Now());
+ EXPECT_TRUE(IsProfileVerifiedToBeOnArcCompatibleFilesystem(profile()));
}
TEST_F(ChromeArcUtilTest, ArcPlayStoreEnabledForProfile) {
« chrome/browser/chromeos/arc/arc_util.h ('K') | « chrome/browser/chromeos/arc/arc_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698