OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |