OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <memory> | 5 #include <memory> |
6 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
13 #include "base/files/scoped_temp_dir.h" | 13 #include "base/files/scoped_temp_dir.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
16 #include "chrome/browser/chromeos/arc/arc_auth_service.h" | 16 #include "chrome/browser/chromeos/arc/arc_auth_service.h" |
17 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" | 17 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" |
18 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" | 18 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" |
19 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 19 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
20 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 20 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
21 #include "chrome/browser/prefs/pref_service_syncable_util.h" | 21 #include "chrome/browser/prefs/pref_service_syncable_util.h" |
22 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
23 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" | 23 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
24 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 24 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
25 #include "chrome/common/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
26 #include "chrome/test/base/testing_profile.h" | 26 #include "chrome/test/base/testing_profile.h" |
27 #include "chromeos/chromeos_switches.h" | 27 #include "chromeos/chromeos_switches.h" |
28 #include "chromeos/dbus/dbus_thread_manager.h" | 28 #include "chromeos/dbus/dbus_thread_manager.h" |
29 #include "chromeos/login/user_names.h" | |
30 #include "components/arc/arc_bridge_service.h" | 29 #include "components/arc/arc_bridge_service.h" |
31 #include "components/arc/test/fake_arc_bridge_service.h" | 30 #include "components/arc/test/fake_arc_bridge_service.h" |
32 #include "components/prefs/pref_service.h" | 31 #include "components/prefs/pref_service.h" |
33 #include "components/signin/core/account_id/account_id.h" | 32 #include "components/signin/core/account_id/account_id.h" |
34 #include "components/sync/model/fake_sync_change_processor.h" | 33 #include "components/sync/model/fake_sync_change_processor.h" |
35 #include "components/sync/model/sync_error_factory_mock.h" | 34 #include "components/sync/model/sync_error_factory_mock.h" |
36 #include "components/syncable_prefs/testing_pref_service_syncable.h" | 35 #include "components/syncable_prefs/testing_pref_service_syncable.h" |
37 #include "components/user_manager/user_manager.h" | 36 #include "components/user_manager/user_manager.h" |
| 37 #include "components/user_manager/user_names.h" |
38 #include "content/public/browser/browser_thread.h" | 38 #include "content/public/browser/browser_thread.h" |
39 #include "content/public/test/test_browser_thread_bundle.h" | 39 #include "content/public/test/test_browser_thread_bundle.h" |
40 #include "google_apis/gaia/gaia_constants.h" | 40 #include "google_apis/gaia/gaia_constants.h" |
41 #include "google_apis/gaia/gaia_urls.h" | 41 #include "google_apis/gaia/gaia_urls.h" |
42 #include "net/http/http_status_code.h" | 42 #include "net/http/http_status_code.h" |
43 #include "testing/gtest/include/gtest/gtest.h" | 43 #include "testing/gtest/include/gtest/gtest.h" |
44 | 44 |
45 namespace arc { | 45 namespace arc { |
46 | 46 |
47 namespace { | 47 namespace { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 prefs->SetBoolean(prefs::kArcEnabled, true); | 147 prefs->SetBoolean(prefs::kArcEnabled, true); |
148 | 148 |
149 chromeos::FakeChromeUserManager* const fake_user_manager = | 149 chromeos::FakeChromeUserManager* const fake_user_manager = |
150 GetFakeUserManager(); | 150 GetFakeUserManager(); |
151 | 151 |
152 fake_user_manager->AddUser(fake_user_manager->GetGuestAccountId()); | 152 fake_user_manager->AddUser(fake_user_manager->GetGuestAccountId()); |
153 fake_user_manager->SwitchActiveUser(fake_user_manager->GetGuestAccountId()); | 153 fake_user_manager->SwitchActiveUser(fake_user_manager->GetGuestAccountId()); |
154 auth_service()->OnPrimaryUserProfilePrepared(profile()); | 154 auth_service()->OnPrimaryUserProfilePrepared(profile()); |
155 ASSERT_EQ(ArcAuthService::State::NOT_INITIALIZED, auth_service()->state()); | 155 ASSERT_EQ(ArcAuthService::State::NOT_INITIALIZED, auth_service()->state()); |
156 | 156 |
157 fake_user_manager->AddUser(chromeos::login::DemoAccountId()); | 157 fake_user_manager->AddUser(user_manager::DemoAccountId()); |
158 fake_user_manager->SwitchActiveUser(chromeos::login::DemoAccountId()); | 158 fake_user_manager->SwitchActiveUser(user_manager::DemoAccountId()); |
159 auth_service()->Shutdown(); | 159 auth_service()->Shutdown(); |
160 auth_service()->OnPrimaryUserProfilePrepared(profile()); | 160 auth_service()->OnPrimaryUserProfilePrepared(profile()); |
161 ASSERT_EQ(ArcAuthService::State::NOT_INITIALIZED, auth_service()->state()); | 161 ASSERT_EQ(ArcAuthService::State::NOT_INITIALIZED, auth_service()->state()); |
162 | 162 |
163 const AccountId public_account_id( | 163 const AccountId public_account_id( |
164 AccountId::FromUserEmail("public_user@gmail.com")); | 164 AccountId::FromUserEmail("public_user@gmail.com")); |
165 fake_user_manager->AddPublicAccountUser(public_account_id); | 165 fake_user_manager->AddPublicAccountUser(public_account_id); |
166 fake_user_manager->SwitchActiveUser(public_account_id); | 166 fake_user_manager->SwitchActiveUser(public_account_id); |
167 auth_service()->Shutdown(); | 167 auth_service()->Shutdown(); |
168 auth_service()->OnPrimaryUserProfilePrepared(profile()); | 168 auth_service()->OnPrimaryUserProfilePrepared(profile()); |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 second_profile->GetPrefs()->SetBoolean(prefs::kArcEnabled, true); | 359 second_profile->GetPrefs()->SetBoolean(prefs::kArcEnabled, true); |
360 | 360 |
361 // Check that non-primary user can't use Arc. | 361 // Check that non-primary user can't use Arc. |
362 EXPECT_FALSE(chromeos::ProfileHelper::IsPrimaryProfile(second_profile.get())); | 362 EXPECT_FALSE(chromeos::ProfileHelper::IsPrimaryProfile(second_profile.get())); |
363 EXPECT_FALSE(ArcAppListPrefs::Get(second_profile.get())); | 363 EXPECT_FALSE(ArcAppListPrefs::Get(second_profile.get())); |
364 | 364 |
365 auth_service()->Shutdown(); | 365 auth_service()->Shutdown(); |
366 } | 366 } |
367 | 367 |
368 } // namespace arc | 368 } // namespace arc |
OLD | NEW |