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

Side by Side Diff: ui/views/test/views_test_base.cc

Issue 261553002: Revert of Move DefaultActivationClient to wm/core (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « ui/snapshot/snapshot_aura_unittest.cc ('k') | ui/wm/core/compound_event_filter_unittest.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/views/test/views_test_base.h" 5 #include "ui/views/test/views_test_base.h"
6 6
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "ui/base/clipboard/clipboard.h" 8 #include "ui/base/clipboard/clipboard.h"
9 #include "ui/base/ime/input_method_initializer.h" 9 #include "ui/base/ime/input_method_initializer.h"
10 #include "ui/aura/env.h" 10 #include "ui/aura/env.h"
11 #include "ui/aura/test/aura_test_helper.h" 11 #include "ui/aura/test/aura_test_helper.h"
12 #include "ui/aura/window_event_dispatcher.h" 12 #include "ui/aura/window_event_dispatcher.h"
13 #include "ui/compositor/test/context_factories_for_test.h" 13 #include "ui/compositor/test/context_factories_for_test.h"
14 #include "ui/wm/core/capture_controller.h" 14 #include "ui/wm/core/capture_controller.h"
15 #include "ui/wm/core/default_activation_client.h"
16 #include "ui/wm/core/wm_state.h" 15 #include "ui/wm/core/wm_state.h"
17 16
18 namespace views { 17 namespace views {
19 18
20 ViewsTestBase::ViewsTestBase() 19 ViewsTestBase::ViewsTestBase()
21 : setup_called_(false), 20 : setup_called_(false),
22 teardown_called_(false) { 21 teardown_called_(false) {
23 } 22 }
24 23
25 ViewsTestBase::~ViewsTestBase() { 24 ViewsTestBase::~ViewsTestBase() {
26 CHECK(setup_called_) 25 CHECK(setup_called_)
27 << "You have overridden SetUp but never called super class's SetUp"; 26 << "You have overridden SetUp but never called super class's SetUp";
28 CHECK(teardown_called_) 27 CHECK(teardown_called_)
29 << "You have overridden TearDown but never called super class's TearDown"; 28 << "You have overridden TearDown but never called super class's TearDown";
30 } 29 }
31 30
32 void ViewsTestBase::SetUp() { 31 void ViewsTestBase::SetUp() {
33 testing::Test::SetUp(); 32 testing::Test::SetUp();
34 setup_called_ = true; 33 setup_called_ = true;
35 if (!views_delegate_.get()) 34 if (!views_delegate_.get())
36 views_delegate_.reset(new TestViewsDelegate()); 35 views_delegate_.reset(new TestViewsDelegate());
37 // The ContextFactory must exist before any Compositors are created. 36 // The ContextFactory must exist before any Compositors are created.
38 bool enable_pixel_output = false; 37 bool enable_pixel_output = false;
39 ui::InitializeContextFactoryForTests(enable_pixel_output); 38 ui::InitializeContextFactoryForTests(enable_pixel_output);
40 39
41 aura_test_helper_.reset(new aura::test::AuraTestHelper(&message_loop_)); 40 aura_test_helper_.reset(new aura::test::AuraTestHelper(&message_loop_));
42 aura_test_helper_->SetUp(); 41 aura_test_helper_->SetUp();
43 new wm::DefaultActivationClient(aura_test_helper_->root_window());
44 wm_state_.reset(new ::wm::WMState); 42 wm_state_.reset(new ::wm::WMState);
45 ui::InitializeInputMethodForTesting(); 43 ui::InitializeInputMethodForTesting();
46 } 44 }
47 45
48 void ViewsTestBase::TearDown() { 46 void ViewsTestBase::TearDown() {
49 ui::Clipboard::DestroyClipboardForCurrentThread(); 47 ui::Clipboard::DestroyClipboardForCurrentThread();
50 48
51 // Flush the message loop because we have pending release tasks 49 // Flush the message loop because we have pending release tasks
52 // and these tasks if un-executed would upset Valgrind. 50 // and these tasks if un-executed would upset Valgrind.
53 RunPendingMessages(); 51 RunPendingMessages();
(...skipping 25 matching lines...) Expand all
79 77
80 aura::WindowTreeHost* ViewsTestBase::host() { 78 aura::WindowTreeHost* ViewsTestBase::host() {
81 return aura_test_helper_->host(); 79 return aura_test_helper_->host();
82 } 80 }
83 81
84 gfx::NativeView ViewsTestBase::GetContext() { 82 gfx::NativeView ViewsTestBase::GetContext() {
85 return aura_test_helper_->root_window(); 83 return aura_test_helper_->root_window();
86 } 84 }
87 85
88 } // namespace views 86 } // namespace views
OLDNEW
« no previous file with comments | « ui/snapshot/snapshot_aura_unittest.cc ('k') | ui/wm/core/compound_event_filter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698