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

Side by Side Diff: trunk/src/ui/aura/test/aura_test_helper.cc

Issue 213033002: Revert 259580 "Move wm/public into wm target" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 8 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 | « trunk/src/ui/aura/test/aura_test_helper.h ('k') | trunk/src/ui/keyboard/keyboard.gyp » ('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/aura/test/aura_test_helper.h" 5 #include "ui/aura/test/aura_test_helper.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "ui/aura/client/aura_constants.h" 9 #include "ui/aura/client/aura_constants.h"
10 #include "ui/aura/client/default_activation_client.h"
10 #include "ui/aura/client/default_capture_client.h" 11 #include "ui/aura/client/default_capture_client.h"
11 #include "ui/aura/client/focus_client.h" 12 #include "ui/aura/client/focus_client.h"
12 #include "ui/aura/env.h" 13 #include "ui/aura/env.h"
13 #include "ui/aura/input_state_lookup.h" 14 #include "ui/aura/input_state_lookup.h"
14 #include "ui/aura/test/env_test_helper.h" 15 #include "ui/aura/test/env_test_helper.h"
15 #include "ui/aura/test/test_focus_client.h" 16 #include "ui/aura/test/test_focus_client.h"
16 #include "ui/aura/test/test_screen.h" 17 #include "ui/aura/test/test_screen.h"
17 #include "ui/aura/test/test_window_tree_client.h" 18 #include "ui/aura/test/test_window_tree_client.h"
18 #include "ui/aura/window_event_dispatcher.h" 19 #include "ui/aura/window_event_dispatcher.h"
19 #include "ui/base/ime/dummy_input_method.h" 20 #include "ui/base/ime/dummy_input_method.h"
20 #include "ui/base/ime/input_method_initializer.h" 21 #include "ui/base/ime/input_method_initializer.h"
21 #include "ui/compositor/compositor.h" 22 #include "ui/compositor/compositor.h"
22 #include "ui/compositor/layer_animator.h" 23 #include "ui/compositor/layer_animator.h"
23 #include "ui/compositor/scoped_animation_duration_scale_mode.h" 24 #include "ui/compositor/scoped_animation_duration_scale_mode.h"
24 #include "ui/gfx/screen.h" 25 #include "ui/gfx/screen.h"
25 26
26 #if defined(USE_X11) 27 #if defined(USE_X11)
27 #include "ui/aura/window_tree_host_x11.h" 28 #include "ui/aura/window_tree_host_x11.h"
28 #include "ui/base/x/x11_util.h" 29 #include "ui/base/x/x11_util.h"
29 #endif 30 #endif
30 31
31 namespace aura { 32 namespace aura {
32 namespace test { 33 namespace test {
33 34
34 AuraTestHelper::AuraTestHelper(base::MessageLoopForUI* message_loop) 35 AuraTestHelper::AuraTestHelper(base::MessageLoopForUI* message_loop)
35 : default_window_size_(800, 600), 36 : setup_called_(false),
36 setup_called_(false),
37 teardown_called_(false), 37 teardown_called_(false),
38 owns_host_(false) { 38 owns_host_(false) {
39 DCHECK(message_loop); 39 DCHECK(message_loop);
40 message_loop_ = message_loop; 40 message_loop_ = message_loop;
41 // Disable animations during tests. 41 // Disable animations during tests.
42 zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode( 42 zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode(
43 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION)); 43 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION));
44 #if defined(USE_X11) 44 #if defined(USE_X11)
45 test::SetUseOverrideRedirectWindowByDefault(true); 45 test::SetUseOverrideRedirectWindowByDefault(true);
46 #endif 46 #endif
(...skipping 17 matching lines...) Expand all
64 64
65 ui::InitializeInputMethodForTesting(); 65 ui::InitializeInputMethodForTesting();
66 66
67 test_screen_.reset(TestScreen::Create()); 67 test_screen_.reset(TestScreen::Create());
68 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_.get()); 68 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_.get());
69 host_.reset(test_screen_->CreateHostForPrimaryDisplay()); 69 host_.reset(test_screen_->CreateHostForPrimaryDisplay());
70 70
71 focus_client_.reset(new TestFocusClient); 71 focus_client_.reset(new TestFocusClient);
72 client::SetFocusClient(root_window(), focus_client_.get()); 72 client::SetFocusClient(root_window(), focus_client_.get());
73 stacking_client_.reset(new TestWindowTreeClient(root_window())); 73 stacking_client_.reset(new TestWindowTreeClient(root_window()));
74 activation_client_.reset(
75 new client::DefaultActivationClient(root_window()));
74 capture_client_.reset(new client::DefaultCaptureClient(root_window())); 76 capture_client_.reset(new client::DefaultCaptureClient(root_window()));
75 test_input_method_.reset(new ui::DummyInputMethod); 77 test_input_method_.reset(new ui::DummyInputMethod);
76 root_window()->SetProperty( 78 root_window()->SetProperty(
77 client::kRootWindowInputMethodKey, 79 client::kRootWindowInputMethodKey,
78 test_input_method_.get()); 80 test_input_method_.get());
79 81
80 root_window()->Show(); 82 root_window()->Show();
81 // Ensure width != height so tests won't confuse them. 83 // Ensure width != height so tests won't confuse them.
82 host()->SetBounds(gfx::Rect(default_window_size_)); 84 host()->SetBounds(gfx::Rect(800, 600));
83 } 85 }
84 86
85 void AuraTestHelper::TearDown() { 87 void AuraTestHelper::TearDown() {
86 teardown_called_ = true; 88 teardown_called_ = true;
87 test_input_method_.reset(); 89 test_input_method_.reset();
88 stacking_client_.reset(); 90 stacking_client_.reset();
91 activation_client_.reset();
89 capture_client_.reset(); 92 capture_client_.reset();
90 focus_client_.reset(); 93 focus_client_.reset();
91 client::SetFocusClient(root_window(), NULL); 94 client::SetFocusClient(root_window(), NULL);
92 host_.reset(); 95 host_.reset();
93 ui::GestureRecognizer::Reset(); 96 ui::GestureRecognizer::Reset();
94 test_screen_.reset(); 97 test_screen_.reset();
95 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, NULL); 98 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, NULL);
96 99
97 #if defined(USE_X11) 100 #if defined(USE_X11)
98 ui::ResetXCursorCache(); 101 ui::ResetXCursorCache();
99 #endif 102 #endif
100 103
101 ui::ShutdownInputMethodForTesting(); 104 ui::ShutdownInputMethodForTesting();
102 105
103 Env::DeleteInstance(); 106 Env::DeleteInstance();
104 } 107 }
105 108
106 void AuraTestHelper::RunAllPendingInMessageLoop() { 109 void AuraTestHelper::RunAllPendingInMessageLoop() {
107 // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them 110 // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them
108 // use run_loop.QuitClosure(). 111 // use run_loop.QuitClosure().
109 base::RunLoop run_loop; 112 base::RunLoop run_loop;
110 run_loop.RunUntilIdle(); 113 run_loop.RunUntilIdle();
111 } 114 }
112 115
113 } // namespace test 116 } // namespace test
114 } // namespace aura 117 } // namespace aura
OLDNEW
« no previous file with comments | « trunk/src/ui/aura/test/aura_test_helper.h ('k') | trunk/src/ui/keyboard/keyboard.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698