| 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/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "chrome/test/base/chrome_unit_test_suite.h" | 9 #include "chrome/test/base/chrome_unit_test_suite.h" |
| 10 #include "chrome/test/base/interactive_test_utils.h" | 10 #include "chrome/test/base/interactive_test_utils.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 // The ContextFactory must exist before any Compositors are created. | 81 // The ContextFactory must exist before any Compositors are created. |
| 82 bool enable_pixel_output = false; | 82 bool enable_pixel_output = false; |
| 83 ui::ContextFactory* context_factory = | 83 ui::ContextFactory* context_factory = |
| 84 ui::InitializeContextFactoryForTests(enable_pixel_output); | 84 ui::InitializeContextFactoryForTests(enable_pixel_output); |
| 85 views_delegate_.set_context_factory(context_factory); | 85 views_delegate_.set_context_factory(context_factory); |
| 86 views_delegate_.set_use_desktop_native_widgets(true); | 86 views_delegate_.set_use_desktop_native_widgets(true); |
| 87 | 87 |
| 88 platform_part_.reset(ViewEventTestPlatformPart::Create(context_factory)); | 88 platform_part_.reset(ViewEventTestPlatformPart::Create(context_factory)); |
| 89 gfx::NativeWindow context = platform_part_->GetContext(); | 89 gfx::NativeWindow context = platform_part_->GetContext(); |
| 90 window_ = views::Widget::CreateWindowWithContext(this, context); | 90 window_ = views::Widget::CreateWindowWithContext(this, context); |
| 91 window_->Show(); |
| 91 } | 92 } |
| 92 | 93 |
| 93 void ViewEventTestBase::TearDown() { | 94 void ViewEventTestBase::TearDown() { |
| 94 if (window_) { | 95 if (window_) { |
| 95 window_->Close(); | 96 window_->Close(); |
| 96 content::RunAllPendingInMessageLoop(); | 97 content::RunAllPendingInMessageLoop(); |
| 97 window_ = NULL; | 98 window_ = NULL; |
| 98 } | 99 } |
| 99 | 100 |
| 100 ui::Clipboard::DestroyClipboardForCurrentThread(); | 101 ui::Clipboard::DestroyClipboardForCurrentThread(); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 dnd_thread_.reset(NULL); | 169 dnd_thread_.reset(NULL); |
| 169 } | 170 } |
| 170 | 171 |
| 171 void ViewEventTestBase::RunTestMethod(const base::Closure& task) { | 172 void ViewEventTestBase::RunTestMethod(const base::Closure& task) { |
| 172 StopBackgroundThread(); | 173 StopBackgroundThread(); |
| 173 | 174 |
| 174 task.Run(); | 175 task.Run(); |
| 175 if (HasFatalFailure()) | 176 if (HasFatalFailure()) |
| 176 Done(); | 177 Done(); |
| 177 } | 178 } |
| OLD | NEW |