| 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" |
| 5 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
| 6 #include "mojo/public/cpp/application/application.h" | 7 #include "mojo/public/cpp/application/application.h" |
| 7 #include "mojo/public/cpp/environment/environment.h" | |
| 8 #include "mojo/public/interfaces/service_provider/service_provider.mojom.h" | 8 #include "mojo/public/interfaces/service_provider/service_provider.mojom.h" |
| 9 #include "mojo/service_manager/service_loader.h" | 9 #include "mojo/service_manager/service_loader.h" |
| 10 #include "mojo/service_manager/service_manager.h" | 10 #include "mojo/service_manager/service_manager.h" |
| 11 #include "mojo/service_manager/test.mojom.h" | 11 #include "mojo/service_manager/test.mojom.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 13 |
| 14 namespace mojo { | 14 namespace mojo { |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 const char kTestURLString[] = "test:testService"; | 17 const char kTestURLString[] = "test:testService"; |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 test_client_.reset(NULL); | 224 test_client_.reset(NULL); |
| 225 service_manager_.reset(NULL); | 225 service_manager_.reset(NULL); |
| 226 } | 226 } |
| 227 | 227 |
| 228 bool HasFactoryForTestURL() { | 228 bool HasFactoryForTestURL() { |
| 229 ServiceManager::TestAPI manager_test_api(service_manager_.get()); | 229 ServiceManager::TestAPI manager_test_api(service_manager_.get()); |
| 230 return manager_test_api.HasFactoryForURL(GURL(kTestURLString)); | 230 return manager_test_api.HasFactoryForURL(GURL(kTestURLString)); |
| 231 } | 231 } |
| 232 | 232 |
| 233 protected: | 233 protected: |
| 234 mojo::Environment env_; | 234 base::ShadowingAtExitManager at_exit_; |
| 235 base::MessageLoop loop_; | 235 base::MessageLoop loop_; |
| 236 TestContext context_; | 236 TestContext context_; |
| 237 scoped_ptr<TestClientImpl> test_client_; | 237 scoped_ptr<TestClientImpl> test_client_; |
| 238 scoped_ptr<ServiceManager> service_manager_; | 238 scoped_ptr<ServiceManager> service_manager_; |
| 239 DISALLOW_COPY_AND_ASSIGN(ServiceManagerTest); | 239 DISALLOW_COPY_AND_ASSIGN(ServiceManagerTest); |
| 240 }; | 240 }; |
| 241 | 241 |
| 242 TEST_F(ServiceManagerTest, Basic) { | 242 TEST_F(ServiceManagerTest, Basic) { |
| 243 test_client_->Test("test"); | 243 test_client_->Test("test"); |
| 244 loop_.Run(); | 244 loop_.Run(); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 | 363 |
| 364 std::string url("test:test3"); | 364 std::string url("test:test3"); |
| 365 TestServicePtr test_service; | 365 TestServicePtr test_service; |
| 366 sm.ConnectTo(GURL(url), &test_service, GURL()); | 366 sm.ConnectTo(GURL(url), &test_service, GURL()); |
| 367 EXPECT_EQ(1, interceptor.call_count()); | 367 EXPECT_EQ(1, interceptor.call_count()); |
| 368 EXPECT_EQ(url, interceptor.url_spec()); | 368 EXPECT_EQ(url, interceptor.url_spec()); |
| 369 EXPECT_EQ(1, default_loader->num_loads()); | 369 EXPECT_EQ(1, default_loader->num_loads()); |
| 370 } | 370 } |
| 371 | 371 |
| 372 } // namespace mojo | 372 } // namespace mojo |
| OLD | NEW |