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

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

Issue 23382008: Making OAuth2TokenService multi-login aware, updating callers, minor fixes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing to include the update to ProfileSyncService: r224220 Created 7 years, 3 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
« no previous file with comments | « chrome/browser/signin/ubertoken_fetcher.cc ('k') | chrome/browser/sync/profile_sync_service.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 4
5 #include "chrome/browser/signin/ubertoken_fetcher.h" 5 #include "chrome/browser/signin/ubertoken_fetcher.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "chrome/browser/signin/profile_oauth2_token_service.h" 8 #include "chrome/browser/signin/profile_oauth2_token_service.h"
9 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 9 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
10 #include "chrome/browser/signin/token_service_unittest.h" 10 #include "chrome/browser/signin/token_service_unittest.h"
(...skipping 25 matching lines...) Expand all
36 36
37 std::string last_token_; 37 std::string last_token_;
38 int nb_correct_token_; 38 int nb_correct_token_;
39 GoogleServiceAuthError last_error_; 39 GoogleServiceAuthError last_error_;
40 int nb_error_; 40 int nb_error_;
41 }; 41 };
42 42
43 class MockOAuth2TokenService : public ProfileOAuth2TokenService { 43 class MockOAuth2TokenService : public ProfileOAuth2TokenService {
44 // OAuth2TokenService overrides: 44 // OAuth2TokenService overrides:
45 virtual scoped_ptr<OAuth2TokenService::Request> 45 virtual scoped_ptr<OAuth2TokenService::Request>
46 StartRequest(const OAuth2TokenService::ScopeSet& scopes, 46 StartRequest(const std::string& account_id,
47 const OAuth2TokenService::ScopeSet& scopes,
47 OAuth2TokenService::Consumer* consumer) OVERRIDE { 48 OAuth2TokenService::Consumer* consumer) OVERRIDE {
48 // Don't actually make a request. 49 // Don't actually make a request.
49 scoped_ptr<OAuth2TokenService::Request> request; 50 scoped_ptr<OAuth2TokenService::Request> request;
50 return request.Pass(); 51 return request.Pass();
51 } 52 }
52 }; 53 };
53 54
54 55
55 BrowserContextKeyedService* Build(content::BrowserContext* profile) { 56 BrowserContextKeyedService* Build(content::BrowserContext* profile) {
56 MockOAuth2TokenService* token_service = new MockOAuth2TokenService(); 57 MockOAuth2TokenService* token_service = new MockOAuth2TokenService();
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 service()->IssueAuthTokenForTest(GaiaConstants::kGaiaOAuth2LoginRefreshToken, 128 service()->IssueAuthTokenForTest(GaiaConstants::kGaiaOAuth2LoginRefreshToken,
128 "refreshToken"); 129 "refreshToken");
129 fetcher_->StartFetchingToken(); 130 fetcher_->StartFetchingToken();
130 fetcher_->OnGetTokenSuccess(NULL, "accessToken", base::Time()); 131 fetcher_->OnGetTokenSuccess(NULL, "accessToken", base::Time());
131 fetcher_->OnUberAuthTokenFailure(error); 132 fetcher_->OnUberAuthTokenFailure(error);
132 133
133 EXPECT_EQ(1, consumer_.nb_error_); 134 EXPECT_EQ(1, consumer_.nb_error_);
134 EXPECT_EQ(0, consumer_.nb_correct_token_); 135 EXPECT_EQ(0, consumer_.nb_correct_token_);
135 EXPECT_EQ("", consumer_.last_token_); 136 EXPECT_EQ("", consumer_.last_token_);
136 } 137 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/ubertoken_fetcher.cc ('k') | chrome/browser/sync/profile_sync_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698