| 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/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 // If we're in a nested message loop, as is the case with menus, we | 89 // If we're in a nested message loop, as is the case with menus, we |
| 90 // need to quit twice. The second quit does that for us. Finish all | 90 // need to quit twice. The second quit does that for us. Finish all |
| 91 // pending UI events before posting closure because events it may be | 91 // pending UI events before posting closure because events it may be |
| 92 // executed before UI events are executed. | 92 // executed before UI events are executed. |
| 93 ui_controls::RunClosureAfterAllPendingUIEvents( | 93 ui_controls::RunClosureAfterAllPendingUIEvents( |
| 94 base::MessageLoop::QuitClosure()); | 94 base::MessageLoop::QuitClosure()); |
| 95 } | 95 } |
| 96 | 96 |
| 97 void ViewEventTestBase::SetUp() { | 97 void ViewEventTestBase::SetUp() { |
| 98 #if defined(USE_AURA) | 98 #if defined(USE_AURA) |
| 99 wm_state_.reset(new views::corewm::WMState); | 99 wm_state_.reset(new wm::WMState); |
| 100 #endif | 100 #endif |
| 101 | 101 |
| 102 views::ViewsDelegate::views_delegate = &views_delegate_; | 102 views::ViewsDelegate::views_delegate = &views_delegate_; |
| 103 ui::InitializeInputMethodForTesting(); | 103 ui::InitializeInputMethodForTesting(); |
| 104 gfx::NativeView context = NULL; | 104 gfx::NativeView context = NULL; |
| 105 | 105 |
| 106 #if defined(USE_AURA) | 106 #if defined(USE_AURA) |
| 107 // The ContextFactory must exist before any Compositors are created. | 107 // The ContextFactory must exist before any Compositors are created. |
| 108 bool enable_pixel_output = false; | 108 bool enable_pixel_output = false; |
| 109 ui::InitializeContextFactoryForTests(enable_pixel_output); | 109 ui::InitializeContextFactoryForTests(enable_pixel_output); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 dnd_thread_.reset(NULL); | 244 dnd_thread_.reset(NULL); |
| 245 } | 245 } |
| 246 | 246 |
| 247 void ViewEventTestBase::RunTestMethod(const base::Closure& task) { | 247 void ViewEventTestBase::RunTestMethod(const base::Closure& task) { |
| 248 StopBackgroundThread(); | 248 StopBackgroundThread(); |
| 249 | 249 |
| 250 task.Run(); | 250 task.Run(); |
| 251 if (HasFatalFailure()) | 251 if (HasFatalFailure()) |
| 252 Done(); | 252 Done(); |
| 253 } | 253 } |
| OLD | NEW |