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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 } | 75 } |
76 | 76 |
77 void ViewEventTestBase::SetUp() { | 77 void ViewEventTestBase::SetUp() { |
78 views::ViewsDelegate::views_delegate = &views_delegate_; | 78 views::ViewsDelegate::views_delegate = &views_delegate_; |
79 ui::InitializeInputMethodForTesting(); | 79 ui::InitializeInputMethodForTesting(); |
80 | 80 |
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); |
| 86 views_delegate_.set_use_desktop_native_widgets(true); |
85 | 87 |
86 platform_part_.reset(ViewEventTestPlatformPart::Create(context_factory)); | 88 platform_part_.reset(ViewEventTestPlatformPart::Create(context_factory)); |
87 gfx::NativeWindow context = platform_part_->GetContext(); | 89 gfx::NativeWindow context = platform_part_->GetContext(); |
88 window_ = views::Widget::CreateWindowWithContext(this, context); | 90 window_ = views::Widget::CreateWindowWithContext(this, context); |
89 } | 91 } |
90 | 92 |
91 void ViewEventTestBase::TearDown() { | 93 void ViewEventTestBase::TearDown() { |
92 if (window_) { | 94 if (window_) { |
93 window_->Close(); | 95 window_->Close(); |
94 content::RunAllPendingInMessageLoop(); | 96 content::RunAllPendingInMessageLoop(); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 dnd_thread_.reset(NULL); | 168 dnd_thread_.reset(NULL); |
167 } | 169 } |
168 | 170 |
169 void ViewEventTestBase::RunTestMethod(const base::Closure& task) { | 171 void ViewEventTestBase::RunTestMethod(const base::Closure& task) { |
170 StopBackgroundThread(); | 172 StopBackgroundThread(); |
171 | 173 |
172 task.Run(); | 174 task.Run(); |
173 if (HasFatalFailure()) | 175 if (HasFatalFailure()) |
174 Done(); | 176 Done(); |
175 } | 177 } |
OLD | NEW |