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

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

Issue 649283003: Standardize usage of virtual/override/final in google_apis/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 30 matching lines...) Expand all
41 net::URLFetcherDelegate* d) 41 net::URLFetcherDelegate* d)
42 : net::TestURLFetcher(0, url, d), 42 : net::TestURLFetcher(0, url, d),
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 ~MockOAuthFetcher() override {}
52 52
53 virtual void Start() override { 53 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 16 matching lines...) Expand all
80 }; 80 };
81 81
82 class MockOAuthFetcherFactory : public net::URLFetcherFactory, 82 class MockOAuthFetcherFactory : public net::URLFetcherFactory,
83 public net::ScopedURLFetcherFactory { 83 public net::ScopedURLFetcherFactory {
84 public: 84 public:
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 ~MockOAuthFetcherFactory() override {}
91 virtual net::URLFetcher* CreateURLFetcher( 91 net::URLFetcher* CreateURLFetcher(int id,
92 int id, 92 const GURL& url,
93 const GURL& url, 93 net::URLFetcher::RequestType request_type,
94 net::URLFetcher::RequestType request_type, 94 net::URLFetcherDelegate* d) override {
95 net::URLFetcherDelegate* d) override {
96 url_fetcher_ = new MockOAuthFetcher( 95 url_fetcher_ = new MockOAuthFetcher(
97 response_code_, 96 response_code_,
98 max_failure_count_, 97 max_failure_count_,
99 complete_immediately_, 98 complete_immediately_,
100 url, 99 url,
101 results_, 100 results_,
102 request_type, 101 request_type,
103 d); 102 d);
104 return url_fetcher_; 103 return url_fetcher_;
105 } 104 }
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 382
384 GaiaOAuthClient auth(GetRequestContext()); 383 GaiaOAuthClient auth(GetRequestContext());
385 auth.GetTokenInfo("access_token", 1, &delegate); 384 auth.GetTokenInfo("access_token", 1, &delegate);
386 385
387 std::string issued_to; 386 std::string issued_to;
388 ASSERT_TRUE(captured_result->GetString("issued_to", &issued_to)); 387 ASSERT_TRUE(captured_result->GetString("issued_to", &issued_to));
389 ASSERT_EQ("1234567890.apps.googleusercontent.com", issued_to); 388 ASSERT_EQ("1234567890.apps.googleusercontent.com", issued_to);
390 } 389 }
391 390
392 } // namespace gaia 391 } // 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