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/client/window_tree_client.h" | 7 #include "ui/aura/client/window_tree_client.h" |
8 #include "ui/aura/test/aura_test_helper.h" | 8 #include "ui/aura/test/aura_test_helper.h" |
9 #include "ui/aura/test/test_window_delegate.h" | 9 #include "ui/aura/test/test_window_delegate.h" |
10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
11 #include "ui/base/ime/input_method_initializer.h" | 11 #include "ui/base/ime/input_method_initializer.h" |
12 #include "ui/compositor/test/context_factories_for_test.h" | 12 #include "ui/compositor/test/context_factories_for_test.h" |
13 #include "ui/events/event_dispatcher.h" | 13 #include "ui/events/event_dispatcher.h" |
14 #include "ui/events/event_processor.h" | 14 #include "ui/events/event_processor.h" |
15 #include "ui/events/gestures/gesture_configuration.h" | 15 #include "ui/events/gestures/gesture_configuration.h" |
16 | 16 |
17 namespace aura { | 17 namespace aura { |
18 namespace test { | 18 namespace test { |
19 | 19 |
20 AuraTestBase::AuraTestBase() | 20 AuraTestBase::AuraTestBase() |
21 : setup_called_(false), | 21 : setup_called_(false), |
22 teardown_called_(false) { | 22 teardown_called_(false), |
| 23 context_factory_(NULL) { |
23 } | 24 } |
24 | 25 |
25 AuraTestBase::~AuraTestBase() { | 26 AuraTestBase::~AuraTestBase() { |
26 CHECK(setup_called_) | 27 CHECK(setup_called_) |
27 << "You have overridden SetUp but never called super class's SetUp"; | 28 << "You have overridden SetUp but never called super class's SetUp"; |
28 CHECK(teardown_called_) | 29 CHECK(teardown_called_) |
29 << "You have overridden TearDown but never called super class's TearDown"; | 30 << "You have overridden TearDown but never called super class's TearDown"; |
30 } | 31 } |
31 | 32 |
32 void AuraTestBase::SetUp() { | 33 void AuraTestBase::SetUp() { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 1, -0.0238095f); | 67 1, -0.0238095f); |
67 ui::GestureConfiguration::set_fling_acceleration_curve_coefficients( | 68 ui::GestureConfiguration::set_fling_acceleration_curve_coefficients( |
68 2, 0.0452381f); | 69 2, 0.0452381f); |
69 ui::GestureConfiguration::set_fling_acceleration_curve_coefficients( | 70 ui::GestureConfiguration::set_fling_acceleration_curve_coefficients( |
70 3, 0.8f); | 71 3, 0.8f); |
71 ui::GestureConfiguration::set_fling_velocity_cap(15000.0f); | 72 ui::GestureConfiguration::set_fling_velocity_cap(15000.0f); |
72 ui::GestureConfiguration::set_min_swipe_speed(10); | 73 ui::GestureConfiguration::set_min_swipe_speed(10); |
73 | 74 |
74 // The ContextFactory must exist before any Compositors are created. | 75 // The ContextFactory must exist before any Compositors are created. |
75 bool enable_pixel_output = false; | 76 bool enable_pixel_output = false; |
76 ui::InitializeContextFactoryForTests(enable_pixel_output); | 77 context_factory_ = ui::InitializeContextFactoryForTests(enable_pixel_output); |
77 | 78 |
78 helper_.reset(new AuraTestHelper(&message_loop_)); | 79 helper_.reset(new AuraTestHelper(&message_loop_)); |
79 helper_->SetUp(); | 80 helper_->SetUp(context_factory_); |
80 } | 81 } |
81 | 82 |
82 void AuraTestBase::TearDown() { | 83 void AuraTestBase::TearDown() { |
83 teardown_called_ = true; | 84 teardown_called_ = true; |
84 | 85 |
85 // Flush the message loop because we have pending release tasks | 86 // Flush the message loop because we have pending release tasks |
86 // and these tasks if un-executed would upset Valgrind. | 87 // and these tasks if un-executed would upset Valgrind. |
87 RunAllPendingInMessageLoop(); | 88 RunAllPendingInMessageLoop(); |
88 | 89 |
89 helper_->TearDown(); | 90 helper_->TearDown(); |
(...skipping 25 matching lines...) Expand all Loading... |
115 | 116 |
116 bool AuraTestBase::DispatchEventUsingWindowDispatcher(ui::Event* event) { | 117 bool AuraTestBase::DispatchEventUsingWindowDispatcher(ui::Event* event) { |
117 ui::EventDispatchDetails details = | 118 ui::EventDispatchDetails details = |
118 event_processor()->OnEventFromSource(event); | 119 event_processor()->OnEventFromSource(event); |
119 CHECK(!details.dispatcher_destroyed); | 120 CHECK(!details.dispatcher_destroyed); |
120 return event->handled(); | 121 return event->handled(); |
121 } | 122 } |
122 | 123 |
123 } // namespace test | 124 } // namespace test |
124 } // namespace aura | 125 } // namespace aura |
OLD | NEW |