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 "content/common/net/url_fetcher_impl.h" | 5 #include "content/common/net/url_fetcher_impl.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 // TODO(eroman): Add a regression test for http://crbug.com/40505. | 32 // TODO(eroman): Add a regression test for http://crbug.com/40505. |
33 | 33 |
34 namespace { | 34 namespace { |
35 | 35 |
36 const FilePath::CharType kDocRoot[] = FILE_PATH_LITERAL("chrome/test/data"); | 36 const FilePath::CharType kDocRoot[] = FILE_PATH_LITERAL("chrome/test/data"); |
37 const char kTestServerFilePrefix[] = "files/"; | 37 const char kTestServerFilePrefix[] = "files/"; |
38 | 38 |
39 class ThrottlingTestURLRequestContext : public TestURLRequestContext { | 39 class ThrottlingTestURLRequestContext : public TestURLRequestContext { |
40 public: | 40 public: |
41 ThrottlingTestURLRequestContext() : TestURLRequestContext(true) { | 41 ThrottlingTestURLRequestContext() |
| 42 : TestURLRequestContext(true), |
| 43 throttler_manager_(&delegate_) { |
42 set_throttler_manager(&throttler_manager_); | 44 set_throttler_manager(&throttler_manager_); |
43 Init(); | 45 Init(); |
44 DCHECK(throttler_manager() != NULL); | 46 DCHECK(throttler_manager() != NULL); |
45 } | 47 } |
46 | 48 |
47 private: | 49 private: |
| 50 TestURLRequestThrottlerManagerDelegate delegate_; |
48 net::URLRequestThrottlerManager throttler_manager_; | 51 net::URLRequestThrottlerManager throttler_manager_; |
49 }; | 52 }; |
50 | 53 |
51 class ThrottlingTestURLRequestContextGetter | 54 class ThrottlingTestURLRequestContextGetter |
52 : public TestURLRequestContextGetter { | 55 : public TestURLRequestContextGetter { |
53 public: | 56 public: |
54 ThrottlingTestURLRequestContextGetter( | 57 ThrottlingTestURLRequestContextGetter( |
55 base::MessageLoopProxy* io_message_loop_proxy, | 58 base::MessageLoopProxy* io_message_loop_proxy, |
56 TestURLRequestContext* request_context) | 59 TestURLRequestContext* request_context) |
57 : TestURLRequestContextGetter(io_message_loop_proxy), | 60 : TestURLRequestContextGetter(io_message_loop_proxy), |
(...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1146 std::string(kTestServerFilePrefix) + kFileToFetch)); | 1149 std::string(kTestServerFilePrefix) + kFileToFetch)); |
1147 | 1150 |
1148 MessageLoop::current()->Run(); // OnURLFetchComplete() will Quit(). | 1151 MessageLoop::current()->Run(); // OnURLFetchComplete() will Quit(). |
1149 | 1152 |
1150 MessageLoop::current()->RunAllPending(); | 1153 MessageLoop::current()->RunAllPending(); |
1151 ASSERT_FALSE(file_util::PathExists(file_path_)) | 1154 ASSERT_FALSE(file_util::PathExists(file_path_)) |
1152 << file_path_.value() << " not removed."; | 1155 << file_path_.value() << " not removed."; |
1153 } | 1156 } |
1154 | 1157 |
1155 } // namespace. | 1158 } // namespace. |
OLD | NEW |