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 <memory> | 5 #include <memory> |
6 #include <utility> | 6 #include <utility> |
7 | 7 |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 browser_context_(new TestBrowserContext) { | 86 browser_context_(new TestBrowserContext) { |
87 host_.SetLoaderDelegate(&loader_delegate_); | 87 host_.SetLoaderDelegate(&loader_delegate_); |
88 BrowserContext::EnsureResourceContextInitialized(browser_context_.get()); | 88 BrowserContext::EnsureResourceContextInitialized(browser_context_.get()); |
89 base::RunLoop().RunUntilIdle(); | 89 base::RunLoop().RunUntilIdle(); |
90 net::URLRequestContext* request_context = | 90 net::URLRequestContext* request_context = |
91 browser_context_->GetResourceContext()->GetRequestContext(); | 91 browser_context_->GetResourceContext()->GetRequestContext(); |
92 // Attach URLRequestTestJob and make streams work. | 92 // Attach URLRequestTestJob and make streams work. |
93 job_factory_.SetProtocolHandler( | 93 job_factory_.SetProtocolHandler( |
94 "test", net::URLRequestTestJob::CreateProtocolHandler()); | 94 "test", net::URLRequestTestJob::CreateProtocolHandler()); |
95 job_factory_.SetProtocolHandler( | 95 job_factory_.SetProtocolHandler( |
96 "blob", | 96 "blob", base::MakeUnique<StreamProtocolHandler>( |
97 base::WrapUnique(new StreamProtocolHandler( | 97 StreamContext::GetFor(browser_context_.get())->registry())); |
98 StreamContext::GetFor(browser_context_.get())->registry()))); | |
99 request_context->set_job_factory(&job_factory_); | 98 request_context->set_job_factory(&job_factory_); |
100 | 99 |
101 // NavigationURLLoader is only used for browser-side navigations. | 100 // NavigationURLLoader is only used for browser-side navigations. |
102 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 101 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
103 switches::kEnableBrowserSideNavigation); | 102 switches::kEnableBrowserSideNavigation); |
104 } | 103 } |
105 | 104 |
106 std::unique_ptr<NavigationURLLoader> MakeTestLoader( | 105 std::unique_ptr<NavigationURLLoader> MakeTestLoader( |
107 const GURL& url, | 106 const GURL& url, |
108 NavigationURLLoaderDelegate* delegate) { | 107 NavigationURLLoaderDelegate* delegate) { |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 | 330 |
332 // Release the body. | 331 // Release the body. |
333 delegate.ReleaseBody(); | 332 delegate.ReleaseBody(); |
334 base::RunLoop().RunUntilIdle(); | 333 base::RunLoop().RunUntilIdle(); |
335 | 334 |
336 // Verify that URLRequestTestJob no longer has anything paused. | 335 // Verify that URLRequestTestJob no longer has anything paused. |
337 EXPECT_FALSE(net::URLRequestTestJob::ProcessOnePendingMessage()); | 336 EXPECT_FALSE(net::URLRequestTestJob::ProcessOnePendingMessage()); |
338 } | 337 } |
339 | 338 |
340 } // namespace content | 339 } // namespace content |
OLD | NEW |