| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "services/shell/background/background_shell.h" | 5 #include "services/shell/background/background_shell.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| 11 #include "services/shell/background/tests/test.mojom.h" | 11 #include "services/shell/background/tests/test.mojom.h" |
| 12 #include "services/shell/background/tests/test_catalog_store.h" | 12 #include "services/shell/background/tests/test_catalog_store.h" |
| 13 #include "services/shell/public/cpp/connector.h" | 13 #include "services/shell/public/cpp/connector.h" |
| 14 #include "services/shell/public/cpp/service.h" | 14 #include "services/shell/public/cpp/service.h" |
| 15 #include "services/shell/public/cpp/service_context.h" | 15 #include "services/shell/public/cpp/service_context.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 17 |
| 18 namespace shell { | 18 namespace shell { |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 const char kTestName[] = "mojo:test-app"; | 21 const char kTestName[] = "service:test-app"; |
| 22 | 22 |
| 23 class ServiceImpl : public Service { | 23 class ServiceImpl : public Service { |
| 24 public: | 24 public: |
| 25 ServiceImpl() {} | 25 ServiceImpl() {} |
| 26 ~ServiceImpl() override {} | 26 ~ServiceImpl() override {} |
| 27 | 27 |
| 28 private: | 28 private: |
| 29 DISALLOW_COPY_AND_ASSIGN(ServiceImpl); | 29 DISALLOW_COPY_AND_ASSIGN(ServiceImpl); |
| 30 }; | 30 }; |
| 31 | 31 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 59 new BackgroundShell::InitParams); | 59 new BackgroundShell::InitParams); |
| 60 std::unique_ptr<TestCatalogStore> store_ptr = BuildTestCatalogStore(); | 60 std::unique_ptr<TestCatalogStore> store_ptr = BuildTestCatalogStore(); |
| 61 TestCatalogStore* store = store_ptr.get(); | 61 TestCatalogStore* store = store_ptr.get(); |
| 62 init_params->catalog_store = std::move(store_ptr); | 62 init_params->catalog_store = std::move(store_ptr); |
| 63 background_shell.Init(std::move(init_params)); | 63 background_shell.Init(std::move(init_params)); |
| 64 ServiceImpl service; | 64 ServiceImpl service; |
| 65 ServiceContext service_context( | 65 ServiceContext service_context( |
| 66 &service, background_shell.CreateServiceRequest(kTestName)); | 66 &service, background_shell.CreateServiceRequest(kTestName)); |
| 67 mojom::TestServicePtr test_service; | 67 mojom::TestServicePtr test_service; |
| 68 service_context.connector()->ConnectToInterface( | 68 service_context.connector()->ConnectToInterface( |
| 69 "mojo:background_shell_test_app", &test_service); | 69 "service:background_shell_test_app", &test_service); |
| 70 base::RunLoop run_loop; | 70 base::RunLoop run_loop; |
| 71 bool got_result = false; | 71 bool got_result = false; |
| 72 test_service->Test(base::Bind(&SetFlagAndRunClosure, &got_result, | 72 test_service->Test(base::Bind(&SetFlagAndRunClosure, &got_result, |
| 73 run_loop.QuitClosure())); | 73 run_loop.QuitClosure())); |
| 74 run_loop.Run(); | 74 run_loop.Run(); |
| 75 EXPECT_TRUE(got_result); | 75 EXPECT_TRUE(got_result); |
| 76 EXPECT_TRUE(store->get_store_called()); | 76 EXPECT_TRUE(store->get_store_called()); |
| 77 } | 77 } |
| 78 | 78 |
| 79 } // namespace shell | 79 } // namespace shell |
| OLD | NEW |