| 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/public/cpp/tests/window_server_shelltest_base.h" | 5 #include "services/ui/public/cpp/tests/window_server_shelltest_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 10 matching lines...) Expand all Loading... |
| 21 const char kTestAppName[] = "mojo:mus_ws_unittests_app"; | 21 const char kTestAppName[] = "mojo:mus_ws_unittests_app"; |
| 22 | 22 |
| 23 class WindowServerServiceTestClient : public shell::test::ServiceTestClient { | 23 class WindowServerServiceTestClient : public shell::test::ServiceTestClient { |
| 24 public: | 24 public: |
| 25 explicit WindowServerServiceTestClient(WindowServerServiceTestBase* test) | 25 explicit WindowServerServiceTestClient(WindowServerServiceTestBase* test) |
| 26 : ServiceTestClient(test), test_(test) {} | 26 : ServiceTestClient(test), test_(test) {} |
| 27 ~WindowServerServiceTestClient() override {} | 27 ~WindowServerServiceTestClient() override {} |
| 28 | 28 |
| 29 private: | 29 private: |
| 30 // shell::test::ServiceTestClient: | 30 // shell::test::ServiceTestClient: |
| 31 bool OnConnect(shell::Connection* connection) override { | 31 bool OnConnect(const shell::Identity& remote_identity, |
| 32 return test_->OnConnect(connection); | 32 shell::InterfaceRegistry* registry) override { |
| 33 return test_->OnConnect(remote_identity, registry); |
| 33 } | 34 } |
| 34 | 35 |
| 35 WindowServerServiceTestBase* test_; | 36 WindowServerServiceTestBase* test_; |
| 36 | 37 |
| 37 DISALLOW_COPY_AND_ASSIGN(WindowServerServiceTestClient); | 38 DISALLOW_COPY_AND_ASSIGN(WindowServerServiceTestClient); |
| 38 }; | 39 }; |
| 39 | 40 |
| 40 void EnsureCommandLineSwitch(const std::string& name) { | 41 void EnsureCommandLineSwitch(const std::string& name) { |
| 41 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); | 42 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
| 42 if (!cmd_line->HasSwitch(name)) | 43 if (!cmd_line->HasSwitch(name)) |
| 43 cmd_line->AppendSwitch(name); | 44 cmd_line->AppendSwitch(name); |
| 44 } | 45 } |
| 45 | 46 |
| 46 } // namespace | 47 } // namespace |
| 47 | 48 |
| 48 WindowServerServiceTestBase::WindowServerServiceTestBase() | 49 WindowServerServiceTestBase::WindowServerServiceTestBase() |
| 49 : ServiceTest(kTestAppName) { | 50 : ServiceTest(kTestAppName) { |
| 50 EnsureCommandLineSwitch(switches::kUseTestConfig); | 51 EnsureCommandLineSwitch(switches::kUseTestConfig); |
| 51 EnsureCommandLineSwitch(::switches::kOverrideUseGLWithOSMesaForTests); | 52 EnsureCommandLineSwitch(::switches::kOverrideUseGLWithOSMesaForTests); |
| 52 } | 53 } |
| 53 | 54 |
| 54 WindowServerServiceTestBase::~WindowServerServiceTestBase() {} | 55 WindowServerServiceTestBase::~WindowServerServiceTestBase() {} |
| 55 | 56 |
| 56 std::unique_ptr<shell::Service> | 57 std::unique_ptr<shell::Service> |
| 57 WindowServerServiceTestBase::CreateService() { | 58 WindowServerServiceTestBase::CreateService() { |
| 58 return base::WrapUnique(new WindowServerServiceTestClient(this)); | 59 return base::WrapUnique(new WindowServerServiceTestClient(this)); |
| 59 } | 60 } |
| 60 | 61 |
| 61 } // namespace ui | 62 } // namespace ui |
| OLD | NEW |