Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(369)

Side by Side Diff: chrome/browser/signin/oauth2_token_service_test_util.cc

Issue 12647008: Refactor OAuth2TokenService to have profile- and device-based implementations. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebase again Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/signin/oauth2_token_service_test_util.h"
6
7 const char kValidTokenResponse[] =
8 "{"
9 " \"access_token\": \"%s\","
10 " \"expires_in\": %d,"
11 " \"token_type\": \"Bearer\""
12 "}";
13
14 std::string GetValidTokenResponse(std::string token, int expiration) {
15 return base::StringPrintf(kValidTokenResponse, token.c_str(), expiration);
16 }
17
18 TestingOAuth2TokenServiceConsumer::TestingOAuth2TokenServiceConsumer()
19 : number_of_successful_tokens_(0),
20 last_error_(GoogleServiceAuthError::AuthErrorNone()),
21 number_of_errors_(0) {
22 }
23
24 TestingOAuth2TokenServiceConsumer::~TestingOAuth2TokenServiceConsumer() {
25 }
26
27 void TestingOAuth2TokenServiceConsumer::OnGetTokenSuccess(
28 const OAuth2TokenService::Request* request,
29 const std::string& token,
30 const base::Time& expiration_date) {
31 last_token_ = token;
32 ++number_of_successful_tokens_;
33 }
34
35 void TestingOAuth2TokenServiceConsumer::OnGetTokenFailure(
36 const OAuth2TokenService::Request* request,
37 const GoogleServiceAuthError& error) {
38 last_error_ = error;
39 ++number_of_errors_;
40 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/oauth2_token_service_test_util.h ('k') | chrome/browser/signin/oauth2_token_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698