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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/lazy_instance.h" | 6 #include "base/lazy_instance.h" |
7 #include "base/memory/weak_ptr.h" | 7 #include "base/memory/weak_ptr.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "mojo/application/application_test_base_chromium.h" | 10 #include "mojo/application/application_test_base_chromium.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 ApplicationTestBase::SetUp(); | 107 ApplicationTestBase::SetUp(); |
108 | 108 |
109 scoped_ptr<net::TestURLRequestContext> url_request_context( | 109 scoped_ptr<net::TestURLRequestContext> url_request_context( |
110 new net::TestURLRequestContext(true)); | 110 new net::TestURLRequestContext(true)); |
111 ASSERT_TRUE(url_request_job_factory_.SetProtocolHandler( | 111 ASSERT_TRUE(url_request_job_factory_.SetProtocolHandler( |
112 "http", new TestProtocolHandler())); | 112 "http", new TestProtocolHandler())); |
113 url_request_context->set_job_factory(&url_request_job_factory_); | 113 url_request_context->set_job_factory(&url_request_job_factory_); |
114 url_request_context->Init(); | 114 url_request_context->Init(); |
115 network_context_.reset(new NetworkContext(url_request_context.Pass())); | 115 network_context_.reset(new NetworkContext(url_request_context.Pass())); |
116 MessagePipe pipe; | 116 MessagePipe pipe; |
117 new URLLoaderImpl(network_context_.get(), GetProxy(&url_loader_proxy_)); | 117 new URLLoaderImpl(network_context_.get(), |
| 118 GetProxy(&url_loader_proxy_), |
| 119 make_scoped_ptr<mojo::AppRefCount>(nullptr)); |
118 EXPECT_TRUE(IsUrlLoaderValid()); | 120 EXPECT_TRUE(IsUrlLoaderValid()); |
119 } | 121 } |
120 | 122 |
121 bool IsUrlLoaderValid() { | 123 bool IsUrlLoaderValid() { |
122 return network_context_->GetURLLoaderCountForTesting() > 0u; | 124 return network_context_->GetURLLoaderCountForTesting() > 0u; |
123 } | 125 } |
124 | 126 |
125 base::MessageLoop message_loop_; | 127 base::MessageLoop message_loop_; |
126 net::TestJobInterceptor* job_interceptor_; | 128 net::TestJobInterceptor* job_interceptor_; |
127 net::URLRequestJobFactoryImpl url_request_job_factory_; | 129 net::URLRequestJobFactoryImpl url_request_job_factory_; |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 | 263 |
262 EXPECT_TRUE(IsUrlLoaderValid()); | 264 EXPECT_TRUE(IsUrlLoaderValid()); |
263 | 265 |
264 g_current_job->NotifyReadComplete(-1); | 266 g_current_job->NotifyReadComplete(-1); |
265 base::RunLoop().RunUntilIdle(); | 267 base::RunLoop().RunUntilIdle(); |
266 | 268 |
267 EXPECT_FALSE(IsUrlLoaderValid()); | 269 EXPECT_FALSE(IsUrlLoaderValid()); |
268 } | 270 } |
269 | 271 |
270 } // namespace mojo | 272 } // namespace mojo |
OLD | NEW |