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

Side by Side Diff: ui/aura/test/aura_test_base.cc

Issue 2471033005: Adds DesktopWindowTreeHostMus (Closed)
Patch Set: fix Created 4 years, 1 month 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
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_base.h" 5 #include "ui/aura/test/aura_test_base.h"
6 6
7 #include "ui/aura/client/window_parenting_client.h" 7 #include "ui/aura/client/window_parenting_client.h"
8 #include "ui/aura/mus/property_converter.h" 8 #include "ui/aura/mus/property_converter.h"
9 #include "ui/aura/mus/window_tree_client.h" 9 #include "ui/aura/mus/window_tree_client.h"
10 #include "ui/aura/mus/window_tree_host_mus.h" 10 #include "ui/aura/mus/window_tree_host_mus.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 gesture_config->set_two_finger_tap_enabled(true); 103 gesture_config->set_two_finger_tap_enabled(true);
104 gesture_config->set_velocity_tracker_strategy( 104 gesture_config->set_velocity_tracker_strategy(
105 ui::VelocityTracker::Strategy::LSQ2_RESTRICTED); 105 ui::VelocityTracker::Strategy::LSQ2_RESTRICTED);
106 106
107 // The ContextFactory must exist before any Compositors are created. 107 // The ContextFactory must exist before any Compositors are created.
108 bool enable_pixel_output = false; 108 bool enable_pixel_output = false;
109 ui::ContextFactory* context_factory = 109 ui::ContextFactory* context_factory =
110 ui::InitializeContextFactoryForTests(enable_pixel_output); 110 ui::InitializeContextFactoryForTests(enable_pixel_output);
111 111
112 helper_.reset(new AuraTestHelper(&message_loop_)); 112 helper_.reset(new AuraTestHelper(&message_loop_));
113 if (use_mus_) 113 if (use_mus_) {
114 helper_->EnableMus(window_tree_client_delegate_, window_manager_delegate_); 114 helper_->EnableMusWithTestWindowTree(window_tree_client_delegate_,
115 window_manager_delegate_);
116 }
115 helper_->SetUp(context_factory); 117 helper_->SetUp(context_factory);
116 } 118 }
117 119
118 void AuraTestBase::TearDown() { 120 void AuraTestBase::TearDown() {
119 teardown_called_ = true; 121 teardown_called_ = true;
120 122
121 // Flush the message loop because we have pending release tasks 123 // Flush the message loop because we have pending release tasks
122 // and these tasks if un-executed would upset Valgrind. 124 // and these tasks if un-executed would upset Valgrind.
123 RunAllPendingInMessageLoop(); 125 RunAllPendingInMessageLoop();
124 126
125 helper_->TearDown(); 127 helper_->TearDown();
126 ui::TerminateContextFactoryForTests(); 128 ui::TerminateContextFactoryForTests();
127 ui::ShutdownInputMethodForTesting(); 129 ui::ShutdownInputMethodForTesting();
128 testing::Test::TearDown(); 130 testing::Test::TearDown();
129 } 131 }
130 132
131 Window* AuraTestBase::CreateNormalWindow(int id, Window* parent, 133 Window* AuraTestBase::CreateNormalWindow(int id, Window* parent,
132 WindowDelegate* delegate) { 134 WindowDelegate* delegate) {
133 Window* window = new Window( 135 Window* window = new Window(
134 delegate ? delegate : 136 delegate ? delegate :
135 test::TestWindowDelegate::CreateSelfDestroyingDelegate()); 137 test::TestWindowDelegate::CreateSelfDestroyingDelegate());
136 window->set_id(id); 138 window->set_id(id);
137 window->Init(ui::LAYER_TEXTURED); 139 window->Init(ui::LAYER_TEXTURED);
138 parent->AddChild(window); 140 parent->AddChild(window);
139 window->SetBounds(gfx::Rect(0, 0, 100, 100)); 141 window->SetBounds(gfx::Rect(0, 0, 100, 100));
140 window->Show(); 142 window->Show();
141 return window; 143 return window;
142 } 144 }
143 145
144 void AuraTestBase::EnableMus() { 146 void AuraTestBase::EnableMusWithTestWindowTree() {
145 DCHECK(!setup_called_); 147 DCHECK(!setup_called_);
146 use_mus_ = true; 148 use_mus_ = true;
147 } 149 }
148 150
149 void AuraTestBase::ConfigureBackend(BackendType type) { 151 void AuraTestBase::ConfigureBackend(BackendType type) {
150 if (type == BackendType::MUS) 152 if (type == BackendType::MUS)
151 EnableMus(); 153 EnableMusWithTestWindowTree();
152 } 154 }
153 155
154 void AuraTestBase::RunAllPendingInMessageLoop() { 156 void AuraTestBase::RunAllPendingInMessageLoop() {
155 helper_->RunAllPendingInMessageLoop(); 157 helper_->RunAllPendingInMessageLoop();
156 } 158 }
157 159
158 void AuraTestBase::ParentWindow(Window* window) { 160 void AuraTestBase::ParentWindow(Window* window) {
159 client::ParentWindowWithContext(window, root_window(), gfx::Rect()); 161 client::ParentWindowWithContext(window, root_window(), gfx::Rect());
160 } 162 }
161 163
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 252
251 void AuraTestBaseWithType::SetUp() { 253 void AuraTestBaseWithType::SetUp() {
252 DCHECK(!setup_called_); 254 DCHECK(!setup_called_);
253 setup_called_ = true; 255 setup_called_ = true;
254 ConfigureBackend(GetParam()); 256 ConfigureBackend(GetParam());
255 AuraTestBase::SetUp(); 257 AuraTestBase::SetUp();
256 } 258 }
257 259
258 } // namespace test 260 } // namespace test
259 } // namespace aura 261 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698