| 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 | 7 |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 url); | 147 url); |
| 148 | 148 |
| 149 // Enable ARC. | 149 // Enable ARC. |
| 150 command_line->AppendSwitch(chromeos::switches::kEnableArc); | 150 command_line->AppendSwitch(chromeos::switches::kEnableArc); |
| 151 chromeos::FakeSessionManagerClient* const fake_session_manager_client = | 151 chromeos::FakeSessionManagerClient* const fake_session_manager_client = |
| 152 new chromeos::FakeSessionManagerClient; | 152 new chromeos::FakeSessionManagerClient; |
| 153 fake_session_manager_client->set_arc_available(true); | 153 fake_session_manager_client->set_arc_available(true); |
| 154 chromeos::DBusThreadManager::GetSetterForTesting()->SetSessionManagerClient( | 154 chromeos::DBusThreadManager::GetSetterForTesting()->SetSessionManagerClient( |
| 155 std::unique_ptr<chromeos::SessionManagerClient>( | 155 std::unique_ptr<chromeos::SessionManagerClient>( |
| 156 fake_session_manager_client)); | 156 fake_session_manager_client)); |
| 157 | |
| 158 // Mock out ARC instance. | |
| 159 ArcServiceManager::SetArcSessionRunnerForTesting( | |
| 160 base::MakeUnique<ArcSessionRunner>(base::Bind(FakeArcSession::Create))); | |
| 161 } | 157 } |
| 162 | 158 |
| 163 void SetUpOnMainThread() override { | 159 void SetUpOnMainThread() override { |
| 164 user_manager_enabler_.reset(new chromeos::ScopedUserManagerEnabler( | 160 user_manager_enabler_.reset(new chromeos::ScopedUserManagerEnabler( |
| 165 new chromeos::FakeChromeUserManager)); | 161 new chromeos::FakeChromeUserManager)); |
| 166 // Init ArcSessionManager for testing. | 162 // Init ArcSessionManager for testing. |
| 167 ArcSessionManager::DisableUIForTesting(); | 163 ArcSessionManager::DisableUIForTesting(); |
| 168 ArcSessionManager::EnableCheckAndroidManagementForTesting(); | 164 ArcSessionManager::EnableCheckAndroidManagementForTesting(); |
| 165 ArcSessionManager::Get()->SetArcSessionRunnerForTesting( |
| 166 base::MakeUnique<ArcSessionRunner>(base::Bind(FakeArcSession::Create))); |
| 169 | 167 |
| 170 EXPECT_TRUE(temp_dir_.CreateUniqueTempDir()); | 168 EXPECT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 171 | 169 |
| 172 // Create test profile. | 170 // Create test profile. |
| 173 TestingProfile::Builder profile_builder; | 171 TestingProfile::Builder profile_builder; |
| 174 profile_builder.SetPath(temp_dir_.GetPath().AppendASCII("TestArcProfile")); | 172 profile_builder.SetPath(temp_dir_.GetPath().AppendASCII("TestArcProfile")); |
| 175 profile_builder.SetProfileName(kFakeUserName); | 173 profile_builder.SetProfileName(kFakeUserName); |
| 176 profile_builder.AddTestingFactory( | 174 profile_builder.AddTestingFactory( |
| 177 ProfileOAuth2TokenServiceFactory::GetInstance(), | 175 ProfileOAuth2TokenServiceFactory::GetInstance(), |
| 178 BuildFakeProfileOAuth2TokenService); | 176 BuildFakeProfileOAuth2TokenService); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 base::Time::Max()); | 259 base::Time::Max()); |
| 262 ArcSessionManagerShutdownObserver().Wait(); | 260 ArcSessionManagerShutdownObserver().Wait(); |
| 263 ASSERT_EQ(ArcSessionManager::State::REMOVING_DATA_DIR, | 261 ASSERT_EQ(ArcSessionManager::State::REMOVING_DATA_DIR, |
| 264 ArcSessionManager::Get()->state()); | 262 ArcSessionManager::Get()->state()); |
| 265 ArcSessionManagerDataRemovedObserver().Wait(); | 263 ArcSessionManagerDataRemovedObserver().Wait(); |
| 266 ASSERT_EQ(ArcSessionManager::State::STOPPED, | 264 ASSERT_EQ(ArcSessionManager::State::STOPPED, |
| 267 ArcSessionManager::Get()->state()); | 265 ArcSessionManager::Get()->state()); |
| 268 } | 266 } |
| 269 | 267 |
| 270 } // namespace arc | 268 } // namespace arc |
| OLD | NEW |