| OLD | NEW |
| 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/threading/thread.h" | 8 #include "base/threading/thread.h" |
| 9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
| 10 #include "chrome/common/net/url_request_context_getter.h" | 10 #include "chrome/common/net/url_request_context_getter.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 const FilePath::CharType kDocRoot[] = FILE_PATH_LITERAL("chrome/test/data"); | 25 const FilePath::CharType kDocRoot[] = FILE_PATH_LITERAL("chrome/test/data"); |
| 26 | 26 |
| 27 int g_request_context_getter_instances = 0; | 27 int g_request_context_getter_instances = 0; |
| 28 class TestURLRequestContextGetter : public URLRequestContextGetter { | 28 class TestURLRequestContextGetter : public URLRequestContextGetter { |
| 29 public: | 29 public: |
| 30 explicit TestURLRequestContextGetter( | 30 explicit TestURLRequestContextGetter( |
| 31 base::MessageLoopProxy* io_message_loop_proxy) | 31 base::MessageLoopProxy* io_message_loop_proxy) |
| 32 : io_message_loop_proxy_(io_message_loop_proxy) { | 32 : io_message_loop_proxy_(io_message_loop_proxy) { |
| 33 g_request_context_getter_instances++; | 33 g_request_context_getter_instances++; |
| 34 } | 34 } |
| 35 virtual URLRequestContext* GetURLRequestContext() { | 35 virtual net::URLRequestContext* GetURLRequestContext() { |
| 36 if (!context_) | 36 if (!context_) |
| 37 context_ = new TestURLRequestContext(); | 37 context_ = new TestURLRequestContext(); |
| 38 return context_; | 38 return context_; |
| 39 } | 39 } |
| 40 virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() const { | 40 virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() const { |
| 41 return io_message_loop_proxy_; | 41 return io_message_loop_proxy_; |
| 42 } | 42 } |
| 43 | 43 |
| 44 protected: | 44 protected: |
| 45 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; | 45 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 ~TestURLRequestContextGetter() { | 48 ~TestURLRequestContextGetter() { |
| 49 g_request_context_getter_instances--; | 49 g_request_context_getter_instances--; |
| 50 } | 50 } |
| 51 | 51 |
| 52 scoped_refptr<URLRequestContext> context_; | 52 scoped_refptr<net::URLRequestContext> context_; |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 class TestCloudPrintURLFetcher : public CloudPrintURLFetcher { | 55 class TestCloudPrintURLFetcher : public CloudPrintURLFetcher { |
| 56 public: | 56 public: |
| 57 explicit TestCloudPrintURLFetcher( | 57 explicit TestCloudPrintURLFetcher( |
| 58 base::MessageLoopProxy* io_message_loop_proxy) | 58 base::MessageLoopProxy* io_message_loop_proxy) |
| 59 : io_message_loop_proxy_(io_message_loop_proxy) { | 59 : io_message_loop_proxy_(io_message_loop_proxy) { |
| 60 } | 60 } |
| 61 | 61 |
| 62 virtual URLRequestContextGetter* GetRequestContextGetter() { | 62 virtual URLRequestContextGetter* GetRequestContextGetter() { |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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. |
| OLD | NEW |