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 "mojo/shell/capability_filter_test.h" | 5 #include "mojo/shell/capability_filter_test.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
12 #include "mojo/public/cpp/bindings/strong_binding.h" | 12 #include "mojo/public/cpp/bindings/strong_binding.h" |
13 #include "mojo/public/cpp/bindings/weak_binding_set.h" | 13 #include "mojo/public/cpp/bindings/weak_binding_set.h" |
14 #include "mojo/shell/application_loader.h" | 14 #include "mojo/shell/application_loader.h" |
15 #include "mojo/shell/package_manager.h" | |
16 #include "mojo/shell/public/cpp/connection.h" | 15 #include "mojo/shell/public/cpp/connection.h" |
17 #include "mojo/shell/public/cpp/interface_factory.h" | 16 #include "mojo/shell/public/cpp/interface_factory.h" |
18 #include "mojo/shell/public/cpp/shell_connection.h" | 17 #include "mojo/shell/public/cpp/shell_connection.h" |
19 | 18 |
20 namespace mojo { | 19 namespace mojo { |
21 namespace shell { | 20 namespace shell { |
22 namespace test { | 21 namespace test { |
23 | 22 |
24 // Lives on the main thread of the test. | 23 // Lives on the main thread of the test. |
25 // Listens for interfaces exposed/blocked and for application connections being | 24 // Listens for interfaces exposed/blocked and for application connections being |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 CapabilityFilter filter2; | 273 CapabilityFilter filter2; |
275 filter2["test:service"] = interfaces2; | 274 filter2["test:service"] = interfaces2; |
276 AllowedInterfaces interfaces3; | 275 AllowedInterfaces interfaces3; |
277 interfaces3.insert(Safe::Name_); | 276 interfaces3.insert(Safe::Name_); |
278 filter2["test:service2"] = interfaces3; | 277 filter2["test:service2"] = interfaces3; |
279 RunApplication("test:wildcard3", filter2); | 278 RunApplication("test:wildcard3", filter2); |
280 } | 279 } |
281 | 280 |
282 | 281 |
283 void CapabilityFilterTest::SetUp() { | 282 void CapabilityFilterTest::SetUp() { |
284 application_manager_.reset( | 283 application_manager_.reset(new ApplicationManager(true)); |
285 new ApplicationManager(make_scoped_ptr(CreatePackageManager()), true)); | |
286 CreateLoader<ServiceApplication>("test:service"); | 284 CreateLoader<ServiceApplication>("test:service"); |
287 CreateLoader<ServiceApplication>("test:service2"); | 285 CreateLoader<ServiceApplication>("test:service2"); |
288 } | 286 } |
289 | 287 |
290 void CapabilityFilterTest::TearDown() { | 288 void CapabilityFilterTest::TearDown() { |
291 application_manager_.reset(); | 289 application_manager_.reset(); |
292 } | 290 } |
293 | 291 |
294 class InterfaceProviderImpl : public shell::mojom::InterfaceProvider { | 292 class InterfaceProviderImpl : public shell::mojom::InterfaceProvider { |
295 public: | 293 public: |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 void CapabilityFilterTest::RunTest() { | 342 void CapabilityFilterTest::RunTest() { |
345 loop()->Run(); | 343 loop()->Run(); |
346 EXPECT_TRUE(validator_->expectations_met()); | 344 EXPECT_TRUE(validator_->expectations_met()); |
347 if (!validator_->expectations_met()) | 345 if (!validator_->expectations_met()) |
348 validator_->PrintUnmetExpectations(); | 346 validator_->PrintUnmetExpectations(); |
349 } | 347 } |
350 | 348 |
351 } // namespace test | 349 } // namespace test |
352 } // namespace shell | 350 } // namespace shell |
353 } // namespace mojo | 351 } // namespace mojo |
OLD | NEW |