| 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" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
| 25 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" | 25 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
| 26 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 26 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
| 27 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
| 28 #include "chrome/test/base/testing_profile.h" | 28 #include "chrome/test/base/testing_profile.h" |
| 29 #include "chromeos/chromeos_switches.h" | 29 #include "chromeos/chromeos_switches.h" |
| 30 #include "chromeos/dbus/dbus_thread_manager.h" | 30 #include "chromeos/dbus/dbus_thread_manager.h" |
| 31 #include "chromeos/dbus/fake_session_manager_client.h" | 31 #include "chromeos/dbus/fake_session_manager_client.h" |
| 32 #include "components/arc/arc_bridge_service.h" | 32 #include "components/arc/arc_bridge_service.h" |
| 33 #include "components/arc/arc_service_manager.h" | 33 #include "components/arc/arc_service_manager.h" |
| 34 #include "components/arc/test/fake_arc_bridge_service.h" | 34 #include "components/arc/arc_session_runner.h" |
| 35 #include "components/arc/test/fake_arc_session.h" |
| 35 #include "components/prefs/pref_service.h" | 36 #include "components/prefs/pref_service.h" |
| 36 #include "components/signin/core/account_id/account_id.h" | 37 #include "components/signin/core/account_id/account_id.h" |
| 37 #include "components/sync/model/fake_sync_change_processor.h" | 38 #include "components/sync/model/fake_sync_change_processor.h" |
| 38 #include "components/sync/model/sync_error_factory_mock.h" | 39 #include "components/sync/model/sync_error_factory_mock.h" |
| 39 #include "components/sync_preferences/testing_pref_service_syncable.h" | 40 #include "components/sync_preferences/testing_pref_service_syncable.h" |
| 40 #include "components/user_manager/user_manager.h" | 41 #include "components/user_manager/user_manager.h" |
| 41 #include "components/user_manager/user_names.h" | 42 #include "components/user_manager/user_names.h" |
| 42 #include "content/public/browser/browser_thread.h" | 43 #include "content/public/browser/browser_thread.h" |
| 43 #include "content/public/test/test_browser_thread_bundle.h" | 44 #include "content/public/test/test_browser_thread_bundle.h" |
| 44 #include "google_apis/gaia/gaia_constants.h" | 45 #include "google_apis/gaia/gaia_constants.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 66 ArcSessionManager::DisableUIForTesting(); | 67 ArcSessionManager::DisableUIForTesting(); |
| 67 | 68 |
| 68 EXPECT_TRUE(temp_dir_.CreateUniqueTempDir()); | 69 EXPECT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 69 TestingProfile::Builder profile_builder; | 70 TestingProfile::Builder profile_builder; |
| 70 profile_builder.SetProfileName("user@gmail.com"); | 71 profile_builder.SetProfileName("user@gmail.com"); |
| 71 profile_builder.SetPath(temp_dir_.GetPath().AppendASCII("TestArcProfile")); | 72 profile_builder.SetPath(temp_dir_.GetPath().AppendASCII("TestArcProfile")); |
| 72 | 73 |
| 73 profile_ = profile_builder.Build(); | 74 profile_ = profile_builder.Build(); |
| 74 StartPreferenceSyncing(); | 75 StartPreferenceSyncing(); |
| 75 | 76 |
| 76 ArcServiceManager::SetArcBridgeServiceForTesting( | 77 ArcServiceManager::SetArcSessionRunnerForTesting( |
| 77 base::MakeUnique<FakeArcBridgeService>()); | 78 base::MakeUnique<ArcSessionRunner>(base::Bind(FakeArcSession::Create))); |
| 78 arc_service_manager_ = base::MakeUnique<ArcServiceManager>(nullptr); | 79 arc_service_manager_ = base::MakeUnique<ArcServiceManager>(nullptr); |
| 79 arc_session_manager_ = base::MakeUnique<ArcSessionManager>( | 80 arc_session_manager_ = base::MakeUnique<ArcSessionManager>( |
| 80 arc_service_manager_->arc_bridge_service()); | 81 arc_service_manager_->arc_bridge_service()); |
| 81 | 82 |
| 82 // Check initial conditions. | 83 // Check initial conditions. |
| 83 EXPECT_TRUE(bridge_service()->stopped()); | 84 EXPECT_TRUE(bridge_service()->stopped()); |
| 84 | 85 |
| 85 chromeos::WallpaperManager::Initialize(); | 86 chromeos::WallpaperManager::Initialize(); |
| 86 } | 87 } |
| 87 | 88 |
| 88 void TearDown() override { | 89 void TearDown() override { |
| 89 chromeos::WallpaperManager::Shutdown(); | 90 chromeos::WallpaperManager::Shutdown(); |
| 90 arc_session_manager_.reset(); | 91 arc_session_manager_.reset(); |
| 91 arc_service_manager_.reset(); | 92 arc_service_manager_.reset(); |
| 92 chromeos::DBusThreadManager::Shutdown(); | 93 chromeos::DBusThreadManager::Shutdown(); |
| 93 } | 94 } |
| 94 | 95 |
| 95 chromeos::FakeChromeUserManager* GetFakeUserManager() const { | 96 chromeos::FakeChromeUserManager* GetFakeUserManager() const { |
| 96 return static_cast<chromeos::FakeChromeUserManager*>( | 97 return static_cast<chromeos::FakeChromeUserManager*>( |
| 97 user_manager::UserManager::Get()); | 98 user_manager::UserManager::Get()); |
| 98 } | 99 } |
| 99 | 100 |
| 100 protected: | 101 protected: |
| 101 Profile* profile() { return profile_.get(); } | 102 Profile* profile() { return profile_.get(); } |
| 102 FakeArcBridgeService* bridge_service() { | 103 ArcBridgeService* bridge_service() { |
| 103 return static_cast<FakeArcBridgeService*>( | 104 return arc_service_manager_->arc_bridge_service(); |
| 104 arc_service_manager_->arc_bridge_service()); | |
| 105 } | 105 } |
| 106 ArcSessionManager* arc_session_manager() { | 106 ArcSessionManager* arc_session_manager() { |
| 107 return arc_session_manager_.get(); | 107 return arc_session_manager_.get(); |
| 108 } | 108 } |
| 109 | 109 |
| 110 bool WaitForDataRemoved(ArcSessionManager::State expected_state) { | 110 bool WaitForDataRemoved(ArcSessionManager::State expected_state) { |
| 111 if (arc_session_manager()->state() != | 111 if (arc_session_manager()->state() != |
| 112 ArcSessionManager::State::REMOVING_DATA_DIR) | 112 ArcSessionManager::State::REMOVING_DATA_DIR) |
| 113 return false; | 113 return false; |
| 114 | 114 |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 bool terminated = false; | 525 bool terminated = false; |
| 526 arc_session_manager()->SetAttemptUserExitCallbackForTesting( | 526 arc_session_manager()->SetAttemptUserExitCallbackForTesting( |
| 527 base::Bind([](bool* terminated) { *terminated = true; }, &terminated)); | 527 base::Bind([](bool* terminated) { *terminated = true; }, &terminated)); |
| 528 | 528 |
| 529 arc_session_manager()->OnProvisioningFinished( | 529 arc_session_manager()->OnProvisioningFinished( |
| 530 ProvisioningResult::CHROME_SERVER_COMMUNICATION_ERROR); | 530 ProvisioningResult::CHROME_SERVER_COMMUNICATION_ERROR); |
| 531 EXPECT_TRUE(terminated); | 531 EXPECT_TRUE(terminated); |
| 532 } | 532 } |
| 533 | 533 |
| 534 } // namespace arc | 534 } // namespace arc |
| OLD | NEW |