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