| 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/ui/ws/window_server_service_test_base.h" | 5 #include "services/ui/ws/window_server_service_test_base.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 class WindowServerServiceTestClient | 23 class WindowServerServiceTestClient |
| 24 : public service_manager::test::ServiceTestClient { | 24 : public service_manager::test::ServiceTestClient { |
| 25 public: | 25 public: |
| 26 explicit WindowServerServiceTestClient(WindowServerServiceTestBase* test) | 26 explicit WindowServerServiceTestClient(WindowServerServiceTestBase* test) |
| 27 : ServiceTestClient(test), test_(test) {} | 27 : ServiceTestClient(test), test_(test) {} |
| 28 ~WindowServerServiceTestClient() override {} | 28 ~WindowServerServiceTestClient() override {} |
| 29 | 29 |
| 30 private: | 30 private: |
| 31 // service_manager::test::ServiceTestClient: | 31 // service_manager::test::ServiceTestClient: |
| 32 bool OnConnect(const service_manager::ServiceInfo& remote_info, | 32 void OnBindInterface(const service_manager::ServiceInfo& source_info, |
| 33 service_manager::InterfaceRegistry* registry) override { | 33 const std::string& interface_name, |
| 34 return test_->OnConnect(remote_info.identity, registry); | 34 mojo::ScopedMessagePipeHandle interface_pipe) override { |
| 35 test_->OnBindInterface(source_info, interface_name, |
| 36 std::move(interface_pipe)); |
| 35 } | 37 } |
| 36 | 38 |
| 37 WindowServerServiceTestBase* test_; | 39 WindowServerServiceTestBase* test_; |
| 38 | 40 |
| 39 DISALLOW_COPY_AND_ASSIGN(WindowServerServiceTestClient); | 41 DISALLOW_COPY_AND_ASSIGN(WindowServerServiceTestClient); |
| 40 }; | 42 }; |
| 41 | 43 |
| 42 void EnsureCommandLineSwitch(const std::string& name) { | 44 void EnsureCommandLineSwitch(const std::string& name) { |
| 43 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); | 45 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
| 44 if (!cmd_line->HasSwitch(name)) | 46 if (!cmd_line->HasSwitch(name)) |
| 45 cmd_line->AppendSwitch(name); | 47 cmd_line->AppendSwitch(name); |
| 46 } | 48 } |
| 47 | 49 |
| 48 } // namespace | 50 } // namespace |
| 49 | 51 |
| 50 WindowServerServiceTestBase::WindowServerServiceTestBase() | 52 WindowServerServiceTestBase::WindowServerServiceTestBase() |
| 51 : ServiceTest(kTestAppName) { | 53 : ServiceTest(kTestAppName) { |
| 52 EnsureCommandLineSwitch(switches::kUseTestConfig); | 54 EnsureCommandLineSwitch(switches::kUseTestConfig); |
| 53 EnsureCommandLineSwitch(::switches::kOverrideUseSoftwareGLForTests); | 55 EnsureCommandLineSwitch(::switches::kOverrideUseSoftwareGLForTests); |
| 54 } | 56 } |
| 55 | 57 |
| 56 WindowServerServiceTestBase::~WindowServerServiceTestBase() {} | 58 WindowServerServiceTestBase::~WindowServerServiceTestBase() {} |
| 57 | 59 |
| 58 std::unique_ptr<service_manager::Service> | 60 std::unique_ptr<service_manager::Service> |
| 59 WindowServerServiceTestBase::CreateService() { | 61 WindowServerServiceTestBase::CreateService() { |
| 60 return base::MakeUnique<WindowServerServiceTestClient>(this); | 62 return base::MakeUnique<WindowServerServiceTestClient>(this); |
| 61 } | 63 } |
| 62 | 64 |
| 63 } // namespace ui | 65 } // namespace ui |
| OLD | NEW |