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