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 | 346 application_manager_->ConnectToApplication( |
347 scoped_ptr<ConnectToApplicationParams> params( | 347 nullptr, request.Pass(), std::string(), GetProxy(&services), |
348 new ConnectToApplicationParams); | 348 exposed_services.Pass(), filter, |
349 params->SetURLInfo(request.Pass()); | 349 base::MessageLoop::QuitWhenIdleClosure(), EmptyConnectCallback()); |
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()); | |
355 } | 350 } |
356 | 351 |
357 void InitValidator(const std::set<std::string>& expectations) { | 352 void InitValidator(const std::set<std::string>& expectations) { |
358 validator_ = new ConnectionValidator(expectations, &loop_); | 353 validator_ = new ConnectionValidator(expectations, &loop_); |
359 application_manager()->SetLoaderForURL(make_scoped_ptr(validator_), | 354 application_manager()->SetLoaderForURL(make_scoped_ptr(validator_), |
360 GURL("test:validator")); | 355 GURL("test:validator")); |
361 } | 356 } |
362 | 357 |
363 template <class T> | 358 template <class T> |
364 void CreateLoader(const std::string& url) { | 359 void CreateLoader(const std::string& url) { |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 RunTest(); | 541 RunTest(); |
547 } | 542 } |
548 | 543 |
549 TEST_F(CapabilityFilter_WildcardsTest, ContentHandler) { | 544 TEST_F(CapabilityFilter_WildcardsTest, ContentHandler) { |
550 RunContentHandlerTest(); | 545 RunContentHandlerTest(); |
551 } | 546 } |
552 | 547 |
553 } // namespace | 548 } // namespace |
554 } // namespace shell | 549 } // namespace shell |
555 } // namespace mojo | 550 } // namespace mojo |
OLD | NEW |