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

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

Issue 1184713004: google_apis: Migrate callers of message_loop_proxy() to task_runner() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 6 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 MOCK_METHOD1(ProcessMintAccessTokenFailure, 92 MOCK_METHOD1(ProcessMintAccessTokenFailure,
93 void (const GoogleServiceAuthError& error)); 93 void (const GoogleServiceAuthError& error));
94 }; 94 };
95 95
96 } // namespace 96 } // namespace
97 97
98 class OAuth2ApiCallFlowTest : public testing::Test { 98 class OAuth2ApiCallFlowTest : public testing::Test {
99 protected: 99 protected:
100 OAuth2ApiCallFlowTest() 100 OAuth2ApiCallFlowTest()
101 : request_context_getter_(new net::TestURLRequestContextGetter( 101 : request_context_getter_(new net::TestURLRequestContextGetter(
102 message_loop_.message_loop_proxy())) {} 102 message_loop_.task_runner())) {}
103 103
104 TestURLFetcher* CreateURLFetcher( 104 TestURLFetcher* CreateURLFetcher(
105 const GURL& url, bool fetch_succeeds, 105 const GURL& url, bool fetch_succeeds,
106 int response_code, const std::string& body) { 106 int response_code, const std::string& body) {
107 TestURLFetcher* url_fetcher = new TestURLFetcher(0, url, &flow_); 107 TestURLFetcher* url_fetcher = new TestURLFetcher(0, url, &flow_);
108 URLRequestStatus::Status status = 108 URLRequestStatus::Status status =
109 fetch_succeeds ? URLRequestStatus::SUCCESS : URLRequestStatus::FAILED; 109 fetch_succeeds ? URLRequestStatus::SUCCESS : URLRequestStatus::FAILED;
110 url_fetcher->set_status(URLRequestStatus(status, 0)); 110 url_fetcher->set_status(URLRequestStatus(status, 0));
111 111
112 if (response_code != 0) 112 if (response_code != 0)
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 TestURLFetcher* url_fetcher = SetupApiCall(true, net::HTTP_OK); 164 TestURLFetcher* url_fetcher = SetupApiCall(true, net::HTTP_OK);
165 flow_.Start(request_context_getter_.get(), kAccessToken); 165 flow_.Start(request_context_getter_.get(), kAccessToken);
166 HttpRequestHeaders headers; 166 HttpRequestHeaders headers;
167 url_fetcher->GetExtraRequestHeaders(&headers); 167 url_fetcher->GetExtraRequestHeaders(&headers);
168 std::string auth_header; 168 std::string auth_header;
169 EXPECT_TRUE(headers.GetHeader("Authorization", &auth_header)); 169 EXPECT_TRUE(headers.GetHeader("Authorization", &auth_header));
170 EXPECT_EQ("Bearer access_token", auth_header); 170 EXPECT_EQ("Bearer access_token", auth_header);
171 EXPECT_EQ(url, url_fetcher->GetOriginalURL()); 171 EXPECT_EQ(url, url_fetcher->GetOriginalURL());
172 EXPECT_EQ(body, url_fetcher->upload_data()); 172 EXPECT_EQ(body, url_fetcher->upload_data());
173 } 173 }
OLDNEW
« no previous file with comments | « google_apis/gaia/gaia_oauth_client_unittest.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