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

Side by Side Diff: components/arc/arc_util_unittest.cc

Issue 2926893002: arc: Start ARC for Public Session users.
Patch Set: Hide Play Store Created 3 years, 2 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
« components/arc/arc_util.cc ('K') | « components/arc/arc_util.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "components/arc/arc_util.h" 5 #include "components/arc/arc_util.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 9
10 #include "ash/public/cpp/app_types.h" 10 #include "ash/public/cpp/app_types.h"
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 TEST_F(ArcUtilTest, IsArcAllowedForUser) { 205 TEST_F(ArcUtilTest, IsArcAllowedForUser) {
206 user_manager::FakeUserManager fake_user_manager; 206 user_manager::FakeUserManager fake_user_manager;
207 ScopedUserManager scoped_user_manager(&fake_user_manager); 207 ScopedUserManager scoped_user_manager(&fake_user_manager);
208 208
209 struct { 209 struct {
210 user_manager::UserType user_type; 210 user_manager::UserType user_type;
211 bool expected_allowed; 211 bool expected_allowed;
212 } const kTestCases[] = { 212 } const kTestCases[] = {
213 {user_manager::USER_TYPE_REGULAR, true}, 213 {user_manager::USER_TYPE_REGULAR, true},
214 {user_manager::USER_TYPE_GUEST, false}, 214 {user_manager::USER_TYPE_GUEST, false},
215 {user_manager::USER_TYPE_PUBLIC_ACCOUNT, false}, 215 {user_manager::USER_TYPE_PUBLIC_ACCOUNT, true},
216 {user_manager::USER_TYPE_SUPERVISED, false}, 216 {user_manager::USER_TYPE_SUPERVISED, false},
217 {user_manager::USER_TYPE_KIOSK_APP, false}, 217 {user_manager::USER_TYPE_KIOSK_APP, false},
218 {user_manager::USER_TYPE_CHILD, true}, 218 {user_manager::USER_TYPE_CHILD, true},
219 {user_manager::USER_TYPE_ARC_KIOSK_APP, true}, 219 {user_manager::USER_TYPE_ARC_KIOSK_APP, true},
220 {user_manager::USER_TYPE_ACTIVE_DIRECTORY, true}, 220 {user_manager::USER_TYPE_ACTIVE_DIRECTORY, true},
221 }; 221 };
222 for (const auto& test_case : kTestCases) { 222 for (const auto& test_case : kTestCases) {
223 const FakeUser user(test_case.user_type); 223 const FakeUser user(test_case.user_type);
224 EXPECT_EQ(test_case.expected_allowed, IsArcAllowedForUser(&user)) 224 EXPECT_EQ(test_case.expected_allowed, IsArcAllowedForUser(&user))
225 << "User type=" << test_case.user_type; 225 << "User type=" << test_case.user_type;
226 } 226 }
227 227
228 // An ephemeral user is a logged in user but unknown to UserManager when 228 // An ephemeral user is a logged in user but unknown to UserManager when
229 // ephemeral policy is set. 229 // ephemeral policy is set.
230 fake_user_manager.SetEphemeralUsersEnabled(true); 230 fake_user_manager.SetEphemeralUsersEnabled(true);
231 fake_user_manager.UserLoggedIn(AccountId::FromUserEmail("test@test.com"), 231 fake_user_manager.UserLoggedIn(AccountId::FromUserEmail("test@test.com"),
232 "test@test.com-hash", false); 232 "test@test.com-hash", false);
233 const user_manager::User* ephemeral_user = fake_user_manager.GetActiveUser(); 233 const user_manager::User* ephemeral_user = fake_user_manager.GetActiveUser();
234 ASSERT_TRUE(ephemeral_user); 234 ASSERT_TRUE(ephemeral_user);
235 ASSERT_TRUE(fake_user_manager.IsUserCryptohomeDataEphemeral( 235 ASSERT_TRUE(fake_user_manager.IsUserCryptohomeDataEphemeral(
236 ephemeral_user->GetAccountId())); 236 ephemeral_user->GetAccountId()));
237 237
238 // Ephemeral user is not allowed for ARC. 238 // Ephemeral user is also allowed for ARC.
239 EXPECT_FALSE(IsArcAllowedForUser(ephemeral_user)); 239 EXPECT_TRUE(IsArcAllowedForUser(ephemeral_user));
240 } 240 }
241 241
242 TEST_F(ArcUtilTest, ArcStartModeDefault) { 242 TEST_F(ArcUtilTest, ArcStartModeDefault) {
243 auto* command_line = base::CommandLine::ForCurrentProcess(); 243 auto* command_line = base::CommandLine::ForCurrentProcess();
244 command_line->InitFromArgv({"", "--arc-availability=installed"}); 244 command_line->InitFromArgv({"", "--arc-availability=installed"});
245 EXPECT_FALSE(ShouldArcAlwaysStart()); 245 EXPECT_FALSE(ShouldArcAlwaysStart());
246 EXPECT_TRUE(IsPlayStoreAvailable()); 246 EXPECT_TRUE(IsPlayStoreAvailable());
247 } 247 }
248 248
249 TEST_F(ArcUtilTest, ArcStartModeWithoutPlayStore) { 249 TEST_F(ArcUtilTest, ArcStartModeWithoutPlayStore) {
250 auto* command_line = base::CommandLine::ForCurrentProcess(); 250 auto* command_line = base::CommandLine::ForCurrentProcess();
251 command_line->InitFromArgv( 251 command_line->InitFromArgv(
252 {"", "--arc-availability=installed", 252 {"", "--arc-availability=installed",
253 "--arc-start-mode=always-start-with-no-play-store"}); 253 "--arc-start-mode=always-start-with-no-play-store"});
254 EXPECT_TRUE(ShouldArcAlwaysStart()); 254 EXPECT_TRUE(ShouldArcAlwaysStart());
255 EXPECT_FALSE(IsPlayStoreAvailable()); 255 EXPECT_FALSE(IsPlayStoreAvailable());
256 } 256 }
257 257
258 } // namespace 258 } // namespace
259 } // namespace arc 259 } // namespace arc
OLDNEW
« components/arc/arc_util.cc ('K') | « components/arc/arc_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698