Do not announce robot account token before account ID is available
[chromium-blink-merge.git] / chrome / test / base / view_event_test_platform_part_ash.cc
blob89f3c94c9a55aecf892c1aeeae5599eb55edc077
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 "base/memory/scoped_ptr.h"
8 #include "ui/aura/env.h"
9 #include "ui/gfx/screen.h"
10 #include "ui/views/widget/desktop_aura/desktop_screen.h"
11 #include "ui/wm/core/wm_state.h"
13 namespace {
15 // ChromeViewsTestHelper implementation for non-ChromeOS environments, where the
16 // Ash desktop environment is available (use_ash=1, chromeos=0).
17 class ViewEventTestPlatformPartAsh : public ViewEventTestPlatformPart {
18 public:
19 explicit ViewEventTestPlatformPartAsh(ui::ContextFactory* context_factory);
20 ~ViewEventTestPlatformPartAsh() override;
22 // Overridden from ViewEventTestPlatformPart:
23 gfx::NativeWindow GetContext() override {
24 return NULL; // No context, so that desktop tree hosts are used by default.
27 private:
28 scoped_ptr<gfx::Screen> screen_;
29 wm::WMState wm_state_;
31 DISALLOW_COPY_AND_ASSIGN(ViewEventTestPlatformPartAsh);
34 ViewEventTestPlatformPartAsh::ViewEventTestPlatformPartAsh(
35 ui::ContextFactory* context_factory)
36 : screen_(views::CreateDesktopScreen()) {
37 // http://crbug.com/154081 use ash::Shell code path below on win_ash bots when
38 // interactive_ui_tests is brought up on that platform.
39 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get());
40 aura::Env::CreateInstance(true);
41 aura::Env::GetInstance()->set_context_factory(context_factory);
44 ViewEventTestPlatformPartAsh::~ViewEventTestPlatformPartAsh() {
45 aura::Env::DeleteInstance();
46 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, nullptr);
49 } // namespace
51 // static
52 ViewEventTestPlatformPart* ViewEventTestPlatformPart::Create(
53 ui::ContextFactory* context_factory) {
54 return new ViewEventTestPlatformPartAsh(context_factory);