OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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" | |
6 #include "base/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
7 #include "mojo/public/cpp/bindings/allocation_scope.h" | 6 #include "mojo/public/cpp/bindings/allocation_scope.h" |
| 7 #include "mojo/public/cpp/environment/environment.h" |
8 #include "mojo/public/cpp/shell/application.h" | 8 #include "mojo/public/cpp/shell/application.h" |
9 #include "mojo/public/interfaces/shell/shell.mojom.h" | 9 #include "mojo/public/interfaces/shell/shell.mojom.h" |
10 #include "mojo/service_manager/service_loader.h" | 10 #include "mojo/service_manager/service_loader.h" |
11 #include "mojo/service_manager/service_manager.h" | 11 #include "mojo/service_manager/service_manager.h" |
12 #include "mojo/service_manager/test.mojom.h" | 12 #include "mojo/service_manager/test.mojom.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 namespace mojo { | 15 namespace mojo { |
16 namespace { | 16 namespace { |
17 | 17 |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 test_client_.reset(NULL); | 173 test_client_.reset(NULL); |
174 service_manager_.reset(NULL); | 174 service_manager_.reset(NULL); |
175 } | 175 } |
176 | 176 |
177 bool HasFactoryForTestURL() { | 177 bool HasFactoryForTestURL() { |
178 ServiceManager::TestAPI manager_test_api(service_manager_.get()); | 178 ServiceManager::TestAPI manager_test_api(service_manager_.get()); |
179 return manager_test_api.HasFactoryForURL(GURL(kTestURLString)); | 179 return manager_test_api.HasFactoryForURL(GURL(kTestURLString)); |
180 } | 180 } |
181 | 181 |
182 protected: | 182 protected: |
183 base::ShadowingAtExitManager at_exit_; | 183 mojo::Environment env_; |
184 base::MessageLoop loop_; | 184 base::MessageLoop loop_; |
185 TestContext context_; | 185 TestContext context_; |
186 scoped_ptr<TestClientImpl> test_client_; | 186 scoped_ptr<TestClientImpl> test_client_; |
187 scoped_ptr<ServiceManager> service_manager_; | 187 scoped_ptr<ServiceManager> service_manager_; |
188 DISALLOW_COPY_AND_ASSIGN(ServiceManagerTest); | 188 DISALLOW_COPY_AND_ASSIGN(ServiceManagerTest); |
189 }; | 189 }; |
190 | 190 |
191 TEST_F(ServiceManagerTest, Basic) { | 191 TEST_F(ServiceManagerTest, Basic) { |
192 test_client_->Test("test"); | 192 test_client_->Test("test"); |
193 loop_.Run(); | 193 loop_.Run(); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 | 270 |
271 std::string url("test:test3"); | 271 std::string url("test:test3"); |
272 MessagePipe pipe1; | 272 MessagePipe pipe1; |
273 sm.Connect(GURL(url), pipe1.handle0.Pass()); | 273 sm.Connect(GURL(url), pipe1.handle0.Pass()); |
274 EXPECT_EQ(1, interceptor.call_count()); | 274 EXPECT_EQ(1, interceptor.call_count()); |
275 EXPECT_EQ(url, interceptor.url_spec()); | 275 EXPECT_EQ(url, interceptor.url_spec()); |
276 EXPECT_EQ(1, default_loader->num_loads()); | 276 EXPECT_EQ(1, default_loader->num_loads()); |
277 } | 277 } |
278 | 278 |
279 } // namespace mojo | 279 } // namespace mojo |
OLD | NEW |