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

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

Issue 6523040: Added support to the Windows cloud print proxy to print XPS documents directl... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Code review changes Created 9 years, 10 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) 2011 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/synchronization/waitable_event.h" 8 #include "base/synchronization/waitable_event.h"
9 #include "base/threading/thread.h" 9 #include "base/threading/thread.h"
10 #include "chrome/common/net/url_request_context_getter.h" 10 #include "chrome/common/net/url_request_context_getter.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 185
186 private: 186 private:
187 int response_count_; 187 int response_count_;
188 }; 188 };
189 189
190 190
191 void CloudPrintURLFetcherTest::CreateFetcher(const GURL& url, int max_retries) { 191 void CloudPrintURLFetcherTest::CreateFetcher(const GURL& url, int max_retries) {
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_, std::string());
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 net::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) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 return CloudPrintURLFetcher::STOP_PROCESSING; 257 return CloudPrintURLFetcher::STOP_PROCESSING;
258 } 258 }
259 259
260 CloudPrintURLFetcher::ResponseAction 260 CloudPrintURLFetcher::ResponseAction
261 CloudPrintURLFetcherOverloadTest::HandleRawData(const URLFetcher* source, 261 CloudPrintURLFetcherOverloadTest::HandleRawData(const URLFetcher* source,
262 const GURL& url, 262 const GURL& url,
263 const std::string& data) { 263 const std::string& data) {
264 const TimeDelta one_second = TimeDelta::FromMilliseconds(1000); 264 const TimeDelta one_second = TimeDelta::FromMilliseconds(1000);
265 response_count_++; 265 response_count_++;
266 if (response_count_ < 20) { 266 if (response_count_ < 20) {
267 fetcher_->StartGetRequest(url, this, "", max_retries_); 267 fetcher_->StartGetRequest(url, this, "", max_retries_, std::string());
268 } else { 268 } else {
269 // We have already sent 20 requests continuously. And we expect that 269 // We have already sent 20 requests continuously. And we expect that
270 // it takes more than 1 second due to the overload protection settings. 270 // it takes more than 1 second due to the overload protection settings.
271 EXPECT_TRUE(Time::Now() - start_time_ >= one_second); 271 EXPECT_TRUE(Time::Now() - start_time_ >= one_second);
272 io_message_loop_proxy()->PostTask(FROM_HERE, new MessageLoop::QuitTask()); 272 io_message_loop_proxy()->PostTask(FROM_HERE, new MessageLoop::QuitTask());
273 } 273 }
274 return CloudPrintURLFetcher::STOP_PROCESSING; 274 return CloudPrintURLFetcher::STOP_PROCESSING;
275 } 275 }
276 276
277 CloudPrintURLFetcher::ResponseAction 277 CloudPrintURLFetcher::ResponseAction
(...skipping 70 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/service/cloud_print/job_status_updater.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698