| Index: components/mus/public/cpp/tests/window_manager_shelltest_base.cc
|
| diff --git a/components/mus/public/cpp/tests/window_manager_shelltest_base.cc b/components/mus/public/cpp/tests/window_manager_shelltest_base.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..740252683af76341939a90d655f3bdaec7b78a8a
|
| --- /dev/null
|
| +++ b/components/mus/public/cpp/tests/window_manager_shelltest_base.cc
|
| @@ -0,0 +1,58 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "components/mus/public/cpp/tests/window_manager_shelltest_base.h"
|
| +
|
| +#include "base/command_line.h"
|
| +#include "base/macros.h"
|
| +#include "base/memory/scoped_ptr.h"
|
| +#include "components/mus/common/args.h"
|
| +#include "mojo/shell/public/cpp/shell_client.h"
|
| +#include "mojo/shell/public/cpp/shell_test.h"
|
| +#include "ui/gl/gl_switches.h"
|
| +
|
| +namespace mus {
|
| +
|
| +namespace {
|
| +
|
| +const char kTestAppName[] = "mojo:window_manager_shelltests_app";
|
| +
|
| +class WindowManagerShellTestClient : public mojo::test::ShellTestClient {
|
| + public:
|
| + explicit WindowManagerShellTestClient(WindowManagerShellTestBase* test)
|
| + : ShellTestClient(test), test_(test) {}
|
| + ~WindowManagerShellTestClient() override {}
|
| +
|
| + private:
|
| + // mojo::test::ShellTestClient:
|
| + bool AcceptConnection(mojo::Connection* connection) override {
|
| + return test_->AcceptConnection(connection);
|
| + }
|
| +
|
| + WindowManagerShellTestBase* test_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(WindowManagerShellTestClient);
|
| +};
|
| +
|
| +void EnsureCommandLineSwitch(const std::string& name) {
|
| + base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
|
| + if (!cmd_line->HasSwitch(name))
|
| + cmd_line->AppendSwitch(name);
|
| +}
|
| +
|
| +} // namespace
|
| +
|
| +WindowManagerShellTestBase::WindowManagerShellTestBase()
|
| + : ShellTest(kTestAppName) {
|
| + EnsureCommandLineSwitch(kUseX11TestConfig);
|
| + EnsureCommandLineSwitch(switches::kOverrideUseGLWithOSMesaForTests);
|
| +}
|
| +
|
| +WindowManagerShellTestBase::~WindowManagerShellTestBase() {}
|
| +
|
| +scoped_ptr<mojo::ShellClient> WindowManagerShellTestBase::CreateShellClient() {
|
| + return make_scoped_ptr(new WindowManagerShellTestClient(this));
|
| +}
|
| +
|
| +} // namespace mus
|
|
|