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

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

Issue 1117703002: Adjust URLFetcher::Create API so that object is returned as scoped_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unneeded Pass() calls Created 5 years, 7 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/mock_url_fetcher_factory.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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 ~MockOAuthFetcherFactory() override {} 90 ~MockOAuthFetcherFactory() override {}
91 net::URLFetcher* CreateURLFetcher(int id, 91 scoped_ptr<net::URLFetcher> CreateURLFetcher(
92 const GURL& url, 92 int id,
93 net::URLFetcher::RequestType request_type, 93 const GURL& url,
94 net::URLFetcherDelegate* d) override { 94 net::URLFetcher::RequestType request_type,
95 net::URLFetcherDelegate* d) override {
95 url_fetcher_ = new MockOAuthFetcher( 96 url_fetcher_ = new MockOAuthFetcher(
96 response_code_, 97 response_code_,
97 max_failure_count_, 98 max_failure_count_,
98 complete_immediately_, 99 complete_immediately_,
99 url, 100 url,
100 results_, 101 results_,
101 request_type, 102 request_type,
102 d); 103 d);
103 return url_fetcher_; 104 return scoped_ptr<net::URLFetcher>(url_fetcher_);
104 } 105 }
105 void set_response_code(int response_code) { 106 void set_response_code(int response_code) {
106 response_code_ = response_code; 107 response_code_ = response_code;
107 } 108 }
108 void set_max_failure_count(int count) { 109 void set_max_failure_count(int count) {
109 max_failure_count_ = count; 110 max_failure_count_ = count;
110 } 111 }
111 void set_results(const std::string& results) { 112 void set_results(const std::string& results) {
112 results_ = results; 113 results_ = results;
113 } 114 }
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 407
407 GaiaOAuthClient auth(GetRequestContext()); 408 GaiaOAuthClient auth(GetRequestContext());
408 auth.GetTokenHandleInfo("some_handle", 1, &delegate); 409 auth.GetTokenHandleInfo("some_handle", 1, &delegate);
409 410
410 std::string audience; 411 std::string audience;
411 ASSERT_TRUE(captured_result->GetString("audience", &audience)); 412 ASSERT_TRUE(captured_result->GetString("audience", &audience));
412 ASSERT_EQ("1234567890.apps.googleusercontent.com", audience); 413 ASSERT_EQ("1234567890.apps.googleusercontent.com", audience);
413 } 414 }
414 415
415 } // namespace gaia 416 } // namespace gaia
OLDNEW
« no previous file with comments | « google_apis/gaia/gaia_oauth_client.cc ('k') | google_apis/gaia/mock_url_fetcher_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698