| 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 "components/mus/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 "components/mus/common/switches.h" | |
| 13 #include "services/shell/public/cpp/shell_client.h" | |
| 14 #include "services/shell/public/cpp/shell_test.h" | |
| 15 #include "ui/gl/gl_switches.h" | |
| 16 | |
| 17 namespace mus { | |
| 18 | |
| 19 namespace { | |
| 20 | |
| 21 const char kTestAppName[] = "mojo:mus_ws_unittests_app"; | |
| 22 | |
| 23 class WindowServerShellTestClient : public shell::test::ShellTestClient { | |
| 24 public: | |
| 25 explicit WindowServerShellTestClient(WindowServerShellTestBase* test) | |
| 26 : ShellTestClient(test), test_(test) {} | |
| 27 ~WindowServerShellTestClient() override {} | |
| 28 | |
| 29 private: | |
| 30 // shell::test::ShellTestClient: | |
| 31 bool AcceptConnection(shell::Connection* connection) override { | |
| 32 return test_->AcceptConnection(connection); | |
| 33 } | |
| 34 | |
| 35 WindowServerShellTestBase* test_; | |
| 36 | |
| 37 DISALLOW_COPY_AND_ASSIGN(WindowServerShellTestClient); | |
| 38 }; | |
| 39 | |
| 40 void EnsureCommandLineSwitch(const std::string& name) { | |
| 41 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); | |
| 42 if (!cmd_line->HasSwitch(name)) | |
| 43 cmd_line->AppendSwitch(name); | |
| 44 } | |
| 45 | |
| 46 } // namespace | |
| 47 | |
| 48 WindowServerShellTestBase::WindowServerShellTestBase() | |
| 49 : ShellTest(kTestAppName) { | |
| 50 EnsureCommandLineSwitch(switches::kUseTestConfig); | |
| 51 EnsureCommandLineSwitch(::switches::kOverrideUseGLWithOSMesaForTests); | |
| 52 } | |
| 53 | |
| 54 WindowServerShellTestBase::~WindowServerShellTestBase() {} | |
| 55 | |
| 56 std::unique_ptr<shell::ShellClient> | |
| 57 WindowServerShellTestBase::CreateShellClient() { | |
| 58 return base::WrapUnique(new WindowServerShellTestClient(this)); | |
| 59 } | |
| 60 | |
| 61 } // namespace mus | |
| OLD | NEW |