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 "chrome/test/base/view_event_test_base.h" | 5 #include "chrome/test/base/view_event_test_base.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 #endif | 76 #endif |
77 | 77 |
78 // If we're in a nested message loop, as is the case with menus, we | 78 // If we're in a nested message loop, as is the case with menus, we |
79 // need to quit twice. The second quit does that for us. Finish all | 79 // need to quit twice. The second quit does that for us. Finish all |
80 // pending UI events before posting closure because events it may be | 80 // pending UI events before posting closure because events it may be |
81 // executed before UI events are executed. | 81 // executed before UI events are executed. |
82 ui_controls::RunClosureAfterAllPendingUIEvents(MessageLoop::QuitClosure()); | 82 ui_controls::RunClosureAfterAllPendingUIEvents(MessageLoop::QuitClosure()); |
83 } | 83 } |
84 | 84 |
85 void ViewEventTestBase::SetUp() { | 85 void ViewEventTestBase::SetUp() { |
86 ui::TextInputTestSupport::Initilaize(); | 86 ui::TextInputTestSupport::Initialize(); |
87 ui::CompositorTestSupport::Initialize(); | 87 ui::CompositorTestSupport::Initialize(); |
88 #if defined(USE_ASH) | 88 #if defined(USE_ASH) |
89 ash::Shell::CreateInstance(NULL); | 89 ash::Shell::CreateInstance(NULL); |
90 // The shell runs with a locked screen in tests, so we must clear the event | 90 // The shell runs with a locked screen in tests, so we must clear the event |
91 // client so it doesn't interfere with event propagation. | 91 // client so it doesn't interfere with event propagation. |
92 aura::client::SetEventClient(ash::Shell::GetPrimaryRootWindow(), | 92 aura::client::SetEventClient(ash::Shell::GetPrimaryRootWindow(), |
93 NULL); | 93 NULL); |
94 #endif | 94 #endif |
95 window_ = views::Widget::CreateWindow(this); | 95 window_ = views::Widget::CreateWindow(this); |
96 } | 96 } |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 dnd_thread_.reset(NULL); | 181 dnd_thread_.reset(NULL); |
182 } | 182 } |
183 | 183 |
184 void ViewEventTestBase::RunTestMethod(const base::Closure& task) { | 184 void ViewEventTestBase::RunTestMethod(const base::Closure& task) { |
185 StopBackgroundThread(); | 185 StopBackgroundThread(); |
186 | 186 |
187 task.Run(); | 187 task.Run(); |
188 if (HasFatalFailure()) | 188 if (HasFatalFailure()) |
189 Done(); | 189 Done(); |
190 } | 190 } |
OLD | NEW |