| 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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 const std::string& data) OVERRIDE; | 206 const std::string& data) OVERRIDE; |
| 207 | 207 |
| 208 virtual void OnRequestGiveUp() OVERRIDE; | 208 virtual void OnRequestGiveUp() OVERRIDE; |
| 209 | 209 |
| 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().get()); |
| 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.get()); | 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(); |
| (...skipping 145 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 |