| 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/location.h" | 8 #include "base/location.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 void ViewEventTestBase::SetUpTestCase() { | 67 void ViewEventTestBase::SetUpTestCase() { |
| 68 ChromeUnitTestSuite::InitializeProviders(); | 68 ChromeUnitTestSuite::InitializeProviders(); |
| 69 ChromeUnitTestSuite::InitializeResourceBundle(); | 69 ChromeUnitTestSuite::InitializeResourceBundle(); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void ViewEventTestBase::SetUp() { | 72 void ViewEventTestBase::SetUp() { |
| 73 ui::InitializeInputMethodForTesting(); | 73 ui::InitializeInputMethodForTesting(); |
| 74 | 74 |
| 75 // The ContextFactory must exist before any Compositors are created. | 75 // The ContextFactory must exist before any Compositors are created. |
| 76 bool enable_pixel_output = false; | 76 bool enable_pixel_output = false; |
| 77 ui::ContextFactory* context_factory = | 77 ui::ContextFactory* context_factory = nullptr; |
| 78 ui::InitializeContextFactoryForTests(enable_pixel_output); | 78 ui::ContextFactoryPrivate* context_factory_private = nullptr; |
| 79 |
| 80 ui::InitializeContextFactoryForTests(enable_pixel_output, &context_factory, |
| 81 &context_factory_private); |
| 79 views_delegate_.set_context_factory(context_factory); | 82 views_delegate_.set_context_factory(context_factory); |
| 83 views_delegate_.set_context_factory_private(context_factory_private); |
| 80 views_delegate_.set_use_desktop_native_widgets(true); | 84 views_delegate_.set_use_desktop_native_widgets(true); |
| 81 | 85 |
| 82 platform_part_.reset(ViewEventTestPlatformPart::Create(context_factory)); | 86 platform_part_.reset(ViewEventTestPlatformPart::Create( |
| 87 context_factory, context_factory_private)); |
| 83 gfx::NativeWindow context = platform_part_->GetContext(); | 88 gfx::NativeWindow context = platform_part_->GetContext(); |
| 84 window_ = views::Widget::CreateWindowWithContext(this, context); | 89 window_ = views::Widget::CreateWindowWithContext(this, context); |
| 85 window_->Show(); | 90 window_->Show(); |
| 86 } | 91 } |
| 87 | 92 |
| 88 void ViewEventTestBase::TearDown() { | 93 void ViewEventTestBase::TearDown() { |
| 89 if (window_) { | 94 if (window_) { |
| 90 window_->Close(); | 95 window_->Close(); |
| 91 content::RunAllPendingInMessageLoop(); | 96 content::RunAllPendingInMessageLoop(); |
| 92 window_ = NULL; | 97 window_ = NULL; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 dnd_thread_.reset(NULL); | 166 dnd_thread_.reset(NULL); |
| 162 } | 167 } |
| 163 | 168 |
| 164 void ViewEventTestBase::RunTestMethod(const base::Closure& task) { | 169 void ViewEventTestBase::RunTestMethod(const base::Closure& task) { |
| 165 StopBackgroundThread(); | 170 StopBackgroundThread(); |
| 166 | 171 |
| 167 task.Run(); | 172 task.Run(); |
| 168 if (HasFatalFailure()) | 173 if (HasFatalFailure()) |
| 169 Done(); | 174 Done(); |
| 170 } | 175 } |
| OLD | NEW |