| 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 "ui/aura/test/aura_test_base.h" | 5 #include "ui/aura/test/aura_test_base.h" |
| 6 | 6 |
| 7 #include "ui/aura/env.h" | 7 #include "ui/aura/env.h" |
| 8 #include "ui/aura/gestures/gesture_configuration.h" |
| 8 #include "ui/aura/monitor_manager.h" | 9 #include "ui/aura/monitor_manager.h" |
| 9 #include "ui/aura/single_monitor_manager.h" | 10 #include "ui/aura/single_monitor_manager.h" |
| 10 #include "ui/aura/root_window.h" | 11 #include "ui/aura/root_window.h" |
| 11 #include "ui/aura/test/test_screen.h" | 12 #include "ui/aura/test/test_screen.h" |
| 12 #include "ui/aura/test/test_stacking_client.h" | 13 #include "ui/aura/test/test_stacking_client.h" |
| 13 #include "ui/aura/ui_controls_aura.h" | 14 #include "ui/aura/ui_controls_aura.h" |
| 14 #include "ui/ui_controls/ui_controls.h" | 15 #include "ui/ui_controls/ui_controls.h" |
| 15 | 16 |
| 16 namespace aura { | 17 namespace aura { |
| 17 namespace test { | 18 namespace test { |
| 18 | 19 |
| 19 AuraTestBase::AuraTestBase() { | 20 AuraTestBase::AuraTestBase() { |
| 20 } | 21 } |
| 21 | 22 |
| 22 AuraTestBase::~AuraTestBase() { | 23 AuraTestBase::~AuraTestBase() { |
| 23 } | 24 } |
| 24 | 25 |
| 25 void AuraTestBase::SetUp() { | 26 void AuraTestBase::SetUp() { |
| 26 testing::Test::SetUp(); | 27 testing::Test::SetUp(); |
| 28 |
| 29 // Changing the parameters for gesture recognition shouldn't cause |
| 30 // tests to fail, so we use a separate set of parameters for unit |
| 31 // testing. |
| 32 GestureConfiguration::set_long_press_time_in_seconds(0.5); |
| 33 GestureConfiguration::set_max_seconds_between_double_click(0.7); |
| 34 GestureConfiguration::set_max_separation_for_gesture_touches_in_pixels(150); |
| 35 GestureConfiguration::set_max_touch_down_duration_in_seconds_for_click(0.8); |
| 36 GestureConfiguration::set_max_touch_move_in_pixels_for_click(20); |
| 37 GestureConfiguration::set_min_distance_for_pinch_scroll_in_pixels(20); |
| 38 GestureConfiguration::set_min_flick_speed_squared(550.f * 550.f); |
| 39 GestureConfiguration::set_min_pinch_update_distance_in_pixels(5); |
| 40 GestureConfiguration::set_min_rail_break_velocity(200); |
| 41 GestureConfiguration::set_min_scroll_delta_squared(5 * 5); |
| 42 GestureConfiguration::set_min_touch_down_duration_in_seconds_for_click(0.01); |
| 43 GestureConfiguration::set_points_buffered_for_velocity(10); |
| 44 GestureConfiguration::set_rail_break_proportion(15); |
| 45 GestureConfiguration::set_rail_start_proportion(2); |
| 46 |
| 27 root_window_.reset(Env::GetInstance()->monitor_manager()-> | 47 root_window_.reset(Env::GetInstance()->monitor_manager()-> |
| 28 CreateRootWindowForPrimaryMonitor()); | 48 CreateRootWindowForPrimaryMonitor()); |
| 29 gfx::Screen::SetInstance(new aura::TestScreen(root_window_.get())); | 49 gfx::Screen::SetInstance(new aura::TestScreen(root_window_.get())); |
| 30 ui_controls::InstallUIControlsAura(CreateUIControlsAura(root_window_.get())); | 50 ui_controls::InstallUIControlsAura(CreateUIControlsAura(root_window_.get())); |
| 31 helper_.InitRootWindow(root_window()); | 51 helper_.InitRootWindow(root_window()); |
| 32 helper_.SetUp(); | 52 helper_.SetUp(); |
| 33 stacking_client_.reset(new TestStackingClient(root_window())); | 53 stacking_client_.reset(new TestStackingClient(root_window())); |
| 34 } | 54 } |
| 35 | 55 |
| 36 void AuraTestBase::TearDown() { | 56 void AuraTestBase::TearDown() { |
| 37 // Flush the message loop because we have pending release tasks | 57 // Flush the message loop because we have pending release tasks |
| 38 // and these tasks if un-executed would upset Valgrind. | 58 // and these tasks if un-executed would upset Valgrind. |
| 39 RunAllPendingInMessageLoop(); | 59 RunAllPendingInMessageLoop(); |
| 40 | 60 |
| 41 stacking_client_.reset(); | 61 stacking_client_.reset(); |
| 42 helper_.TearDown(); | 62 helper_.TearDown(); |
| 43 root_window_.reset(); | 63 root_window_.reset(); |
| 44 testing::Test::TearDown(); | 64 testing::Test::TearDown(); |
| 45 } | 65 } |
| 46 | 66 |
| 47 void AuraTestBase::RunAllPendingInMessageLoop() { | 67 void AuraTestBase::RunAllPendingInMessageLoop() { |
| 48 helper_.RunAllPendingInMessageLoop(root_window()); | 68 helper_.RunAllPendingInMessageLoop(root_window()); |
| 49 } | 69 } |
| 50 | 70 |
| 51 } // namespace test | 71 } // namespace test |
| 52 } // namespace aura | 72 } // namespace aura |
| OLD | NEW |