| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 public: | 44 public: |
| 45 explicit TestCloudPrintURLFetcher( | 45 explicit TestCloudPrintURLFetcher( |
| 46 base::MessageLoopProxy* io_message_loop_proxy) | 46 base::MessageLoopProxy* io_message_loop_proxy) |
| 47 : io_message_loop_proxy_(io_message_loop_proxy) { | 47 : io_message_loop_proxy_(io_message_loop_proxy) { |
| 48 } | 48 } |
| 49 | 49 |
| 50 virtual net::URLRequestContextGetter* GetRequestContextGetter() { | 50 virtual net::URLRequestContextGetter* GetRequestContextGetter() { |
| 51 return new TrackingTestURLRequestContextGetter( | 51 return new TrackingTestURLRequestContextGetter( |
| 52 io_message_loop_proxy_.get()); | 52 io_message_loop_proxy_.get()); |
| 53 } | 53 } |
| 54 |
| 54 private: | 55 private: |
| 56 virtual ~TestCloudPrintURLFetcher() {} |
| 57 |
| 55 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; | 58 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; |
| 56 }; | 59 }; |
| 57 | 60 |
| 58 class CloudPrintURLFetcherTest : public testing::Test, | 61 class CloudPrintURLFetcherTest : public testing::Test, |
| 59 public CloudPrintURLFetcherDelegate { | 62 public CloudPrintURLFetcherDelegate { |
| 60 public: | 63 public: |
| 61 CloudPrintURLFetcherTest() : max_retries_(0), fetcher_(NULL) { } | 64 CloudPrintURLFetcherTest() : max_retries_(0), fetcher_(NULL) { } |
| 62 | 65 |
| 63 // Creates a URLFetcher, using the program's main thread to do IO. | 66 // Creates a URLFetcher, using the program's main thread to do IO. |
| 64 virtual void CreateFetcher(const GURL& url, int max_retries); | 67 virtual void CreateFetcher(const GURL& url, int max_retries); |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 manager->OverrideEntryForTests(url, entry); | 359 manager->OverrideEntryForTests(url, entry); |
| 357 | 360 |
| 358 CreateFetcher(url, 11); | 361 CreateFetcher(url, 11); |
| 359 | 362 |
| 360 MessageLoop::current()->Run(); | 363 MessageLoop::current()->Run(); |
| 361 | 364 |
| 362 net::URLRequestThrottlerManager::GetInstance()->EraseEntryForTests(url); | 365 net::URLRequestThrottlerManager::GetInstance()->EraseEntryForTests(url); |
| 363 } | 366 } |
| 364 | 367 |
| 365 } // namespace. | 368 } // namespace. |
| OLD | NEW |