Merge html-office-public repo into src
[chromium-blink-merge.git] / chrome / test / base / view_event_test_platform_part_ash.cc
blob9a91efed0bb5f941e703b24a064d9e96f73e09bc
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/test/base/view_event_test_platform_part.h"
7 #include "ui/aura/env.h"
8 #include "ui/gfx/screen.h"
9 #include "ui/views/widget/desktop_aura/desktop_screen.h"
10 #include "ui/wm/core/wm_state.h"
12 namespace {
14 // ChromeViewsTestHelper implementation for non-ChromeOS environments, where the
15 // Ash desktop environment is available (use_ash=1, chromeos=0).
16 class ViewEventTestPlatformPartAsh : public ViewEventTestPlatformPart {
17 public:
18 explicit ViewEventTestPlatformPartAsh(ui::ContextFactory* context_factory);
19 ~ViewEventTestPlatformPartAsh() override;
21 // Overridden from ViewEventTestPlatformPart:
22 gfx::NativeWindow GetContext() override {
23 return NULL; // No context, so that desktop tree hosts are used by default.
26 private:
27 wm::WMState wm_state_;
29 DISALLOW_COPY_AND_ASSIGN(ViewEventTestPlatformPartAsh);
32 ViewEventTestPlatformPartAsh::ViewEventTestPlatformPartAsh(
33 ui::ContextFactory* context_factory) {
34 // http://crbug.com/154081 use ash::Shell code path below on win_ash bots when
35 // interactive_ui_tests is brought up on that platform.
36 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE,
37 views::CreateDesktopScreen());
38 aura::Env::CreateInstance(true);
39 aura::Env::GetInstance()->set_context_factory(context_factory);
42 ViewEventTestPlatformPartAsh::~ViewEventTestPlatformPartAsh() {
43 aura::Env::DeleteInstance();
46 } // namespace
48 // static
49 ViewEventTestPlatformPart* ViewEventTestPlatformPart::Create(
50 ui::ContextFactory* context_factory) {
51 return new ViewEventTestPlatformPartAsh(context_factory);