| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/browser/loader/async_revalidation_driver.h" | 5 #include "content/browser/loader/async_revalidation_driver.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <type_traits> | 8 #include <type_traits> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 CreateProtocolHandlerCallback BindCreateProtocolHandlerCallback() { | 71 CreateProtocolHandlerCallback BindCreateProtocolHandlerCallback() { |
| 72 static_assert(std::is_base_of<net::URLRequestJob, T>::value, | 72 static_assert(std::is_base_of<net::URLRequestJob, T>::value, |
| 73 "Template argument to BindCreateProtocolHandlerCallback() must " | 73 "Template argument to BindCreateProtocolHandlerCallback() must " |
| 74 "be a subclass of URLRequestJob."); | 74 "be a subclass of URLRequestJob."); |
| 75 | 75 |
| 76 class TemplatedProtocolHandler | 76 class TemplatedProtocolHandler |
| 77 : public net::URLRequestJobFactory::ProtocolHandler { | 77 : public net::URLRequestJobFactory::ProtocolHandler { |
| 78 public: | 78 public: |
| 79 static std::unique_ptr<net::URLRequestJobFactory::ProtocolHandler> | 79 static std::unique_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 80 Create() { | 80 Create() { |
| 81 return base::WrapUnique(new TemplatedProtocolHandler()); | 81 return base::MakeUnique<TemplatedProtocolHandler>(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 // URLRequestJobFactory::ProtocolHandler implementation: | 84 // URLRequestJobFactory::ProtocolHandler implementation: |
| 85 net::URLRequestJob* MaybeCreateJob( | 85 net::URLRequestJob* MaybeCreateJob( |
| 86 net::URLRequest* request, | 86 net::URLRequest* request, |
| 87 net::NetworkDelegate* network_delegate) const override { | 87 net::NetworkDelegate* network_delegate) const override { |
| 88 return new T(request, network_delegate); | 88 return new T(request, network_delegate); |
| 89 } | 89 } |
| 90 }; | 90 }; |
| 91 | 91 |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 TEST_F(AsyncRevalidationDriverFromCacheTest, | 392 TEST_F(AsyncRevalidationDriverFromCacheTest, |
| 393 CacheNotReadOnSuccessfulRevalidation) { | 393 CacheNotReadOnSuccessfulRevalidation) { |
| 394 driver_->StartRequest(); | 394 driver_->StartRequest(); |
| 395 base::RunLoop().RunUntilIdle(); | 395 base::RunLoop().RunUntilIdle(); |
| 396 | 396 |
| 397 EXPECT_TRUE(async_revalidation_complete_called()); | 397 EXPECT_TRUE(async_revalidation_complete_called()); |
| 398 } | 398 } |
| 399 | 399 |
| 400 } // namespace | 400 } // namespace |
| 401 } // namespace content | 401 } // namespace content |
| OLD | NEW |