| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 // executed before UI events are executed. | 80 // executed before UI events are executed. |
| 81 ui_controls::RunClosureAfterAllPendingUIEvents(MessageLoop::QuitClosure()); | 81 ui_controls::RunClosureAfterAllPendingUIEvents(MessageLoop::QuitClosure()); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void ViewEventTestBase::SetUp() { | 84 void ViewEventTestBase::SetUp() { |
| 85 ui::CompositorTestSupport::Initialize(); | 85 ui::CompositorTestSupport::Initialize(); |
| 86 #if defined(USE_ASH) | 86 #if defined(USE_ASH) |
| 87 ash::Shell::CreateInstance(NULL); | 87 ash::Shell::CreateInstance(NULL); |
| 88 // The shell runs with a locked screen in tests, so we must clear the event | 88 // The shell runs with a locked screen in tests, so we must clear the event |
| 89 // client so it doesn't interfere with event propagation. | 89 // client so it doesn't interfere with event propagation. |
| 90 aura::client::SetEventClient(ash::Shell::GetInstance()->GetRootWindow(), | 90 aura::client::SetEventClient(ash::Shell::GetPrimaryRootWindow(), |
| 91 NULL); | 91 NULL); |
| 92 #endif | 92 #endif |
| 93 window_ = views::Widget::CreateWindow(this); | 93 window_ = views::Widget::CreateWindow(this); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void ViewEventTestBase::TearDown() { | 96 void ViewEventTestBase::TearDown() { |
| 97 if (window_) { | 97 if (window_) { |
| 98 #if defined(OS_WIN) && !defined(USE_AURA) | 98 #if defined(OS_WIN) && !defined(USE_AURA) |
| 99 DestroyWindow(window_->GetNativeWindow()); | 99 DestroyWindow(window_->GetNativeWindow()); |
| 100 #else | 100 #else |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 dnd_thread_.reset(NULL); | 178 dnd_thread_.reset(NULL); |
| 179 } | 179 } |
| 180 | 180 |
| 181 void ViewEventTestBase::RunTestMethod(const base::Closure& task) { | 181 void ViewEventTestBase::RunTestMethod(const base::Closure& task) { |
| 182 StopBackgroundThread(); | 182 StopBackgroundThread(); |
| 183 | 183 |
| 184 task.Run(); | 184 task.Run(); |
| 185 if (HasFatalFailure()) | 185 if (HasFatalFailure()) |
| 186 Done(); | 186 Done(); |
| 187 } | 187 } |
| OLD | NEW |