OLD | NEW |
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 Loading... |
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 ¶ms); |
| 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 Loading... |
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 |
OLD | NEW |