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

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

Issue 625293003: replace OVERRIDE and FINAL with override and final in google_apis/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another rebase on master Created 6 years, 2 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 | « google_apis/gaia/gaia_oauth_client.cc ('k') | google_apis/gaia/identity_provider.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 // A complete set of unit tests for GaiaOAuthClient. 5 // A complete set of unit tests for GaiaOAuthClient.
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 max_failure_count_(max_failure_count), 43 max_failure_count_(max_failure_count),
44 current_failure_count_(0), 44 current_failure_count_(0),
45 complete_immediately_(complete_immediately) { 45 complete_immediately_(complete_immediately) {
46 set_url(url); 46 set_url(url);
47 set_response_code(response_code); 47 set_response_code(response_code);
48 SetResponseString(results); 48 SetResponseString(results);
49 } 49 }
50 50
51 virtual ~MockOAuthFetcher() { } 51 virtual ~MockOAuthFetcher() { }
52 52
53 virtual void Start() OVERRIDE { 53 virtual void Start() override {
54 if ((GetResponseCode() != net::HTTP_OK) && (max_failure_count_ != -1) && 54 if ((GetResponseCode() != net::HTTP_OK) && (max_failure_count_ != -1) &&
55 (current_failure_count_ == max_failure_count_)) { 55 (current_failure_count_ == max_failure_count_)) {
56 set_response_code(net::HTTP_OK); 56 set_response_code(net::HTTP_OK);
57 } 57 }
58 58
59 net::URLRequestStatus::Status code = net::URLRequestStatus::SUCCESS; 59 net::URLRequestStatus::Status code = net::URLRequestStatus::SUCCESS;
60 if (GetResponseCode() != net::HTTP_OK) { 60 if (GetResponseCode() != net::HTTP_OK) {
61 code = net::URLRequestStatus::FAILED; 61 code = net::URLRequestStatus::FAILED;
62 current_failure_count_++; 62 current_failure_count_++;
63 } 63 }
(...skipping 21 matching lines...) Expand all
85 MockOAuthFetcherFactory() 85 MockOAuthFetcherFactory()
86 : net::ScopedURLFetcherFactory(this), 86 : net::ScopedURLFetcherFactory(this),
87 response_code_(net::HTTP_OK), 87 response_code_(net::HTTP_OK),
88 complete_immediately_(true) { 88 complete_immediately_(true) {
89 } 89 }
90 virtual ~MockOAuthFetcherFactory() {} 90 virtual ~MockOAuthFetcherFactory() {}
91 virtual net::URLFetcher* CreateURLFetcher( 91 virtual net::URLFetcher* CreateURLFetcher(
92 int id, 92 int id,
93 const GURL& url, 93 const GURL& url,
94 net::URLFetcher::RequestType request_type, 94 net::URLFetcher::RequestType request_type,
95 net::URLFetcherDelegate* d) OVERRIDE { 95 net::URLFetcherDelegate* d) override {
96 url_fetcher_ = new MockOAuthFetcher( 96 url_fetcher_ = new MockOAuthFetcher(
97 response_code_, 97 response_code_,
98 max_failure_count_, 98 max_failure_count_,
99 complete_immediately_, 99 complete_immediately_,
100 url, 100 url,
101 results_, 101 results_,
102 request_type, 102 request_type,
103 d); 103 d);
104 return url_fetcher_; 104 return url_fetcher_;
105 } 105 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 "{\"issued_to\": \"1234567890.apps.googleusercontent.com\"," 165 "{\"issued_to\": \"1234567890.apps.googleusercontent.com\","
166 "\"audience\": \"1234567890.apps.googleusercontent.com\"," 166 "\"audience\": \"1234567890.apps.googleusercontent.com\","
167 "\"scope\": \"https://googleapis.com/oauth2/v2/tokeninfo\"," 167 "\"scope\": \"https://googleapis.com/oauth2/v2/tokeninfo\","
168 "\"expires_in\":" + base::IntToString(kTestExpiresIn) + "}"; 168 "\"expires_in\":" + base::IntToString(kTestExpiresIn) + "}";
169 } 169 }
170 170
171 namespace gaia { 171 namespace gaia {
172 172
173 class GaiaOAuthClientTest : public testing::Test { 173 class GaiaOAuthClientTest : public testing::Test {
174 protected: 174 protected:
175 virtual void SetUp() OVERRIDE { 175 virtual void SetUp() override {
176 client_info_.client_id = "test_client_id"; 176 client_info_.client_id = "test_client_id";
177 client_info_.client_secret = "test_client_secret"; 177 client_info_.client_secret = "test_client_secret";
178 client_info_.redirect_uri = "test_redirect_uri"; 178 client_info_.redirect_uri = "test_redirect_uri";
179 }; 179 };
180 180
181 protected: 181 protected:
182 net::TestURLRequestContextGetter* GetRequestContext() { 182 net::TestURLRequestContextGetter* GetRequestContext() {
183 if (!request_context_getter_.get()) { 183 if (!request_context_getter_.get()) {
184 request_context_getter_ = new net::TestURLRequestContextGetter( 184 request_context_getter_ = new net::TestURLRequestContextGetter(
185 message_loop_.message_loop_proxy()); 185 message_loop_.message_loop_proxy());
(...skipping 21 matching lines...) Expand all
207 MOCK_METHOD0(OnOAuthError, void()); 207 MOCK_METHOD0(OnOAuthError, void());
208 MOCK_METHOD1(OnNetworkError, void(int response_code)); 208 MOCK_METHOD1(OnNetworkError, void(int response_code));
209 209
210 // gMock doesn't like methods that take or return scoped_ptr. A 210 // gMock doesn't like methods that take or return scoped_ptr. A
211 // work-around is to create a mock method that takes a raw ptr, and 211 // work-around is to create a mock method that takes a raw ptr, and
212 // override the problematic method to call through to it. 212 // override the problematic method to call through to it.
213 // https://groups.google.com/a/chromium.org/d/msg/chromium-dev/01sDxsJ1OYw/I_S 0xCBRF2oJ 213 // https://groups.google.com/a/chromium.org/d/msg/chromium-dev/01sDxsJ1OYw/I_S 0xCBRF2oJ
214 MOCK_METHOD1(OnGetUserInfoResponsePtr, 214 MOCK_METHOD1(OnGetUserInfoResponsePtr,
215 void(const base::DictionaryValue* user_info)); 215 void(const base::DictionaryValue* user_info));
216 virtual void OnGetUserInfoResponse( 216 virtual void OnGetUserInfoResponse(
217 scoped_ptr<base::DictionaryValue> user_info) OVERRIDE { 217 scoped_ptr<base::DictionaryValue> user_info) override {
218 user_info_.reset(user_info.release()); 218 user_info_.reset(user_info.release());
219 OnGetUserInfoResponsePtr(user_info_.get()); 219 OnGetUserInfoResponsePtr(user_info_.get());
220 } 220 }
221 MOCK_METHOD1(OnGetTokenInfoResponsePtr, 221 MOCK_METHOD1(OnGetTokenInfoResponsePtr,
222 void(const base::DictionaryValue* token_info)); 222 void(const base::DictionaryValue* token_info));
223 virtual void OnGetTokenInfoResponse( 223 virtual void OnGetTokenInfoResponse(
224 scoped_ptr<base::DictionaryValue> token_info) OVERRIDE { 224 scoped_ptr<base::DictionaryValue> token_info) override {
225 token_info_.reset(token_info.release()); 225 token_info_.reset(token_info.release());
226 OnGetTokenInfoResponsePtr(token_info_.get()); 226 OnGetTokenInfoResponsePtr(token_info_.get());
227 } 227 }
228 228
229 private: 229 private:
230 scoped_ptr<base::DictionaryValue> user_info_; 230 scoped_ptr<base::DictionaryValue> user_info_;
231 scoped_ptr<base::DictionaryValue> token_info_; 231 scoped_ptr<base::DictionaryValue> token_info_;
232 DISALLOW_COPY_AND_ASSIGN(MockGaiaOAuthClientDelegate); 232 DISALLOW_COPY_AND_ASSIGN(MockGaiaOAuthClientDelegate);
233 }; 233 };
234 234
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 383
384 GaiaOAuthClient auth(GetRequestContext()); 384 GaiaOAuthClient auth(GetRequestContext());
385 auth.GetTokenInfo("access_token", 1, &delegate); 385 auth.GetTokenInfo("access_token", 1, &delegate);
386 386
387 std::string issued_to; 387 std::string issued_to;
388 ASSERT_TRUE(captured_result->GetString("issued_to", &issued_to)); 388 ASSERT_TRUE(captured_result->GetString("issued_to", &issued_to));
389 ASSERT_EQ("1234567890.apps.googleusercontent.com", issued_to); 389 ASSERT_EQ("1234567890.apps.googleusercontent.com", issued_to);
390 } 390 }
391 391
392 } // namespace gaia 392 } // namespace gaia
OLDNEW
« no previous file with comments | « google_apis/gaia/gaia_oauth_client.cc ('k') | google_apis/gaia/identity_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698