| 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 "ui/views/test/platform_test_helper.h" | 5 #include "ui/views/test/platform_test_helper.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "mojo/shell/background/background_shell.h" | 8 #include "mojo/shell/background/background_shell.h" |
| 9 #include "mojo/shell/public/cpp/shell_client.h" | 9 #include "mojo/shell/public/cpp/shell_client.h" |
| 10 #include "mojo/shell/public/cpp/shell_connection.h" | 10 #include "mojo/shell/public/cpp/shell_connection.h" |
| 11 #include "mojo/shell/runner/host/command_line_switch.h" | |
| 12 #include "ui/views/mus/window_manager_connection.h" | 11 #include "ui/views/mus/window_manager_connection.h" |
| 13 #include "url/gurl.h" | 12 #include "url/gurl.h" |
| 14 | 13 |
| 15 namespace views { | 14 namespace views { |
| 16 namespace { | 15 namespace { |
| 17 | 16 |
| 18 class DefaultShellClient : public mojo::ShellClient { | 17 class DefaultShellClient : public mojo::ShellClient { |
| 19 public: | 18 public: |
| 20 DefaultShellClient() {} | 19 DefaultShellClient() {} |
| 21 ~DefaultShellClient() override {} | 20 ~DefaultShellClient() override {} |
| 22 | 21 |
| 23 private: | 22 private: |
| 24 DISALLOW_COPY_AND_ASSIGN(DefaultShellClient); | 23 DISALLOW_COPY_AND_ASSIGN(DefaultShellClient); |
| 25 }; | 24 }; |
| 26 | 25 |
| 27 class PlatformTestHelperMus : public PlatformTestHelper { | 26 class PlatformTestHelperMus : public PlatformTestHelper { |
| 28 public: | 27 public: |
| 29 PlatformTestHelperMus() { | 28 PlatformTestHelperMus() { |
| 30 // Force the new edk. | 29 // Force the new edk. |
| 31 base::CommandLine::ForCurrentProcess()->AppendSwitch("use-new-edk"); | 30 base::CommandLine::ForCurrentProcess()->AppendSwitch("use-new-edk"); |
| 32 | 31 |
| 33 background_shell_.reset(new mojo::shell::BackgroundShell); | 32 background_shell_.reset(new mojo::shell::BackgroundShell); |
| 34 background_shell_->Init(std::vector<mojo::shell::CommandLineSwitch>()); | 33 background_shell_->Init(nullptr); |
| 35 shell_client_.reset(new DefaultShellClient); | 34 shell_client_.reset(new DefaultShellClient); |
| 36 shell_connection_.reset(new mojo::ShellConnection( | 35 shell_connection_.reset(new mojo::ShellConnection( |
| 37 shell_client_.get(), | 36 shell_client_.get(), |
| 38 background_shell_->CreateShellClientRequest(GURL("mojo://test-app")))); | 37 background_shell_->CreateShellClientRequest(GURL("mojo://test-app")))); |
| 39 shell_connection_->WaitForInitialize(); | 38 shell_connection_->WaitForInitialize(); |
| 40 // ui/views/mus requires a WindowManager running, for now use the desktop | 39 // ui/views/mus requires a WindowManager running, for now use the desktop |
| 41 // one. | 40 // one. |
| 42 mojo::Shell* shell = shell_connection_.get(); | 41 mojo::Shell* shell = shell_connection_.get(); |
| 43 shell->Connect("mojo:desktop_wm"); | 42 shell->Connect("mojo:desktop_wm"); |
| 44 WindowManagerConnection::Create(shell_connection_.get()); | 43 WindowManagerConnection::Create(shell_connection_.get()); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 59 }; | 58 }; |
| 60 | 59 |
| 61 } // namespace | 60 } // namespace |
| 62 | 61 |
| 63 // static | 62 // static |
| 64 scoped_ptr<PlatformTestHelper> PlatformTestHelper::Create() { | 63 scoped_ptr<PlatformTestHelper> PlatformTestHelper::Create() { |
| 65 return make_scoped_ptr(new PlatformTestHelperMus); | 64 return make_scoped_ptr(new PlatformTestHelperMus); |
| 66 } | 65 } |
| 67 | 66 |
| 68 } // namespace views | 67 } // namespace views |
| OLD | NEW |