Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: mojo/shell/capability_filter_unittest.cc

Issue 1354003002: Make CapabilityFilter be part of Identity (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 protected: 334 protected:
335 void RunApplication(const std::string& url, const CapabilityFilter& filter) { 335 void RunApplication(const std::string& url, const CapabilityFilter& filter) {
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());
345 request->url = String::From(url);
346
347 scoped_ptr<ConnectToApplicationParams> params( 344 scoped_ptr<ConnectToApplicationParams> params(
348 new ConnectToApplicationParams); 345 new ConnectToApplicationParams);
349 params->SetURLInfo(request.Pass()); 346 params->SetTarget(Identity(GURL(url), std::string(), filter));
350 params->set_services(GetProxy(&services)); 347 params->set_services(GetProxy(&services));
351 params->set_exposed_services(exposed_services.Pass()); 348 params->set_exposed_services(exposed_services.Pass());
352 params->set_filter(filter);
353 params->set_on_application_end(base::MessageLoop::QuitWhenIdleClosure()); 349 params->set_on_application_end(base::MessageLoop::QuitWhenIdleClosure());
354 application_manager_->ConnectToApplication(params.Pass()); 350 application_manager_->ConnectToApplication(params.Pass());
355 } 351 }
356 352
357 void InitValidator(const std::set<std::string>& expectations) { 353 void InitValidator(const std::set<std::string>& expectations) {
358 validator_ = new ConnectionValidator(expectations, &loop_); 354 validator_ = new ConnectionValidator(expectations, &loop_);
359 application_manager()->SetLoaderForURL(make_scoped_ptr(validator_), 355 application_manager()->SetLoaderForURL(make_scoped_ptr(validator_),
360 GURL("test:validator")); 356 GURL("test:validator"));
361 } 357 }
362 358
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 RunTest(); 542 RunTest();
547 } 543 }
548 544
549 TEST_F(CapabilityFilter_WildcardsTest, ContentHandler) { 545 TEST_F(CapabilityFilter_WildcardsTest, ContentHandler) {
550 RunContentHandlerTest(); 546 RunContentHandlerTest();
551 } 547 }
552 548
553 } // namespace 549 } // namespace
554 } // namespace shell 550 } // namespace shell
555 } // namespace mojo 551 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698