OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "net/url_request/sdch_dictionary_fetcher.h" | 5 #include "net/url_request/sdch_dictionary_fetcher.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
| 8 #include <utility> |
8 #include <vector> | 9 #include <vector> |
9 | 10 |
10 #include "base/bind.h" | 11 #include "base/bind.h" |
11 #include "base/callback.h" | 12 #include "base/callback.h" |
12 #include "base/logging.h" | 13 #include "base/logging.h" |
13 #include "base/macros.h" | 14 #include "base/macros.h" |
14 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
15 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
16 #include "base/thread_task_runner_handle.h" | 17 #include "base/thread_task_runner_handle.h" |
17 #include "net/base/load_flags.h" | 18 #include "net/base/load_flags.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 | 118 |
118 // The caller must ensure that both |*http_response_info| and the | 119 // The caller must ensure that both |*http_response_info| and the |
119 // callback remain valid for the lifetime of the | 120 // callback remain valid for the lifetime of the |
120 // SpecifiedResponseJobInterceptor (i.e. until Unregister() is called). | 121 // SpecifiedResponseJobInterceptor (i.e. until Unregister() is called). |
121 static void RegisterWithFilter(HttpResponseInfo* http_response_info, | 122 static void RegisterWithFilter(HttpResponseInfo* http_response_info, |
122 const LifecycleCallback& lifecycle_callback) { | 123 const LifecycleCallback& lifecycle_callback) { |
123 scoped_ptr<SpecifiedResponseJobInterceptor> interceptor( | 124 scoped_ptr<SpecifiedResponseJobInterceptor> interceptor( |
124 new SpecifiedResponseJobInterceptor(http_response_info, | 125 new SpecifiedResponseJobInterceptor(http_response_info, |
125 lifecycle_callback)); | 126 lifecycle_callback)); |
126 | 127 |
127 URLRequestFilter::GetInstance()->AddHostnameInterceptor("http", kTestDomain, | 128 URLRequestFilter::GetInstance()->AddHostnameInterceptor( |
128 interceptor.Pass()); | 129 "http", kTestDomain, std::move(interceptor)); |
129 } | 130 } |
130 | 131 |
131 static void Unregister() { | 132 static void Unregister() { |
132 URLRequestFilter::GetInstance()->RemoveHostnameHandler("http", kTestDomain); | 133 URLRequestFilter::GetInstance()->RemoveHostnameHandler("http", kTestDomain); |
133 } | 134 } |
134 | 135 |
135 private: | 136 private: |
136 HttpResponseInfo* http_response_info_; | 137 HttpResponseInfo* http_response_info_; |
137 LifecycleCallback lifecycle_callback_; | 138 LifecycleCallback lifecycle_callback_; |
138 DISALLOW_COPY_AND_ASSIGN(SpecifiedResponseJobInterceptor); | 139 DISALLOW_COPY_AND_ASSIGN(SpecifiedResponseJobInterceptor); |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 WaitForNoJobs(); | 430 WaitForNoJobs(); |
430 EXPECT_TRUE(fetcher()->Schedule(dictionary_url, GetDefaultCallback())); | 431 EXPECT_TRUE(fetcher()->Schedule(dictionary_url, GetDefaultCallback())); |
431 | 432 |
432 WaitForNoJobs(); | 433 WaitForNoJobs(); |
433 EXPECT_EQ(2, jobs_requested()); | 434 EXPECT_EQ(2, jobs_requested()); |
434 } | 435 } |
435 | 436 |
436 } // namespace | 437 } // namespace |
437 | 438 |
438 } // namespace net | 439 } // namespace net |
OLD | NEW |