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_proxy.h" | 7 #include "base/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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 private: | 210 private: |
211 int response_count_; | 211 int response_count_; |
212 }; | 212 }; |
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> entry( | 220 scoped_refptr<net::URLRequestThrottlerEntry> |
221 new net::URLRequestThrottlerEntry( | 221 entry(new net::URLRequestThrottlerEntry( |
222 fetcher_->throttler_manager(), "", 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); |
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, |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 base::FilePath(kDocRoot)); | 367 base::FilePath(kDocRoot)); |
368 ASSERT_TRUE(test_server.Start()); | 368 ASSERT_TRUE(test_server.Start()); |
369 | 369 |
370 GURL url(test_server.GetURL("defaultresponse")); | 370 GURL url(test_server.GetURL("defaultresponse")); |
371 CreateFetcher(url, 11); | 371 CreateFetcher(url, 11); |
372 | 372 |
373 MessageLoop::current()->Run(); | 373 MessageLoop::current()->Run(); |
374 } | 374 } |
375 | 375 |
376 } // namespace cloud_print | 376 } // namespace cloud_print |
OLD | NEW |