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 "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "mojo/application/public/cpp/application_connection.h" | 9 #include "mojo/application/public/cpp/application_connection.h" |
10 #include "mojo/application/public/cpp/application_impl.h" | 10 #include "mojo/application/public/cpp/application_impl.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 const String& service_url) override { | 76 const String& service_url) override { |
77 Validate(base::StringPrintf("C %s %s", app_url.data(), service_url.data())); | 77 Validate(base::StringPrintf("C %s %s", app_url.data(), service_url.data())); |
78 } | 78 } |
79 | 79 |
80 void Validate(const std::string& result) { | 80 void Validate(const std::string& result) { |
81 DVLOG(1) << "Validate: " << result; | 81 DVLOG(1) << "Validate: " << result; |
82 auto i = expectations_.find(result); | 82 auto i = expectations_.find(result); |
83 if (i != expectations_.end()) { | 83 if (i != expectations_.end()) { |
84 expectations_.erase(i); | 84 expectations_.erase(i); |
85 if (expectations_.empty()) | 85 if (expectations_.empty()) |
86 loop_->Quit(); | 86 loop_->QuitWhenIdle(); |
87 } else { | 87 } else { |
88 // This is a test failure, and will result in PrintUnexpectedExpecations() | 88 // This is a test failure, and will result in PrintUnexpectedExpecations() |
89 // being called. | 89 // being called. |
90 unexpected_.insert(result); | 90 unexpected_.insert(result); |
91 loop_->Quit(); | 91 loop_->QuitWhenIdle(); |
92 } | 92 } |
93 } | 93 } |
94 | 94 |
95 scoped_ptr<ApplicationImpl> app_; | 95 scoped_ptr<ApplicationImpl> app_; |
96 std::set<std::string> expectations_; | 96 std::set<std::string> expectations_; |
97 std::set<std::string> unexpected_; | 97 std::set<std::string> unexpected_; |
98 base::MessageLoop* loop_; | 98 base::MessageLoop* loop_; |
99 WeakBindingSet<Validator> validator_bindings_; | 99 WeakBindingSet<Validator> validator_bindings_; |
100 | 100 |
101 DISALLOW_COPY_AND_ASSIGN(ConnectionValidator); | 101 DISALLOW_COPY_AND_ASSIGN(ConnectionValidator); |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 void CapabilityFilterTest::RunTest() { | 323 void CapabilityFilterTest::RunTest() { |
324 loop()->Run(); | 324 loop()->Run(); |
325 EXPECT_TRUE(validator_->expectations_met()); | 325 EXPECT_TRUE(validator_->expectations_met()); |
326 if (!validator_->expectations_met()) | 326 if (!validator_->expectations_met()) |
327 validator_->PrintUnmetExpectations(); | 327 validator_->PrintUnmetExpectations(); |
328 } | 328 } |
329 | 329 |
330 } // namespace test | 330 } // namespace test |
331 } // namespace shell | 331 } // namespace shell |
332 } // namespace mojo | 332 } // namespace mojo |
OLD | NEW |