| 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/memory/ptr_util.h" | 6 #include "base/memory/ptr_util.h" |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "services/shell/background/background_shell.h" | 8 #include "services/shell/background/background_shell.h" |
| 9 #include "services/shell/background/tests/test_catalog_store.h" | 9 #include "services/shell/background/tests/test_catalog_store.h" |
| 10 #include "services/shell/public/cpp/connector.h" | 10 #include "services/shell/public/cpp/connector.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_connection.h" | 12 #include "services/shell/public/cpp/shell_connection.h" |
| 13 #include "ui/aura/env.h" | 13 #include "ui/aura/env.h" |
| 14 #include "ui/views/mus/window_manager_connection.h" | 14 #include "ui/views/mus/window_manager_connection.h" |
| 15 #include "ui/views/test/platform_test_helper.h" | 15 #include "ui/views/test/platform_test_helper.h" |
| 16 #include "ui/views/views_delegate.h" | 16 #include "ui/views/views_delegate.h" |
| 17 | 17 |
| 18 using shell::BackgroundShell; | 18 using shell::BackgroundShell; |
| 19 | 19 |
| 20 namespace views { | 20 namespace views { |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 const char kTestName[] = "mojo:test-app"; | 23 const char kTestName[] = "exe:views_mus_unittests"; |
| 24 | 24 |
| 25 class DefaultShellClient : public shell::ShellClient { | 25 class DefaultShellClient : public shell::ShellClient { |
| 26 public: | 26 public: |
| 27 DefaultShellClient() {} | 27 DefaultShellClient() {} |
| 28 ~DefaultShellClient() override {} | 28 ~DefaultShellClient() override {} |
| 29 | 29 |
| 30 private: | 30 private: |
| 31 DISALLOW_COPY_AND_ASSIGN(DefaultShellClient); | 31 DISALLOW_COPY_AND_ASSIGN(DefaultShellClient); |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 std::unique_ptr<shell::TestCatalogStore> BuildTestCatalogStore() { | |
| 35 std::unique_ptr<base::ListValue> apps(new base::ListValue); | |
| 36 apps->Append(shell::BuildPermissiveSerializedAppInfo(kTestName, "test")); | |
| 37 return base::WrapUnique(new shell::TestCatalogStore(std::move(apps))); | |
| 38 } | |
| 39 | |
| 40 class PlatformTestHelperMus : public PlatformTestHelper { | 34 class PlatformTestHelperMus : public PlatformTestHelper { |
| 41 public: | 35 public: |
| 42 PlatformTestHelperMus() { | 36 PlatformTestHelperMus() { |
| 43 background_shell_.reset(new BackgroundShell); | 37 background_shell_.reset(new BackgroundShell); |
| 44 std::unique_ptr<BackgroundShell::InitParams> init_params( | 38 background_shell_->Init(nullptr); |
| 45 new BackgroundShell::InitParams); | |
| 46 init_params->catalog_store = BuildTestCatalogStore(); | |
| 47 background_shell_->Init(std::move(init_params)); | |
| 48 shell_client_.reset(new DefaultShellClient); | 39 shell_client_.reset(new DefaultShellClient); |
| 49 shell_connection_.reset(new shell::ShellConnection( | 40 shell_connection_.reset(new shell::ShellConnection( |
| 50 shell_client_.get(), | 41 shell_client_.get(), |
| 51 background_shell_->CreateShellClientRequest(kTestName))); | 42 background_shell_->CreateShellClientRequest(kTestName))); |
| 52 | 43 |
| 53 // TODO(rockot): Remove this RunLoop. http://crbug.com/594852. | 44 // TODO(rockot): Remove this RunLoop. http://crbug.com/594852. |
| 54 base::RunLoop wait_loop; | 45 base::RunLoop wait_loop; |
| 55 shell_connection_->set_initialize_handler(wait_loop.QuitClosure()); | 46 shell_connection_->set_initialize_handler(wait_loop.QuitClosure()); |
| 56 wait_loop.Run(); | 47 wait_loop.Run(); |
| 57 | 48 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 }; | 90 }; |
| 100 | 91 |
| 101 } // namespace | 92 } // namespace |
| 102 | 93 |
| 103 // static | 94 // static |
| 104 std::unique_ptr<PlatformTestHelper> PlatformTestHelper::Create() { | 95 std::unique_ptr<PlatformTestHelper> PlatformTestHelper::Create() { |
| 105 return base::WrapUnique(new PlatformTestHelperMus); | 96 return base::WrapUnique(new PlatformTestHelperMus); |
| 106 } | 97 } |
| 107 | 98 |
| 108 } // namespace views | 99 } // namespace views |
| OLD | NEW |