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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 user_manager_enabler_.reset(new chromeos::ScopedUserManagerEnabler( | 150 user_manager_enabler_.reset(new chromeos::ScopedUserManagerEnabler( |
151 new chromeos::FakeChromeUserManager)); | 151 new chromeos::FakeChromeUserManager)); |
152 // Init ArcAuthService for testing. | 152 // Init ArcAuthService for testing. |
153 ArcAuthService::DisableUIForTesting(); | 153 ArcAuthService::DisableUIForTesting(); |
154 ArcAuthService::EnableCheckAndroidManagementForTesting(); | 154 ArcAuthService::EnableCheckAndroidManagementForTesting(); |
155 | 155 |
156 EXPECT_TRUE(temp_dir_.CreateUniqueTempDir()); | 156 EXPECT_TRUE(temp_dir_.CreateUniqueTempDir()); |
157 | 157 |
158 // Create test profile. | 158 // Create test profile. |
159 TestingProfile::Builder profile_builder; | 159 TestingProfile::Builder profile_builder; |
160 profile_builder.SetPath(temp_dir_.path().AppendASCII("TestArcProfile")); | 160 profile_builder.SetPath(temp_dir_.GetPath().AppendASCII("TestArcProfile")); |
161 profile_builder.SetProfileName(kFakeUserName); | 161 profile_builder.SetProfileName(kFakeUserName); |
162 profile_builder.AddTestingFactory( | 162 profile_builder.AddTestingFactory( |
163 ProfileOAuth2TokenServiceFactory::GetInstance(), | 163 ProfileOAuth2TokenServiceFactory::GetInstance(), |
164 BuildFakeProfileOAuth2TokenService); | 164 BuildFakeProfileOAuth2TokenService); |
165 profile_ = profile_builder.Build(); | 165 profile_ = profile_builder.Build(); |
166 token_service_ = static_cast<FakeProfileOAuth2TokenService*>( | 166 token_service_ = static_cast<FakeProfileOAuth2TokenService*>( |
167 ProfileOAuth2TokenServiceFactory::GetForProfile(profile())); | 167 ProfileOAuth2TokenServiceFactory::GetForProfile(profile())); |
168 token_service_->UpdateCredentials("", kRefreshToken); | 168 token_service_->UpdateCredentials("", kRefreshToken); |
169 | 169 |
170 profile()->GetPrefs()->SetBoolean(prefs::kArcSignedIn, true); | 170 profile()->GetPrefs()->SetBoolean(prefs::kArcSignedIn, true); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 | 247 |
248 prefs->SetBoolean(prefs::kArcEnabled, true); | 248 prefs->SetBoolean(prefs::kArcEnabled, true); |
249 token_service()->IssueTokenForAllPendingRequests(kManagedAuthToken, | 249 token_service()->IssueTokenForAllPendingRequests(kManagedAuthToken, |
250 base::Time::Max()); | 250 base::Time::Max()); |
251 ArcAuthServiceShutdownObserver observer; | 251 ArcAuthServiceShutdownObserver observer; |
252 observer.Wait(); | 252 observer.Wait(); |
253 ASSERT_EQ(ArcAuthService::State::STOPPED, ArcAuthService::Get()->state()); | 253 ASSERT_EQ(ArcAuthService::State::STOPPED, ArcAuthService::Get()->state()); |
254 } | 254 } |
255 | 255 |
256 } // namespace arc | 256 } // namespace arc |
OLD | NEW |