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

Side by Side Diff: chrome/service/cloud_print/cloud_print_url_fetcher_unittest.cc

Issue 2035293002: Remove URLRequest::GetResponseCookies and URLRequestJob::GetResponseCookies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments rogerta Created 4 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 #include "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/location.h" 6 #include "base/location.h"
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/synchronization/waitable_event.h" 10 #include "base/synchronization/waitable_event.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 93
94 // Creates a URLFetcher, using the program's main thread to do IO. 94 // Creates a URLFetcher, using the program's main thread to do IO.
95 virtual void CreateFetcher(const GURL& url, int max_retries); 95 virtual void CreateFetcher(const GURL& url, int max_retries);
96 96
97 // CloudPrintURLFetcher::Delegate 97 // CloudPrintURLFetcher::Delegate
98 CloudPrintURLFetcher::ResponseAction HandleRawResponse( 98 CloudPrintURLFetcher::ResponseAction HandleRawResponse(
99 const net::URLFetcher* source, 99 const net::URLFetcher* source,
100 const GURL& url, 100 const GURL& url,
101 const net::URLRequestStatus& status, 101 const net::URLRequestStatus& status,
102 int response_code, 102 int response_code,
103 const net::ResponseCookies& cookies,
104 const std::string& data) override; 103 const std::string& data) override;
105 104
106 CloudPrintURLFetcher::ResponseAction OnRequestAuthError() override { 105 CloudPrintURLFetcher::ResponseAction OnRequestAuthError() override {
107 ADD_FAILURE(); 106 ADD_FAILURE();
108 return CloudPrintURLFetcher::STOP_PROCESSING; 107 return CloudPrintURLFetcher::STOP_PROCESSING;
109 } 108 }
110 109
111 std::string GetAuthHeader() override { return std::string(); } 110 std::string GetAuthHeader() override { return std::string(); }
112 111
113 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner() { 112 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner() {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 public: 144 public:
146 CloudPrintURLFetcherBasicTest() 145 CloudPrintURLFetcherBasicTest()
147 : handle_raw_response_(false), handle_raw_data_(false) {} 146 : handle_raw_response_(false), handle_raw_data_(false) {}
148 147
149 // CloudPrintURLFetcher::Delegate 148 // CloudPrintURLFetcher::Delegate
150 CloudPrintURLFetcher::ResponseAction HandleRawResponse( 149 CloudPrintURLFetcher::ResponseAction HandleRawResponse(
151 const net::URLFetcher* source, 150 const net::URLFetcher* source,
152 const GURL& url, 151 const GURL& url,
153 const net::URLRequestStatus& status, 152 const net::URLRequestStatus& status,
154 int response_code, 153 int response_code,
155 const net::ResponseCookies& cookies,
156 const std::string& data) override; 154 const std::string& data) override;
157 155
158 CloudPrintURLFetcher::ResponseAction HandleRawData( 156 CloudPrintURLFetcher::ResponseAction HandleRawData(
159 const net::URLFetcher* source, 157 const net::URLFetcher* source,
160 const GURL& url, 158 const GURL& url,
161 const std::string& data) override; 159 const std::string& data) override;
162 160
163 CloudPrintURLFetcher::ResponseAction HandleJSONData( 161 CloudPrintURLFetcher::ResponseAction HandleJSONData(
164 const net::URLFetcher* source, 162 const net::URLFetcher* source,
165 const GURL& url, 163 const GURL& url,
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 fetcher_->StartGetRequest(CloudPrintURLFetcher::REQUEST_MAX, url, this, 226 fetcher_->StartGetRequest(CloudPrintURLFetcher::REQUEST_MAX, url, this,
229 max_retries_, std::string()); 227 max_retries_, std::string());
230 } 228 }
231 229
232 CloudPrintURLFetcher::ResponseAction 230 CloudPrintURLFetcher::ResponseAction
233 CloudPrintURLFetcherTest::HandleRawResponse( 231 CloudPrintURLFetcherTest::HandleRawResponse(
234 const net::URLFetcher* source, 232 const net::URLFetcher* source,
235 const GURL& url, 233 const GURL& url,
236 const net::URLRequestStatus& status, 234 const net::URLRequestStatus& status,
237 int response_code, 235 int response_code,
238 const net::ResponseCookies& cookies,
239 const std::string& data) { 236 const std::string& data) {
240 EXPECT_TRUE(status.is_success()); 237 EXPECT_TRUE(status.is_success());
241 EXPECT_EQ(200, response_code); // HTTP OK 238 EXPECT_EQ(200, response_code); // HTTP OK
242 EXPECT_FALSE(data.empty()); 239 EXPECT_FALSE(data.empty());
243 return CloudPrintURLFetcher::CONTINUE_PROCESSING; 240 return CloudPrintURLFetcher::CONTINUE_PROCESSING;
244 } 241 }
245 242
246 CloudPrintURLFetcher::ResponseAction 243 CloudPrintURLFetcher::ResponseAction
247 CloudPrintURLFetcherBasicTest::HandleRawResponse( 244 CloudPrintURLFetcherBasicTest::HandleRawResponse(
248 const net::URLFetcher* source, 245 const net::URLFetcher* source,
249 const GURL& url, 246 const GURL& url,
250 const net::URLRequestStatus& status, 247 const net::URLRequestStatus& status,
251 int response_code, 248 int response_code,
252 const net::ResponseCookies& cookies,
253 const std::string& data) { 249 const std::string& data) {
254 EXPECT_TRUE(status.is_success()); 250 EXPECT_TRUE(status.is_success());
255 EXPECT_EQ(200, response_code); // HTTP OK 251 EXPECT_EQ(200, response_code); // HTTP OK
256 EXPECT_FALSE(data.empty()); 252 EXPECT_FALSE(data.empty());
257 253
258 if (handle_raw_response_) { 254 if (handle_raw_response_) {
259 // If the current message loop is not the IO loop, it will be shut down when 255 // If the current message loop is not the IO loop, it will be shut down when
260 // the main loop returns and this thread subsequently goes out of scope. 256 // the main loop returns and this thread subsequently goes out of scope.
261 io_task_runner()->PostTask(FROM_HERE, 257 io_task_runner()->PostTask(FROM_HERE,
262 base::MessageLoop::QuitWhenIdleClosure()); 258 base::MessageLoop::QuitWhenIdleClosure());
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 test_server.AddDefaultHandlers(base::FilePath(kDocRoot)); 364 test_server.AddDefaultHandlers(base::FilePath(kDocRoot));
369 ASSERT_TRUE(test_server.Start()); 365 ASSERT_TRUE(test_server.Start());
370 366
371 GURL url(test_server.GetURL("/defaultresponse")); 367 GURL url(test_server.GetURL("/defaultresponse"));
372 CreateFetcher(url, 11); 368 CreateFetcher(url, 11);
373 369
374 base::MessageLoop::current()->Run(); 370 base::MessageLoop::current()->Run();
375 } 371 }
376 372
377 } // namespace cloud_print 373 } // namespace cloud_print
OLDNEW
« no previous file with comments | « chrome/service/cloud_print/cloud_print_url_fetcher.cc ('k') | chrome/service/cloud_print/printer_job_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698