Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(303)

Side by Side Diff: chrome/test/base/view_event_test_platform_part_ash.cc

Issue 1297173003: Revert of aura: Require explicit ownership of the Env instance. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/test/test_suite.cc ('k') | chrome/test/base/view_event_test_platform_part_chromeos.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 "chrome/test/base/view_event_test_platform_part.h" 5 #include "chrome/test/base/view_event_test_platform_part.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "ui/aura/env.h" 8 #include "ui/aura/env.h"
9 #include "ui/gfx/screen.h" 9 #include "ui/gfx/screen.h"
10 #include "ui/views/widget/desktop_aura/desktop_screen.h" 10 #include "ui/views/widget/desktop_aura/desktop_screen.h"
11 #include "ui/wm/core/wm_state.h" 11 #include "ui/wm/core/wm_state.h"
12 12
13 namespace { 13 namespace {
14 14
15 // ChromeViewsTestHelper implementation for non-ChromeOS environments, where the 15 // ChromeViewsTestHelper implementation for non-ChromeOS environments, where the
16 // Ash desktop environment is available (use_ash=1, chromeos=0). 16 // Ash desktop environment is available (use_ash=1, chromeos=0).
17 class ViewEventTestPlatformPartAsh : public ViewEventTestPlatformPart { 17 class ViewEventTestPlatformPartAsh : public ViewEventTestPlatformPart {
18 public: 18 public:
19 explicit ViewEventTestPlatformPartAsh(ui::ContextFactory* context_factory); 19 explicit ViewEventTestPlatformPartAsh(ui::ContextFactory* context_factory);
20 ~ViewEventTestPlatformPartAsh() override; 20 ~ViewEventTestPlatformPartAsh() override;
21 21
22 // Overridden from ViewEventTestPlatformPart: 22 // Overridden from ViewEventTestPlatformPart:
23 gfx::NativeWindow GetContext() override { 23 gfx::NativeWindow GetContext() override {
24 return NULL; // No context, so that desktop tree hosts are used by default. 24 return NULL; // No context, so that desktop tree hosts are used by default.
25 } 25 }
26 26
27 private: 27 private:
28 scoped_ptr<gfx::Screen> screen_; 28 scoped_ptr<gfx::Screen> screen_;
29 wm::WMState wm_state_; 29 wm::WMState wm_state_;
30 scoped_ptr<aura::Env> env_;
31 30
32 DISALLOW_COPY_AND_ASSIGN(ViewEventTestPlatformPartAsh); 31 DISALLOW_COPY_AND_ASSIGN(ViewEventTestPlatformPartAsh);
33 }; 32 };
34 33
35 ViewEventTestPlatformPartAsh::ViewEventTestPlatformPartAsh( 34 ViewEventTestPlatformPartAsh::ViewEventTestPlatformPartAsh(
36 ui::ContextFactory* context_factory) 35 ui::ContextFactory* context_factory)
37 : screen_(views::CreateDesktopScreen()) { 36 : screen_(views::CreateDesktopScreen()) {
38 // http://crbug.com/154081 use ash::Shell code path below on win_ash bots when 37 // http://crbug.com/154081 use ash::Shell code path below on win_ash bots when
39 // interactive_ui_tests is brought up on that platform. 38 // interactive_ui_tests is brought up on that platform.
40 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get()); 39 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get());
41 env_ = aura::Env::CreateInstance(); 40 aura::Env::CreateInstance(true);
42 aura::Env::GetInstance()->set_context_factory(context_factory); 41 aura::Env::GetInstance()->set_context_factory(context_factory);
43 } 42 }
44 43
45 ViewEventTestPlatformPartAsh::~ViewEventTestPlatformPartAsh() { 44 ViewEventTestPlatformPartAsh::~ViewEventTestPlatformPartAsh() {
46 env_.reset(); 45 aura::Env::DeleteInstance();
47 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, nullptr); 46 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, nullptr);
48 } 47 }
49 48
50 } // namespace 49 } // namespace
51 50
52 // static 51 // static
53 ViewEventTestPlatformPart* ViewEventTestPlatformPart::Create( 52 ViewEventTestPlatformPart* ViewEventTestPlatformPart::Create(
54 ui::ContextFactory* context_factory) { 53 ui::ContextFactory* context_factory) {
55 return new ViewEventTestPlatformPartAsh(context_factory); 54 return new ViewEventTestPlatformPartAsh(context_factory);
56 } 55 }
OLDNEW
« no previous file with comments | « ash/test/test_suite.cc ('k') | chrome/test/base/view_event_test_platform_part_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698