OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 #include "chrome/browser/signin/oauth2_token_service_request.h" | 4 #include "chrome/browser/signin/oauth2_token_service_request.h" |
5 | 5 |
6 #include <set> | 6 #include <set> |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
10 #include "chrome/browser/signin/oauth2_token_service.h" | 10 #include "chrome/browser/signin/oauth2_token_service.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 const GoogleServiceAuthError& error) OVERRIDE; | 29 const GoogleServiceAuthError& error) OVERRIDE; |
30 | 30 |
31 std::string last_token_; | 31 std::string last_token_; |
32 int number_of_correct_tokens_; | 32 int number_of_correct_tokens_; |
33 GoogleServiceAuthError last_error_; | 33 GoogleServiceAuthError last_error_; |
34 int number_of_errors_; | 34 int number_of_errors_; |
35 }; | 35 }; |
36 | 36 |
37 TestingOAuth2TokenServiceConsumer::TestingOAuth2TokenServiceConsumer() | 37 TestingOAuth2TokenServiceConsumer::TestingOAuth2TokenServiceConsumer() |
38 : number_of_correct_tokens_(0), | 38 : number_of_correct_tokens_(0), |
39 last_error_(GoogleServiceAuthError::None()), | 39 last_error_(GoogleServiceAuthError::AuthErrorNone()), |
40 number_of_errors_(0) { | 40 number_of_errors_(0) { |
41 } | 41 } |
42 | 42 |
43 TestingOAuth2TokenServiceConsumer::~TestingOAuth2TokenServiceConsumer() { | 43 TestingOAuth2TokenServiceConsumer::~TestingOAuth2TokenServiceConsumer() { |
44 } | 44 } |
45 | 45 |
46 void TestingOAuth2TokenServiceConsumer::OnGetTokenSuccess( | 46 void TestingOAuth2TokenServiceConsumer::OnGetTokenSuccess( |
47 const OAuth2TokenService::Request* request, | 47 const OAuth2TokenService::Request* request, |
48 const std::string& token, | 48 const std::string& token, |
49 const base::Time& expiration_date) { | 49 const base::Time& expiration_date) { |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 profile_.get(), | 229 profile_.get(), |
230 std::set<std::string>(), | 230 std::set<std::string>(), |
231 &consumer_)); | 231 &consumer_)); |
232 ui_loop_.RunUntilIdle(); | 232 ui_loop_.RunUntilIdle(); |
233 request.reset(); | 233 request.reset(); |
234 EXPECT_EQ(1, consumer_.number_of_correct_tokens_); | 234 EXPECT_EQ(1, consumer_.number_of_correct_tokens_); |
235 EXPECT_EQ(0, consumer_.number_of_errors_); | 235 EXPECT_EQ(0, consumer_.number_of_errors_); |
236 } | 236 } |
237 | 237 |
238 } // namespace | 238 } // namespace |
OLD | NEW |