| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "services/ui/public/cpp/tests/window_server_shelltest_base.h" | |
| 6 | |
| 7 #include <memory> | |
| 8 | |
| 9 #include "base/command_line.h" | |
| 10 #include "base/macros.h" | |
| 11 #include "base/memory/ptr_util.h" | |
| 12 #include "services/service_manager/public/cpp/service.h" | |
| 13 #include "services/service_manager/public/cpp/service_test.h" | |
| 14 #include "services/ui/common/switches.h" | |
| 15 #include "ui/gl/gl_switches.h" | |
| 16 | |
| 17 namespace ui { | |
| 18 | |
| 19 namespace { | |
| 20 | |
| 21 const char kTestAppName[] = "mus_ws_unittests_app"; | |
| 22 | |
| 23 class WindowServerServiceTestClient | |
| 24 : public service_manager::test::ServiceTestClient { | |
| 25 public: | |
| 26 explicit WindowServerServiceTestClient(WindowServerServiceTestBase* test) | |
| 27 : ServiceTestClient(test), test_(test) {} | |
| 28 ~WindowServerServiceTestClient() override {} | |
| 29 | |
| 30 private: | |
| 31 // service_manager::test::ServiceTestClient: | |
| 32 bool OnConnect(const service_manager::ServiceInfo& remote_info, | |
| 33 service_manager::InterfaceRegistry* registry) override { | |
| 34 return test_->OnConnect(remote_info.identity, registry); | |
| 35 } | |
| 36 | |
| 37 WindowServerServiceTestBase* test_; | |
| 38 | |
| 39 DISALLOW_COPY_AND_ASSIGN(WindowServerServiceTestClient); | |
| 40 }; | |
| 41 | |
| 42 void EnsureCommandLineSwitch(const std::string& name) { | |
| 43 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); | |
| 44 if (!cmd_line->HasSwitch(name)) | |
| 45 cmd_line->AppendSwitch(name); | |
| 46 } | |
| 47 | |
| 48 } // namespace | |
| 49 | |
| 50 WindowServerServiceTestBase::WindowServerServiceTestBase() | |
| 51 : ServiceTest(kTestAppName) { | |
| 52 EnsureCommandLineSwitch(switches::kUseTestConfig); | |
| 53 EnsureCommandLineSwitch(::switches::kOverrideUseGLWithOSMesaForTests); | |
| 54 } | |
| 55 | |
| 56 WindowServerServiceTestBase::~WindowServerServiceTestBase() {} | |
| 57 | |
| 58 std::unique_ptr<service_manager::Service> | |
| 59 WindowServerServiceTestBase::CreateService() { | |
| 60 return base::MakeUnique<WindowServerServiceTestClient>(this); | |
| 61 } | |
| 62 | |
| 63 } // namespace ui | |
| OLD | NEW |