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

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

Issue 498123003: Remove implicit conversions from scoped_refptr to T* in google_apis/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 3 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 (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 OAuth2MintTokenFlow. 5 // A complete set of unit tests for OAuth2MintTokenFlow.
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 return url_fetcher; 136 return url_fetcher;
137 } 137 }
138 138
139 void CreateFlow(const std::string& refresh_token, 139 void CreateFlow(const std::string& refresh_token,
140 const std::string& access_token, 140 const std::string& access_token,
141 const std::vector<std::string>& scopes) { 141 const std::vector<std::string>& scopes) {
142 scoped_refptr<net::TestURLRequestContextGetter> request_context_getter = 142 scoped_refptr<net::TestURLRequestContextGetter> request_context_getter =
143 new net::TestURLRequestContextGetter( 143 new net::TestURLRequestContextGetter(
144 message_loop_.message_loop_proxy()); 144 message_loop_.message_loop_proxy());
145 flow_.reset(new MockApiCallFlow( 145 flow_.reset(new MockApiCallFlow(
146 request_context_getter, refresh_token, access_token, scopes)); 146 request_context_getter.get(), refresh_token, access_token, scopes));
147 access_token_fetcher_.reset(new MockAccessTokenFetcher( 147 access_token_fetcher_.reset(new MockAccessTokenFetcher(
148 flow_.get(), request_context_getter, refresh_token)); 148 flow_.get(), request_context_getter.get(), refresh_token));
149 } 149 }
150 150
151 TestURLFetcher* SetupApiCall(bool succeeds, net::HttpStatusCode status) { 151 TestURLFetcher* SetupApiCall(bool succeeds, net::HttpStatusCode status) {
152 std::string body(CreateBody()); 152 std::string body(CreateBody());
153 GURL url(CreateApiUrl()); 153 GURL url(CreateApiUrl());
154 EXPECT_CALL(*flow_, CreateApiCallBody()).WillOnce(Return(body)); 154 EXPECT_CALL(*flow_, CreateApiCallBody()).WillOnce(Return(body));
155 EXPECT_CALL(*flow_, CreateApiCallUrl()).WillOnce(Return(url)); 155 EXPECT_CALL(*flow_, CreateApiCallUrl()).WillOnce(Return(url));
156 TestURLFetcher* url_fetcher = 156 TestURLFetcher* url_fetcher =
157 CreateURLFetcher(url, succeeds, status, std::string()); 157 CreateURLFetcher(url, succeeds, status, std::string());
158 EXPECT_CALL(factory_, CreateURLFetcher(_, url, _, _)) 158 EXPECT_CALL(factory_, CreateURLFetcher(_, url, _, _))
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 scoped_ptr<TestURLFetcher> url_fetcher(SetupApiCall(true, net::HTTP_OK)); 287 scoped_ptr<TestURLFetcher> url_fetcher(SetupApiCall(true, net::HTTP_OK));
288 flow_->CreateURLFetcher(); 288 flow_->CreateURLFetcher();
289 HttpRequestHeaders headers; 289 HttpRequestHeaders headers;
290 url_fetcher->GetExtraRequestHeaders(&headers); 290 url_fetcher->GetExtraRequestHeaders(&headers);
291 std::string auth_header; 291 std::string auth_header;
292 EXPECT_TRUE(headers.GetHeader("Authorization", &auth_header)); 292 EXPECT_TRUE(headers.GetHeader("Authorization", &auth_header));
293 EXPECT_EQ("Bearer access_token", auth_header); 293 EXPECT_EQ("Bearer access_token", auth_header);
294 EXPECT_EQ(url, url_fetcher->GetOriginalURL()); 294 EXPECT_EQ(url, url_fetcher->GetOriginalURL());
295 EXPECT_EQ(body, url_fetcher->upload_data()); 295 EXPECT_EQ(body, url_fetcher->upload_data());
296 } 296 }
OLDNEW
« no previous file with comments | « google_apis/gaia/oauth2_access_token_fetcher_impl_unittest.cc ('k') | google_apis/gaia/oauth2_token_service_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698