| OLD | NEW |
| 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/memory/ref_counted.h" | 6 #include "base/memory/ref_counted.h" |
| 7 #include "base/message_loop/message_loop_proxy.h" | 7 #include "base/message_loop/message_loop_proxy.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 "base/values.h" | 10 #include "base/values.h" |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 | 213 |
| 214 | 214 |
| 215 void CloudPrintURLFetcherTest::CreateFetcher(const GURL& url, int max_retries) { | 215 void CloudPrintURLFetcherTest::CreateFetcher(const GURL& url, int max_retries) { |
| 216 fetcher_ = new TestCloudPrintURLFetcher(io_message_loop_proxy()); | 216 fetcher_ = new TestCloudPrintURLFetcher(io_message_loop_proxy()); |
| 217 | 217 |
| 218 // Registers an entry for test url. It only allows 3 requests to be sent | 218 // Registers an entry for test url. It only allows 3 requests to be sent |
| 219 // in 200 milliseconds. | 219 // in 200 milliseconds. |
| 220 scoped_refptr<net::URLRequestThrottlerEntry> | 220 scoped_refptr<net::URLRequestThrottlerEntry> |
| 221 entry(new net::URLRequestThrottlerEntry( | 221 entry(new net::URLRequestThrottlerEntry( |
| 222 fetcher_->throttler_manager(), std::string(), 200, 3, 1, 2.0, 0.0, 256)); | 222 fetcher_->throttler_manager(), std::string(), 200, 3, 1, 2.0, 0.0, 256)); |
| 223 fetcher_->throttler_manager()->OverrideEntryForTests(url, entry); | 223 fetcher_->throttler_manager()->OverrideEntryForTests(url, entry.get()); |
| 224 | 224 |
| 225 max_retries_ = max_retries; | 225 max_retries_ = max_retries; |
| 226 start_time_ = Time::Now(); | 226 start_time_ = Time::Now(); |
| 227 fetcher_->StartGetRequest(url, this, max_retries_, std::string()); | 227 fetcher_->StartGetRequest(url, this, max_retries_, std::string()); |
| 228 } | 228 } |
| 229 | 229 |
| 230 CloudPrintURLFetcher::ResponseAction | 230 CloudPrintURLFetcher::ResponseAction |
| 231 CloudPrintURLFetcherTest::HandleRawResponse( | 231 CloudPrintURLFetcherTest::HandleRawResponse( |
| 232 const net::URLFetcher* source, | 232 const net::URLFetcher* source, |
| 233 const GURL& url, | 233 const GURL& url, |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 base::FilePath(kDocRoot)); | 372 base::FilePath(kDocRoot)); |
| 373 ASSERT_TRUE(test_server.Start()); | 373 ASSERT_TRUE(test_server.Start()); |
| 374 | 374 |
| 375 GURL url(test_server.GetURL("defaultresponse")); | 375 GURL url(test_server.GetURL("defaultresponse")); |
| 376 CreateFetcher(url, 11); | 376 CreateFetcher(url, 11); |
| 377 | 377 |
| 378 base::MessageLoop::current()->Run(); | 378 base::MessageLoop::current()->Run(); |
| 379 } | 379 } |
| 380 | 380 |
| 381 } // namespace cloud_print | 381 } // namespace cloud_print |
| OLD | NEW |