| 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" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 &PlatformTestHelperMus::CreateNativeWidgetMus, base::Unretained(this), | 59 &PlatformTestHelperMus::CreateNativeWidgetMus, base::Unretained(this), |
| 60 std::map<std::string, std::vector<uint8_t>>())); | 60 std::map<std::string, std::vector<uint8_t>>())); |
| 61 } | 61 } |
| 62 | 62 |
| 63 ~PlatformTestHelperMus() override { | 63 ~PlatformTestHelperMus() override { |
| 64 WindowManagerConnection::Reset(); | 64 WindowManagerConnection::Reset(); |
| 65 // |app_| has a reference to us, destroy it while we are still valid. | 65 // |app_| has a reference to us, destroy it while we are still valid. |
| 66 shell_connection_.reset(); | 66 shell_connection_.reset(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 bool IsMus() const override { return true; } | |
| 70 | |
| 71 private: | 69 private: |
| 72 NativeWidget* CreateNativeWidgetMus( | 70 NativeWidget* CreateNativeWidgetMus( |
| 73 const std::map<std::string, std::vector<uint8_t>>& props, | 71 const std::map<std::string, std::vector<uint8_t>>& props, |
| 74 const Widget::InitParams& init_params, | 72 const Widget::InitParams& init_params, |
| 75 internal::NativeWidgetDelegate* delegate) { | 73 internal::NativeWidgetDelegate* delegate) { |
| 76 ui::ContextFactory* factory = aura::Env::GetInstance()->context_factory(); | 74 ui::ContextFactory* factory = aura::Env::GetInstance()->context_factory(); |
| 77 aura::Env::GetInstance()->set_context_factory(nullptr); | 75 aura::Env::GetInstance()->set_context_factory(nullptr); |
| 78 NativeWidget* result = | 76 NativeWidget* result = |
| 79 WindowManagerConnection::Get()->CreateNativeWidgetMus( | 77 WindowManagerConnection::Get()->CreateNativeWidgetMus( |
| 80 props, init_params, delegate); | 78 props, init_params, delegate); |
| 81 aura::Env::GetInstance()->set_context_factory(factory); | 79 aura::Env::GetInstance()->set_context_factory(factory); |
| 82 return result; | 80 return result; |
| 83 } | 81 } |
| 84 | 82 |
| 85 std::unique_ptr<BackgroundShell> background_shell_; | 83 std::unique_ptr<BackgroundShell> background_shell_; |
| 86 std::unique_ptr<shell::ShellConnection> shell_connection_; | 84 std::unique_ptr<shell::ShellConnection> shell_connection_; |
| 87 std::unique_ptr<DefaultShellClient> shell_client_; | 85 std::unique_ptr<DefaultShellClient> shell_client_; |
| 88 | 86 |
| 89 DISALLOW_COPY_AND_ASSIGN(PlatformTestHelperMus); | 87 DISALLOW_COPY_AND_ASSIGN(PlatformTestHelperMus); |
| 90 }; | 88 }; |
| 91 | 89 |
| 92 } // namespace | 90 } // namespace |
| 93 | 91 |
| 94 // static | 92 // static |
| 95 std::unique_ptr<PlatformTestHelper> PlatformTestHelper::Create() { | 93 std::unique_ptr<PlatformTestHelper> PlatformTestHelper::Create() { |
| 96 return base::WrapUnique(new PlatformTestHelperMus); | 94 return base::WrapUnique(new PlatformTestHelperMus); |
| 97 } | 95 } |
| 98 | 96 |
| 97 // static |
| 98 bool PlatformTestHelper::IsMus() { |
| 99 return true; |
| 100 } |
| 101 |
| 99 } // namespace views | 102 } // namespace views |
| OLD | NEW |