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" |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 background_shell_.reset(new mojo::shell::BackgroundShell); | 32 background_shell_.reset(new mojo::shell::BackgroundShell); |
33 background_shell_->Init(nullptr); | 33 background_shell_->Init(nullptr); |
34 shell_client_.reset(new DefaultShellClient); | 34 shell_client_.reset(new DefaultShellClient); |
35 shell_connection_.reset(new mojo::ShellConnection( | 35 shell_connection_.reset(new mojo::ShellConnection( |
36 shell_client_.get(), | 36 shell_client_.get(), |
37 background_shell_->CreateShellClientRequest(GURL("mojo://test-app")))); | 37 background_shell_->CreateShellClientRequest(GURL("mojo://test-app")))); |
38 shell_connection_->WaitForInitialize(); | 38 shell_connection_->WaitForInitialize(); |
39 // 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 |
40 // one. | 40 // one. |
41 mojo::Shell* shell = shell_connection_.get(); | 41 mojo::Connector* connector = shell_connection_->connector(); |
42 shell->Connect("mojo:desktop_wm"); | 42 connector->Connect("mojo:desktop_wm"); |
43 WindowManagerConnection::Create(shell_connection_.get()); | 43 WindowManagerConnection::Create(connector); |
44 } | 44 } |
45 | 45 |
46 ~PlatformTestHelperMus() override { | 46 ~PlatformTestHelperMus() override { |
47 WindowManagerConnection::Reset(); | 47 WindowManagerConnection::Reset(); |
48 // |app_| has a reference to us, destroy it while we are still valid. | 48 // |app_| has a reference to us, destroy it while we are still valid. |
49 shell_connection_.reset(); | 49 shell_connection_.reset(); |
50 } | 50 } |
51 | 51 |
52 private: | 52 private: |
53 scoped_ptr<mojo::shell::BackgroundShell> background_shell_; | 53 scoped_ptr<mojo::shell::BackgroundShell> background_shell_; |
54 scoped_ptr<mojo::ShellConnection> shell_connection_; | 54 scoped_ptr<mojo::ShellConnection> shell_connection_; |
55 scoped_ptr<DefaultShellClient> shell_client_; | 55 scoped_ptr<DefaultShellClient> shell_client_; |
56 | 56 |
57 DISALLOW_COPY_AND_ASSIGN(PlatformTestHelperMus); | 57 DISALLOW_COPY_AND_ASSIGN(PlatformTestHelperMus); |
58 }; | 58 }; |
59 | 59 |
60 } // namespace | 60 } // namespace |
61 | 61 |
62 // static | 62 // static |
63 scoped_ptr<PlatformTestHelper> PlatformTestHelper::Create() { | 63 scoped_ptr<PlatformTestHelper> PlatformTestHelper::Create() { |
64 return make_scoped_ptr(new PlatformTestHelperMus); | 64 return make_scoped_ptr(new PlatformTestHelperMus); |
65 } | 65 } |
66 | 66 |
67 } // namespace views | 67 } // namespace views |
OLD | NEW |