Chromium Code Reviews| Index: chrome/test/base/view_event_test_platform_part_aura.cc |
| diff --git a/chrome/test/base/view_event_test_platform_part_default.cc b/chrome/test/base/view_event_test_platform_part_aura.cc |
| similarity index 60% |
| rename from chrome/test/base/view_event_test_platform_part_default.cc |
| rename to chrome/test/base/view_event_test_platform_part_aura.cc |
| index 8d32515c4239b70af98b4a94ae3ea1a6080bec0f..aeab7aa97aae6c036b87ea87a828b9d38a57b005 100644 |
| --- a/chrome/test/base/view_event_test_platform_part_default.cc |
| +++ b/chrome/test/base/view_event_test_platform_part_aura.cc |
| @@ -5,26 +5,28 @@ |
| #include <memory> |
| #include "base/macros.h" |
| +#include "base/memory/ptr_util.h" |
| #include "chrome/test/base/view_event_test_platform_part.h" |
| #include "ui/aura/env.h" |
| #include "ui/display/screen.h" |
| +#include "ui/views/test/platform_test_helper.h" |
| #include "ui/views/widget/desktop_aura/desktop_screen.h" |
| +#include "ui/wm/core/wm_state.h" |
| -#if !defined(OS_CHROMEOS) && defined(OS_LINUX) |
| +#if defined(USE_X11) |
| #include "ui/views/test/test_desktop_screen_x11.h" |
| #endif |
| namespace { |
| -// ViewEventTestPlatformPart implementation for Views, but non-CrOS. |
| -class ViewEventTestPlatformPartDefault : public ViewEventTestPlatformPart { |
| +// ViewEventTestPlatformPart implementation for Aura Views, but non-CrOS. |
| +class ViewEventTestPlatformPartAura : public ViewEventTestPlatformPart { |
| public: |
| - ViewEventTestPlatformPartDefault( |
| + ViewEventTestPlatformPartAura( |
| ui::ContextFactory* context_factory, |
| ui::ContextFactoryPrivate* context_factory_private) { |
| -#if defined(USE_AURA) |
| DCHECK(!display::Screen::GetScreen()); |
| -#if defined(USE_X11) && !defined(OS_CHROMEOS) |
| +#if defined(USE_X11) |
| display::Screen::SetScreenInstance( |
| views::test::TestDesktopScreenX11::GetInstance()); |
| #else |
| @@ -34,24 +36,27 @@ class ViewEventTestPlatformPartDefault : public ViewEventTestPlatformPart { |
| env_ = aura::Env::CreateInstance(); |
| env_->set_context_factory(context_factory); |
| env_->set_context_factory_private(context_factory_private); |
| -#endif |
| + |
| + // See AuraTestHelper::SetUp(). |
| + if (!views::PlatformTestHelper::IsMus()) |
| + wm_state_ = base::MakeUnique<wm::WMState>(); |
|
tapted
2017/01/23 10:52:55
Some menu-related interactive_ui_tests fail with `
|
| } |
| - ~ViewEventTestPlatformPartDefault() override { |
| -#if defined(USE_AURA) |
| + ~ViewEventTestPlatformPartAura() override { |
| + wm_state_.reset(); |
| env_.reset(); |
| display::Screen::SetScreenInstance(nullptr); |
| -#endif |
| } |
| - // Overridden from ViewEventTestPlatformPart: |
| - gfx::NativeWindow GetContext() override { return NULL; } |
| + // ViewEventTestPlatformPart: |
| + gfx::NativeWindow GetContext() override { return nullptr; } |
| private: |
| std::unique_ptr<display::Screen> screen_; |
| std::unique_ptr<aura::Env> env_; |
| + std::unique_ptr<wm::WMState> wm_state_; |
| - DISALLOW_COPY_AND_ASSIGN(ViewEventTestPlatformPartDefault); |
| + DISALLOW_COPY_AND_ASSIGN(ViewEventTestPlatformPartAura); |
| }; |
| } // namespace |
| @@ -60,6 +65,6 @@ class ViewEventTestPlatformPartDefault : public ViewEventTestPlatformPart { |
| ViewEventTestPlatformPart* ViewEventTestPlatformPart::Create( |
| ui::ContextFactory* context_factory, |
| ui::ContextFactoryPrivate* context_factory_private) { |
| - return new ViewEventTestPlatformPartDefault(context_factory, |
| - context_factory_private); |
| + return new ViewEventTestPlatformPartAura(context_factory, |
| + context_factory_private); |
| } |