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

Side by Side Diff: ash/test/ash_test_base.cc

Issue 2144003003: Add CreateTestWidget() to AshTestBase, collapse duplicates (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@movetray
Patch Set: rebase Created 4 years, 5 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/ash_test_base.h ('k') | no next file » | 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 "ash/test/ash_test_base.h" 5 #include "ash/test/ash_test_base.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/common/ash_switches.h" 10 #include "ash/common/ash_switches.h"
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 } 216 }
217 217
218 void AshTestBase::UpdateDisplay(const std::string& display_specs) { 218 void AshTestBase::UpdateDisplay(const std::string& display_specs) {
219 DisplayManagerTestApi().UpdateDisplay(display_specs); 219 DisplayManagerTestApi().UpdateDisplay(display_specs);
220 } 220 }
221 221
222 aura::Window* AshTestBase::CurrentContext() { 222 aura::Window* AshTestBase::CurrentContext() {
223 return ash_test_helper_->CurrentContext(); 223 return ash_test_helper_->CurrentContext();
224 } 224 }
225 225
226 // static
227 std::unique_ptr<views::Widget> AshTestBase::CreateTestWidget(
228 views::WidgetDelegate* delegate,
229 int container_id,
230 const gfx::Rect& bounds) {
231 std::unique_ptr<views::Widget> widget(new views::Widget);
232 views::Widget::InitParams params;
233 params.delegate = delegate;
234 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
235 params.bounds = bounds;
236 WmShell::Get()
237 ->GetPrimaryRootWindow()
238 ->GetRootWindowController()
239 ->ConfigureWidgetInitParamsForContainer(widget.get(), container_id,
240 &params);
241 widget->Init(params);
242 widget->Show();
243 return widget;
244 }
245
226 aura::Window* AshTestBase::CreateTestWindowInShellWithId(int id) { 246 aura::Window* AshTestBase::CreateTestWindowInShellWithId(int id) {
227 return CreateTestWindowInShellWithDelegate(NULL, id, gfx::Rect()); 247 return CreateTestWindowInShellWithDelegate(NULL, id, gfx::Rect());
228 } 248 }
229 249
230 aura::Window* AshTestBase::CreateTestWindowInShellWithBounds( 250 aura::Window* AshTestBase::CreateTestWindowInShellWithBounds(
231 const gfx::Rect& bounds) { 251 const gfx::Rect& bounds) {
232 return CreateTestWindowInShellWithDelegate(NULL, 0, bounds); 252 return CreateTestWindowInShellWithDelegate(NULL, 0, bounds);
233 } 253 }
234 254
235 aura::Window* AshTestBase::CreateTestWindowInShell(SkColor color, 255 aura::Window* AshTestBase::CreateTestWindowInShell(SkColor color,
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 374
355 void AshTestBase::DisableIME() { 375 void AshTestBase::DisableIME() {
356 Shell::GetInstance()->RemovePreTargetHandler( 376 Shell::GetInstance()->RemovePreTargetHandler(
357 Shell::GetInstance() 377 Shell::GetInstance()
358 ->window_tree_host_manager() 378 ->window_tree_host_manager()
359 ->input_method_event_handler()); 379 ->input_method_event_handler());
360 } 380 }
361 381
362 } // namespace test 382 } // namespace test
363 } // namespace ash 383 } // namespace ash
OLDNEW
« no previous file with comments | « ash/test/ash_test_base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698