| 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/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 11 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
| 12 #include "base/files/scoped_temp_dir.h" | 13 #include "base/files/scoped_temp_dir.h" |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
| 15 #include "chrome/browser/chromeos/arc/arc_auth_service.h" | 16 #include "chrome/browser/chromeos/arc/arc_auth_service.h" |
| 16 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" | 17 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" |
| 17 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" | 18 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" |
| 18 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 19 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
| 19 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 20 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 20 #include "chrome/browser/prefs/pref_service_syncable_util.h" | 21 #include "chrome/browser/prefs/pref_service_syncable_util.h" |
| 21 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
| 22 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
| 23 #include "chrome/test/base/testing_profile.h" | 24 #include "chrome/test/base/testing_profile.h" |
| 25 #include "chromeos/chromeos_switches.h" |
| 24 #include "chromeos/login/user_names.h" | 26 #include "chromeos/login/user_names.h" |
| 25 #include "components/arc/arc_bridge_service.h" | 27 #include "components/arc/arc_bridge_service.h" |
| 26 #include "components/arc/test/fake_arc_bridge_service.h" | 28 #include "components/arc/test/fake_arc_bridge_service.h" |
| 27 #include "components/prefs/pref_service.h" | 29 #include "components/prefs/pref_service.h" |
| 28 #include "components/signin/core/account_id/account_id.h" | 30 #include "components/signin/core/account_id/account_id.h" |
| 29 #include "components/syncable_prefs/testing_pref_service_syncable.h" | 31 #include "components/syncable_prefs/testing_pref_service_syncable.h" |
| 30 #include "components/user_manager/user_manager.h" | 32 #include "components/user_manager/user_manager.h" |
| 31 #include "content/public/browser/browser_thread.h" | 33 #include "content/public/browser/browser_thread.h" |
| 32 #include "content/public/test/test_browser_thread_bundle.h" | 34 #include "content/public/test/test_browser_thread_bundle.h" |
| 33 #include "google_apis/gaia/gaia_constants.h" | 35 #include "google_apis/gaia/gaia_constants.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 47 } // namespace | 49 } // namespace |
| 48 | 50 |
| 49 class ArcAuthServiceTest : public testing::Test { | 51 class ArcAuthServiceTest : public testing::Test { |
| 50 public: | 52 public: |
| 51 ArcAuthServiceTest() | 53 ArcAuthServiceTest() |
| 52 : thread_bundle_(new content::TestBrowserThreadBundle(kThreadOptions)), | 54 : thread_bundle_(new content::TestBrowserThreadBundle(kThreadOptions)), |
| 53 user_manager_enabler_(new chromeos::FakeChromeUserManager) {} | 55 user_manager_enabler_(new chromeos::FakeChromeUserManager) {} |
| 54 ~ArcAuthServiceTest() override = default; | 56 ~ArcAuthServiceTest() override = default; |
| 55 | 57 |
| 56 void SetUp() override { | 58 void SetUp() override { |
| 59 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 60 chromeos::switches::kEnableArc); |
| 57 ArcAuthService::DisableUIForTesting(); | 61 ArcAuthService::DisableUIForTesting(); |
| 58 | 62 |
| 59 EXPECT_TRUE(temp_dir_.CreateUniqueTempDir()); | 63 EXPECT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 60 TestingProfile::Builder profile_builder; | 64 TestingProfile::Builder profile_builder; |
| 61 profile_builder.SetPath(temp_dir_.path().AppendASCII("TestArcProfile")); | 65 profile_builder.SetPath(temp_dir_.path().AppendASCII("TestArcProfile")); |
| 62 | 66 |
| 63 profile_ = profile_builder.Build(); | 67 profile_ = profile_builder.Build(); |
| 64 StartPreferenceSyncing(); | 68 StartPreferenceSyncing(); |
| 65 | 69 |
| 66 bridge_service_.reset(new FakeArcBridgeService()); | 70 bridge_service_.reset(new FakeArcBridgeService()); |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 | 317 |
| 314 // Check that user without GAIA account can't use ARC. | 318 // Check that user without GAIA account can't use ARC. |
| 315 auth_service()->OnPrimaryUserProfilePrepared(device_local_profile.get()); | 319 auth_service()->OnPrimaryUserProfilePrepared(device_local_profile.get()); |
| 316 EXPECT_EQ(ArcAuthService::State::STOPPED, auth_service()->state()); | 320 EXPECT_EQ(ArcAuthService::State::STOPPED, auth_service()->state()); |
| 317 | 321 |
| 318 // Correctly stop service. | 322 // Correctly stop service. |
| 319 auth_service()->Shutdown(); | 323 auth_service()->Shutdown(); |
| 320 } | 324 } |
| 321 | 325 |
| 322 } // namespace arc | 326 } // namespace arc |
| OLD | NEW |