OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/chromeos/policy/consumer_enrollment_handler.h" | 5 #include "chrome/browser/chromeos/policy/consumer_enrollment_handler.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 BuildAutoIssuingFakeProfileOAuth2TokenService)); | 75 BuildAutoIssuingFakeProfileOAuth2TokenService)); |
76 profile_ = testing_profile_manager_->CreateTestingProfile( | 76 profile_ = testing_profile_manager_->CreateTestingProfile( |
77 kTestUser, scoped_ptr<PrefServiceSyncable>(), | 77 kTestUser, scoped_ptr<PrefServiceSyncable>(), |
78 base::UTF8ToUTF16(kTestUser), 0, std::string(), factories); | 78 base::UTF8ToUTF16(kTestUser), 0, std::string(), factories); |
79 | 79 |
80 // Set up the authenticated user name and ID. | 80 // Set up the authenticated user name and ID. |
81 SigninManagerFactory::GetForProfile(profile_) | 81 SigninManagerFactory::GetForProfile(profile_) |
82 ->SetAuthenticatedAccountInfo(kTestOwner, kTestOwner); | 82 ->SetAuthenticatedAccountInfo(kTestOwner, kTestOwner); |
83 | 83 |
84 // Issue a fake refresh token. | 84 // Issue a fake refresh token. |
85 GetFakeProfileOAuth2TokenService()->IssueRefreshTokenForUser(kTestOwner, | 85 GetFakeProfileOAuth2TokenService()->UpdateCredentials(kTestOwner, |
86 "fake_token"); | 86 "fake_token"); |
87 } | 87 } |
88 | 88 |
89 FakeProfileOAuth2TokenService* GetFakeProfileOAuth2TokenService() { | 89 FakeProfileOAuth2TokenService* GetFakeProfileOAuth2TokenService() { |
90 return static_cast<FakeProfileOAuth2TokenService*>( | 90 return static_cast<FakeProfileOAuth2TokenService*>( |
91 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)); | 91 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)); |
92 } | 92 } |
93 | 93 |
94 void RunEnrollmentTest() { | 94 void RunEnrollmentTest() { |
95 handler_.reset( | 95 handler_.reset( |
96 new ConsumerEnrollmentHandler(profile_, fake_service_, NULL)); | 96 new ConsumerEnrollmentHandler(profile_, fake_service_, NULL)); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 EnrollmentStatus::STATUS_REGISTRATION_FAILED)); | 147 EnrollmentStatus::STATUS_REGISTRATION_FAILED)); |
148 | 148 |
149 RunEnrollmentTest(); | 149 RunEnrollmentTest(); |
150 | 150 |
151 EXPECT_TRUE(fake_initializer_->was_start_enrollment_called()); | 151 EXPECT_TRUE(fake_initializer_->was_start_enrollment_called()); |
152 EXPECT_EQ(ConsumerManagementStage::EnrollmentDMServerFailed(), | 152 EXPECT_EQ(ConsumerManagementStage::EnrollmentDMServerFailed(), |
153 fake_service_->GetStage()); | 153 fake_service_->GetStage()); |
154 } | 154 } |
155 | 155 |
156 } // namespace policy | 156 } // namespace policy |
OLD | NEW |