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

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

Issue 6166010: net: Remove typedef net::URLRequestStatus URLRequestStatus; (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/message_loop_proxy.h" 6 #include "base/message_loop_proxy.h"
7 #include "base/ref_counted.h" 7 #include "base/ref_counted.h"
8 #include "base/threading/thread.h" 8 #include "base/threading/thread.h"
9 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "chrome/common/net/url_request_context_getter.h" 10 #include "chrome/common/net/url_request_context_getter.h"
11 #include "chrome/service/service_process.h" 11 #include "chrome/service/service_process.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 public: 71 public:
72 CloudPrintURLFetcherTest() : max_retries_(0), fetcher_(NULL) { } 72 CloudPrintURLFetcherTest() : max_retries_(0), fetcher_(NULL) { }
73 73
74 // Creates a URLFetcher, using the program's main thread to do IO. 74 // Creates a URLFetcher, using the program's main thread to do IO.
75 virtual void CreateFetcher(const GURL& url, int max_retries); 75 virtual void CreateFetcher(const GURL& url, int max_retries);
76 76
77 // CloudPrintURLFetcher::Delegate 77 // CloudPrintURLFetcher::Delegate
78 virtual CloudPrintURLFetcher::ResponseAction HandleRawResponse( 78 virtual CloudPrintURLFetcher::ResponseAction HandleRawResponse(
79 const URLFetcher* source, 79 const URLFetcher* source,
80 const GURL& url, 80 const GURL& url,
81 const URLRequestStatus& status, 81 const net::URLRequestStatus& status,
82 int response_code, 82 int response_code,
83 const ResponseCookies& cookies, 83 const ResponseCookies& cookies,
84 const std::string& data); 84 const std::string& data);
85 85
86 virtual void OnRequestAuthError() { 86 virtual void OnRequestAuthError() {
87 ADD_FAILURE(); 87 ADD_FAILURE();
88 } 88 }
89 89
90 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy() { 90 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy() {
91 return io_message_loop_proxy_; 91 return io_message_loop_proxy_;
(...skipping 27 matching lines...) Expand all
119 }; 119 };
120 120
121 class CloudPrintURLFetcherBasicTest : public CloudPrintURLFetcherTest { 121 class CloudPrintURLFetcherBasicTest : public CloudPrintURLFetcherTest {
122 public: 122 public:
123 CloudPrintURLFetcherBasicTest() 123 CloudPrintURLFetcherBasicTest()
124 : handle_raw_response_(false), handle_raw_data_(false) { } 124 : handle_raw_response_(false), handle_raw_data_(false) { }
125 // CloudPrintURLFetcher::Delegate 125 // CloudPrintURLFetcher::Delegate
126 virtual CloudPrintURLFetcher::ResponseAction HandleRawResponse( 126 virtual CloudPrintURLFetcher::ResponseAction HandleRawResponse(
127 const URLFetcher* source, 127 const URLFetcher* source,
128 const GURL& url, 128 const GURL& url,
129 const URLRequestStatus& status, 129 const net::URLRequestStatus& status,
130 int response_code, 130 int response_code,
131 const ResponseCookies& cookies, 131 const ResponseCookies& cookies,
132 const std::string& data); 132 const std::string& data);
133 133
134 virtual CloudPrintURLFetcher::ResponseAction HandleRawData( 134 virtual CloudPrintURLFetcher::ResponseAction HandleRawData(
135 const URLFetcher* source, 135 const URLFetcher* source,
136 const GURL& url, 136 const GURL& url,
137 const std::string& data); 137 const std::string& data);
138 138
139 virtual CloudPrintURLFetcher::ResponseAction HandleJSONData( 139 virtual CloudPrintURLFetcher::ResponseAction HandleJSONData(
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 fetcher_ = new TestCloudPrintURLFetcher(io_message_loop_proxy()); 192 fetcher_ = new TestCloudPrintURLFetcher(io_message_loop_proxy());
193 max_retries_ = max_retries; 193 max_retries_ = max_retries;
194 start_time_ = Time::Now(); 194 start_time_ = Time::Now();
195 fetcher_->StartGetRequest(url, this, "", max_retries_); 195 fetcher_->StartGetRequest(url, this, "", max_retries_);
196 } 196 }
197 197
198 CloudPrintURLFetcher::ResponseAction 198 CloudPrintURLFetcher::ResponseAction
199 CloudPrintURLFetcherTest::HandleRawResponse( 199 CloudPrintURLFetcherTest::HandleRawResponse(
200 const URLFetcher* source, 200 const URLFetcher* source,
201 const GURL& url, 201 const GURL& url,
202 const URLRequestStatus& status, 202 const net::URLRequestStatus& status,
203 int response_code, 203 int response_code,
204 const ResponseCookies& cookies, 204 const ResponseCookies& cookies,
205 const std::string& data) { 205 const std::string& data) {
206 EXPECT_TRUE(status.is_success()); 206 EXPECT_TRUE(status.is_success());
207 EXPECT_EQ(200, response_code); // HTTP OK 207 EXPECT_EQ(200, response_code); // HTTP OK
208 EXPECT_FALSE(data.empty()); 208 EXPECT_FALSE(data.empty());
209 return CloudPrintURLFetcher::CONTINUE_PROCESSING; 209 return CloudPrintURLFetcher::CONTINUE_PROCESSING;
210 } 210 }
211 211
212 CloudPrintURLFetcher::ResponseAction 212 CloudPrintURLFetcher::ResponseAction
213 CloudPrintURLFetcherBasicTest::HandleRawResponse( 213 CloudPrintURLFetcherBasicTest::HandleRawResponse(
214 const URLFetcher* source, 214 const URLFetcher* source,
215 const GURL& url, 215 const GURL& url,
216 const URLRequestStatus& status, 216 const net::URLRequestStatus& status,
217 int response_code, 217 int response_code,
218 const ResponseCookies& cookies, 218 const ResponseCookies& cookies,
219 const std::string& data) { 219 const std::string& data) {
220 EXPECT_TRUE(status.is_success()); 220 EXPECT_TRUE(status.is_success());
221 EXPECT_EQ(200, response_code); // HTTP OK 221 EXPECT_EQ(200, response_code); // HTTP OK
222 EXPECT_FALSE(data.empty()); 222 EXPECT_FALSE(data.empty());
223 223
224 if (handle_raw_response_) { 224 if (handle_raw_response_) {
225 // If the current message loop is not the IO loop, it will be shut down when 225 // If the current message loop is not the IO loop, it will be shut down when
226 // the main loop returns and this thread subsequently goes out of scope. 226 // the main loop returns and this thread subsequently goes out of scope.
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 url, entry); 348 url, entry);
349 349
350 CreateFetcher(url, 11); 350 CreateFetcher(url, 11);
351 351
352 MessageLoop::current()->Run(); 352 MessageLoop::current()->Run();
353 353
354 net::URLRequestThrottlerManager::GetInstance()->EraseEntryForTests(url); 354 net::URLRequestThrottlerManager::GetInstance()->EraseEntryForTests(url);
355 } 355 }
356 356
357 } // namespace. 357 } // namespace.
OLDNEW
« no previous file with comments | « chrome/service/cloud_print/cloud_print_url_fetcher.cc ('k') | chrome/test/automation/automation_proxy_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698