| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/test/test_shell_delegate.h" | 10 #include "ash/test/test_shell_delegate.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 AshTestBase::~AshTestBase() { | 24 AshTestBase::~AshTestBase() { |
| 25 } | 25 } |
| 26 | 26 |
| 27 void AshTestBase::SetUp() { | 27 void AshTestBase::SetUp() { |
| 28 // Creates Shell and hook with Desktop. | 28 // Creates Shell and hook with Desktop. |
| 29 TestShellDelegate* delegate = new TestShellDelegate; | 29 TestShellDelegate* delegate = new TestShellDelegate; |
| 30 ash::Shell::CreateInstance(delegate); | 30 ash::Shell::CreateInstance(delegate); |
| 31 | 31 |
| 32 helper_.SetUp(); | 32 helper_.SetUp(); |
| 33 helper_.InitRootWindow(Shell::GetRootWindow()); | 33 helper_.InitRootWindow(Shell::GetPrimaryRootWindow()); |
| 34 | 34 |
| 35 // Disable animations during tests. | 35 // Disable animations during tests. |
| 36 ui::LayerAnimator::set_disable_animations_for_test(true); | 36 ui::LayerAnimator::set_disable_animations_for_test(true); |
| 37 } | 37 } |
| 38 | 38 |
| 39 void AshTestBase::TearDown() { | 39 void AshTestBase::TearDown() { |
| 40 // Flush the message loop to finish pending release tasks. | 40 // Flush the message loop to finish pending release tasks. |
| 41 RunAllPendingInMessageLoop(); | 41 RunAllPendingInMessageLoop(); |
| 42 | 42 |
| 43 helper_.TearDown(); | 43 helper_.TearDown(); |
| 44 | 44 |
| 45 // Tear down the shell. | 45 // Tear down the shell. |
| 46 Shell::DeleteInstance(); | 46 Shell::DeleteInstance(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 void AshTestBase::ChangeMonitorConfig(float scale, | 49 void AshTestBase::ChangeMonitorConfig(float scale, |
| 50 const gfx::Rect& bounds_in_pixel) { | 50 const gfx::Rect& bounds_in_pixel) { |
| 51 gfx::Monitor monitor = gfx::Monitor(gfx::Screen::GetPrimaryMonitor().id()); | 51 gfx::Monitor monitor = gfx::Monitor(gfx::Screen::GetPrimaryMonitor().id()); |
| 52 monitor.SetScaleAndBounds(scale, bounds_in_pixel); | 52 monitor.SetScaleAndBounds(scale, bounds_in_pixel); |
| 53 std::vector<gfx::Monitor> monitors; | 53 std::vector<gfx::Monitor> monitors; |
| 54 monitors.push_back(monitor); | 54 monitors.push_back(monitor); |
| 55 aura::Env::GetInstance()->monitor_manager()->OnNativeMonitorsChanged( | 55 aura::Env::GetInstance()->monitor_manager()->OnNativeMonitorsChanged( |
| 56 monitors); | 56 monitors); |
| 57 } | 57 } |
| 58 | 58 |
| 59 void AshTestBase::RunAllPendingInMessageLoop() { | 59 void AshTestBase::RunAllPendingInMessageLoop() { |
| 60 helper_.RunAllPendingInMessageLoop(Shell::GetRootWindow()); | 60 helper_.RunAllPendingInMessageLoop(Shell::GetPrimaryRootWindow()); |
| 61 } | 61 } |
| 62 | 62 |
| 63 } // namespace test | 63 } // namespace test |
| 64 } // namespace ash | 64 } // namespace ash |
| OLD | NEW |