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 "base/at_exit.h" | 5 #include "base/at_exit.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 ServiceProviderPtr services; | 336 ServiceProviderPtr services; |
337 | 337 |
338 // We expose Validator to the test application via ConnectToApplication | 338 // We expose Validator to the test application via ConnectToApplication |
339 // because we don't allow the test application to connect to test:validator. | 339 // because we don't allow the test application to connect to test:validator. |
340 // Adding it to the CapabilityFilter would interfere with the test. | 340 // Adding it to the CapabilityFilter would interfere with the test. |
341 ServiceProviderPtr exposed_services; | 341 ServiceProviderPtr exposed_services; |
342 (new ServiceProviderImpl(GetProxy(&exposed_services)))-> | 342 (new ServiceProviderImpl(GetProxy(&exposed_services)))-> |
343 AddService<Validator>(validator_); | 343 AddService<Validator>(validator_); |
344 URLRequestPtr request(URLRequest::New()); | 344 URLRequestPtr request(URLRequest::New()); |
345 request->url = String::From(url); | 345 request->url = String::From(url); |
346 application_manager_->ConnectToApplication( | 346 |
347 nullptr, request.Pass(), std::string(), GetProxy(&services), | 347 scoped_ptr<ConnectToApplicationParams> params( |
348 exposed_services.Pass(), filter, | 348 new ConnectToApplicationParams); |
349 base::MessageLoop::QuitWhenIdleClosure(), EmptyConnectCallback()); | 349 params->SetURLInfo(request.Pass()); |
| 350 params->set_services(GetProxy(&services)); |
| 351 params->set_exposed_services(exposed_services.Pass()); |
| 352 params->set_filter(filter); |
| 353 params->set_on_application_end(base::MessageLoop::QuitWhenIdleClosure()); |
| 354 application_manager_->ConnectToApplication(params.Pass()); |
350 } | 355 } |
351 | 356 |
352 void InitValidator(const std::set<std::string>& expectations) { | 357 void InitValidator(const std::set<std::string>& expectations) { |
353 validator_ = new ConnectionValidator(expectations, &loop_); | 358 validator_ = new ConnectionValidator(expectations, &loop_); |
354 application_manager()->SetLoaderForURL(make_scoped_ptr(validator_), | 359 application_manager()->SetLoaderForURL(make_scoped_ptr(validator_), |
355 GURL("test:validator")); | 360 GURL("test:validator")); |
356 } | 361 } |
357 | 362 |
358 template <class T> | 363 template <class T> |
359 void CreateLoader(const std::string& url) { | 364 void CreateLoader(const std::string& url) { |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 RunTest(); | 546 RunTest(); |
542 } | 547 } |
543 | 548 |
544 TEST_F(CapabilityFilter_WildcardsTest, ContentHandler) { | 549 TEST_F(CapabilityFilter_WildcardsTest, ContentHandler) { |
545 RunContentHandlerTest(); | 550 RunContentHandlerTest(); |
546 } | 551 } |
547 | 552 |
548 } // namespace | 553 } // namespace |
549 } // namespace shell | 554 } // namespace shell |
550 } // namespace mojo | 555 } // namespace mojo |
OLD | NEW |