| 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/background/tests/test_catalog_store.h" | 9 #include "mojo/shell/background/tests/test_catalog_store.h" |
| 10 #include "mojo/shell/public/cpp/connector.h" | 10 #include "mojo/shell/public/cpp/connector.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 PlatformTestHelperMus() { | 40 PlatformTestHelperMus() { |
| 41 background_shell_.reset(new BackgroundShell); | 41 background_shell_.reset(new BackgroundShell); |
| 42 scoped_ptr<BackgroundShell::InitParams> init_params( | 42 scoped_ptr<BackgroundShell::InitParams> init_params( |
| 43 new BackgroundShell::InitParams); | 43 new BackgroundShell::InitParams); |
| 44 init_params->catalog_store = BuildTestCatalogStore(); | 44 init_params->catalog_store = BuildTestCatalogStore(); |
| 45 background_shell_->Init(std::move(init_params)); | 45 background_shell_->Init(std::move(init_params)); |
| 46 shell_client_.reset(new DefaultShellClient); | 46 shell_client_.reset(new DefaultShellClient); |
| 47 shell_connection_.reset(new mojo::ShellConnection( | 47 shell_connection_.reset(new mojo::ShellConnection( |
| 48 shell_client_.get(), | 48 shell_client_.get(), |
| 49 background_shell_->CreateShellClientRequest(kTestName))); | 49 background_shell_->CreateShellClientRequest(kTestName))); |
| 50 shell_connection_->WaitForInitialize(); | |
| 51 // ui/views/mus requires a WindowManager running, for now use the desktop | 50 // ui/views/mus requires a WindowManager running, for now use the desktop |
| 52 // one. | 51 // one. |
| 53 mojo::Connector* connector = shell_connection_->connector(); | 52 mojo::Connector* connector = shell_connection_->connector(); |
| 54 connector->Connect("mojo:desktop_wm"); | 53 connector->Connect("mojo:desktop_wm"); |
| 55 WindowManagerConnection::Create(connector); | 54 WindowManagerConnection::Create(connector); |
| 56 } | 55 } |
| 57 | 56 |
| 58 ~PlatformTestHelperMus() override { | 57 ~PlatformTestHelperMus() override { |
| 59 WindowManagerConnection::Reset(); | 58 WindowManagerConnection::Reset(); |
| 60 // |app_| has a reference to us, destroy it while we are still valid. | 59 // |app_| has a reference to us, destroy it while we are still valid. |
| 61 shell_connection_.reset(); | 60 shell_connection_.reset(); |
| 62 } | 61 } |
| 63 | 62 |
| 64 private: | 63 private: |
| 65 scoped_ptr<BackgroundShell> background_shell_; | 64 scoped_ptr<BackgroundShell> background_shell_; |
| 66 scoped_ptr<mojo::ShellConnection> shell_connection_; | 65 scoped_ptr<mojo::ShellConnection> shell_connection_; |
| 67 scoped_ptr<DefaultShellClient> shell_client_; | 66 scoped_ptr<DefaultShellClient> shell_client_; |
| 68 | 67 |
| 69 DISALLOW_COPY_AND_ASSIGN(PlatformTestHelperMus); | 68 DISALLOW_COPY_AND_ASSIGN(PlatformTestHelperMus); |
| 70 }; | 69 }; |
| 71 | 70 |
| 72 } // namespace | 71 } // namespace |
| 73 | 72 |
| 74 // static | 73 // static |
| 75 scoped_ptr<PlatformTestHelper> PlatformTestHelper::Create() { | 74 scoped_ptr<PlatformTestHelper> PlatformTestHelper::Create() { |
| 76 return make_scoped_ptr(new PlatformTestHelperMus); | 75 return make_scoped_ptr(new PlatformTestHelperMus); |
| 77 } | 76 } |
| 78 | 77 |
| 79 } // namespace views | 78 } // namespace views |
| OLD | NEW |