OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #include "chrome/test/base/chrome_views_test_helper.h" |
| 6 |
| 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" |
| 11 |
| 12 namespace { |
| 13 |
| 14 // ChromeViewsTestHelper implementation for non-ChromeOS environments, where the |
| 15 // Ash desktop environment is available (use_ash=1, chromeos=0). |
| 16 class ChromeViewsTestHelperAsh : public ChromeViewsTestHelper { |
| 17 public: |
| 18 ChromeViewsTestHelperAsh() {} |
| 19 |
| 20 // Overridden from ChromeViewsTestHelper: |
| 21 virtual gfx::NativeWindow PlatformSetUp( |
| 22 ui::ContextFactory* context_factory) OVERRIDE; |
| 23 virtual void PlatformTearDown() OVERRIDE; |
| 24 |
| 25 private: |
| 26 wm::WMState wm_state_; |
| 27 |
| 28 DISALLOW_COPY_AND_ASSIGN(ChromeViewsTestHelperAsh); |
| 29 }; |
| 30 |
| 31 gfx::NativeWindow ChromeViewsTestHelperAsh::PlatformSetUp( |
| 32 ui::ContextFactory* context_factory) { |
| 33 // http://crbug.com/154081 use ash::Shell code path below on win_ash bots when |
| 34 // interactive_ui_tests is brought up on that platform. |
| 35 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, |
| 36 views::CreateDesktopScreen()); |
| 37 aura::Env::CreateInstance(true); |
| 38 aura::Env::GetInstance()->set_context_factory(context_factory); |
| 39 return NULL; // No context, so that desktop tree hosts are used by default. |
| 40 } |
| 41 |
| 42 void ChromeViewsTestHelperAsh::PlatformTearDown() { |
| 43 aura::Env::DeleteInstance(); |
| 44 } |
| 45 |
| 46 } // namespace |
| 47 |
| 48 // static |
| 49 ChromeViewsTestHelper* ChromeViewsTestHelper::Create() { |
| 50 return new ChromeViewsTestHelperAsh(); |
| 51 } |
OLD | NEW |