| 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" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 void PrintUnmetExpectations() { | 45 void PrintUnmetExpectations() { |
| 46 for (auto expectation : expectations_) | 46 for (auto expectation : expectations_) |
| 47 ADD_FAILURE() << "Unmet: " << expectation; | 47 ADD_FAILURE() << "Unmet: " << expectation; |
| 48 for (auto unexpected : unexpected_) | 48 for (auto unexpected : unexpected_) |
| 49 ADD_FAILURE() << "Unexpected: " << unexpected; | 49 ADD_FAILURE() << "Unexpected: " << unexpected; |
| 50 } | 50 } |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 // Overridden from ApplicationLoader: | 53 // Overridden from ApplicationLoader: |
| 54 void Load(const GURL& url, InterfaceRequest<Application> request) override { | 54 void Load(const GURL& url, |
| 55 InterfaceRequest<mojom::Application> request) override { |
| 55 app_.reset(new ApplicationImpl(this, std::move(request))); | 56 app_.reset(new ApplicationImpl(this, std::move(request))); |
| 56 } | 57 } |
| 57 | 58 |
| 58 // Overridden from ApplicationDelegate: | 59 // Overridden from ApplicationDelegate: |
| 59 bool AcceptConnection(ApplicationConnection* connection) override { | 60 bool AcceptConnection(ApplicationConnection* connection) override { |
| 60 connection->AddService<Validator>(this); | 61 connection->AddService<Validator>(this); |
| 61 return true; | 62 return true; |
| 62 } | 63 } |
| 63 | 64 |
| 64 // Overridden from InterfaceFactory<Validator>: | 65 // Overridden from InterfaceFactory<Validator>: |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 validator_->ConnectionClosed(app_->url(), service_url); | 188 validator_->ConnectionClosed(app_->url(), service_url); |
| 188 } | 189 } |
| 189 | 190 |
| 190 //////////////////////////////////////////////////////////////////////////////// | 191 //////////////////////////////////////////////////////////////////////////////// |
| 191 // TestLoader: | 192 // TestLoader: |
| 192 | 193 |
| 193 TestLoader::TestLoader(ApplicationDelegate* delegate) : delegate_(delegate) {} | 194 TestLoader::TestLoader(ApplicationDelegate* delegate) : delegate_(delegate) {} |
| 194 TestLoader::~TestLoader() {} | 195 TestLoader::~TestLoader() {} |
| 195 | 196 |
| 196 void TestLoader::Load(const GURL& url, | 197 void TestLoader::Load(const GURL& url, |
| 197 InterfaceRequest<Application> request) { | 198 InterfaceRequest<mojom::Application> request) { |
| 198 app_.reset(new ApplicationImpl(delegate_.get(), std::move(request))); | 199 app_.reset(new ApplicationImpl(delegate_.get(), std::move(request))); |
| 199 } | 200 } |
| 200 | 201 |
| 201 //////////////////////////////////////////////////////////////////////////////// | 202 //////////////////////////////////////////////////////////////////////////////// |
| 202 // CapabilityFilterTest: | 203 // CapabilityFilterTest: |
| 203 | 204 |
| 204 CapabilityFilterTest::CapabilityFilterTest() : validator_(nullptr) {} | 205 CapabilityFilterTest::CapabilityFilterTest() : validator_(nullptr) {} |
| 205 CapabilityFilterTest::~CapabilityFilterTest() {} | 206 CapabilityFilterTest::~CapabilityFilterTest() {} |
| 206 | 207 |
| 207 void CapabilityFilterTest::RunBlockingTest() { | 208 void CapabilityFilterTest::RunBlockingTest() { |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 void CapabilityFilterTest::RunTest() { | 321 void CapabilityFilterTest::RunTest() { |
| 321 loop()->Run(); | 322 loop()->Run(); |
| 322 EXPECT_TRUE(validator_->expectations_met()); | 323 EXPECT_TRUE(validator_->expectations_met()); |
| 323 if (!validator_->expectations_met()) | 324 if (!validator_->expectations_met()) |
| 324 validator_->PrintUnmetExpectations(); | 325 validator_->PrintUnmetExpectations(); |
| 325 } | 326 } |
| 326 | 327 |
| 327 } // namespace test | 328 } // namespace test |
| 328 } // namespace shell | 329 } // namespace shell |
| 329 } // namespace mojo | 330 } // namespace mojo |
| OLD | NEW |