Index: chrome/browser/signin/oauth2_token_service_test_util.cc |
diff --git a/chrome/browser/signin/oauth2_token_service_test_util.cc b/chrome/browser/signin/oauth2_token_service_test_util.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1b1746b64fc1086e0b14368413e2a678fd0739d7 |
--- /dev/null |
+++ b/chrome/browser/signin/oauth2_token_service_test_util.cc |
@@ -0,0 +1,33 @@ |
+// Copyright 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/browser/signin/oauth2_token_service_test_util.h" |
+ |
+std::string GetValidTokenResponse(std::string token, int expiration) { |
+ return base::StringPrintf(kValidTokenResponse, token.c_str(), expiration); |
+} |
+ |
+TestingOAuth2TokenServiceConsumer::TestingOAuth2TokenServiceConsumer() |
+ : number_of_correct_tokens_(0), |
+ last_error_(GoogleServiceAuthError::AuthErrorNone()), |
+ number_of_errors_(0) { |
+} |
+ |
+TestingOAuth2TokenServiceConsumer::~TestingOAuth2TokenServiceConsumer() { |
+} |
+ |
+void TestingOAuth2TokenServiceConsumer::OnGetTokenSuccess( |
+ const OAuth2TokenService::Request* request, |
+ const std::string& token, |
+ const base::Time& expiration_date) { |
+ last_token_ = token; |
Andrew T Wilson (Slow)
2013/03/19 19:58:44
consider just tracking tokens in a vector, that wa
|
+ ++number_of_correct_tokens_; |
+} |
+ |
+void TestingOAuth2TokenServiceConsumer::OnGetTokenFailure( |
+ const OAuth2TokenService::Request* request, |
+ const GoogleServiceAuthError& error) { |
+ last_error_ = error; |
Andrew T Wilson (Slow)
2013/03/19 19:58:44
consider tracking errors in a vector rather than c
|
+ ++number_of_errors_; |
+} |