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

Side by Side Diff: google_apis/gaia/oauth2_token_service_request_unittest.cc

Issue 1143323005: Refactor AO2TS to make it easier to componentize. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address final comments Created 5 years, 5 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "google_apis/gaia/oauth2_token_service_request.h" 5 #include "google_apis/gaia/oauth2_token_service_request.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } 83 }
84 84
85 protected: 85 protected:
86 void FetchOAuth2Token(RequestImpl* request, 86 void FetchOAuth2Token(RequestImpl* request,
87 const std::string& account_id, 87 const std::string& account_id,
88 net::URLRequestContextGetter* getter, 88 net::URLRequestContextGetter* getter,
89 const std::string& client_id, 89 const std::string& client_id,
90 const std::string& client_secret, 90 const std::string& client_secret,
91 const ScopeSet& scopes) override; 91 const ScopeSet& scopes) override;
92 92
93 void InvalidateOAuth2Token(const std::string& account_id, 93 void InvalidateAccessTokenImpl(const std::string& account_id,
94 const std::string& client_id, 94 const std::string& client_id,
95 const ScopeSet& scopes, 95 const ScopeSet& scopes,
96 const std::string& access_token) override; 96 const std::string& access_token) override;
97 97
98 private: 98 private:
99 GoogleServiceAuthError response_error_; 99 GoogleServiceAuthError response_error_;
100 std::string response_access_token_; 100 std::string response_access_token_;
101 base::Time response_expiration_; 101 base::Time response_expiration_;
102 int num_invalidate_token_; 102 int num_invalidate_token_;
103 std::string last_token_invalidated_; 103 std::string last_token_invalidated_;
104 }; 104 };
105 105
106 MockOAuth2TokenService::MockOAuth2TokenService() 106 MockOAuth2TokenService::MockOAuth2TokenService()
(...skipping 23 matching lines...) Expand all
130 const ScopeSet& scopes) { 130 const ScopeSet& scopes) {
131 base::MessageLoop::current()->PostTask( 131 base::MessageLoop::current()->PostTask(
132 FROM_HERE, 132 FROM_HERE,
133 base::Bind(&OAuth2TokenService::RequestImpl::InformConsumer, 133 base::Bind(&OAuth2TokenService::RequestImpl::InformConsumer,
134 request->AsWeakPtr(), 134 request->AsWeakPtr(),
135 response_error_, 135 response_error_,
136 response_access_token_, 136 response_access_token_,
137 response_expiration_)); 137 response_expiration_));
138 } 138 }
139 139
140 void MockOAuth2TokenService::InvalidateOAuth2Token( 140 void MockOAuth2TokenService::InvalidateAccessTokenImpl(
141 const std::string& account_id, 141 const std::string& account_id,
142 const std::string& client_id, 142 const std::string& client_id,
143 const ScopeSet& scopes, 143 const ScopeSet& scopes,
144 const std::string& access_token) { 144 const std::string& access_token) {
145 ++num_invalidate_token_; 145 ++num_invalidate_token_;
146 last_token_invalidated_ = access_token; 146 last_token_invalidated_ = access_token;
147 } 147 }
148 148
149 class OAuth2TokenServiceRequestTest : public testing::Test { 149 class OAuth2TokenServiceRequestTest : public testing::Test {
150 public: 150 public:
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 OAuth2TokenServiceRequest::InvalidateToken( 262 OAuth2TokenServiceRequest::InvalidateToken(
263 provider_.get(), kAccountId, scopes_, kAccessToken); 263 provider_.get(), kAccountId, scopes_, kAccessToken);
264 ui_loop_.RunUntilIdle(); 264 ui_loop_.RunUntilIdle();
265 EXPECT_EQ(0, consumer_.num_get_token_success_); 265 EXPECT_EQ(0, consumer_.num_get_token_success_);
266 EXPECT_EQ(0, consumer_.num_get_token_failure_); 266 EXPECT_EQ(0, consumer_.num_get_token_failure_);
267 EXPECT_EQ(kAccessToken, oauth2_service_->last_token_invalidated()); 267 EXPECT_EQ(kAccessToken, oauth2_service_->last_token_invalidated());
268 EXPECT_EQ(1, oauth2_service_->num_invalidate_token()); 268 EXPECT_EQ(1, oauth2_service_->num_invalidate_token());
269 } 269 }
270 270
271 } // namespace 271 } // namespace
OLDNEW
« no previous file with comments | « google_apis/gaia/oauth2_token_service_request.cc ('k') | google_apis/gaia/oauth2_token_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698