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(); | |
92 } | 91 } |
93 | 92 |
94 void ViewEventTestBase::TearDown() { | 93 void ViewEventTestBase::TearDown() { |
95 if (window_) { | 94 if (window_) { |
96 window_->Close(); | 95 window_->Close(); |
97 content::RunAllPendingInMessageLoop(); | 96 content::RunAllPendingInMessageLoop(); |
98 window_ = NULL; | 97 window_ = NULL; |
99 } | 98 } |
100 | 99 |
101 ui::Clipboard::DestroyClipboardForCurrentThread(); | 100 ui::Clipboard::DestroyClipboardForCurrentThread(); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 dnd_thread_.reset(NULL); | 168 dnd_thread_.reset(NULL); |
170 } | 169 } |
171 | 170 |
172 void ViewEventTestBase::RunTestMethod(const base::Closure& task) { | 171 void ViewEventTestBase::RunTestMethod(const base::Closure& task) { |
173 StopBackgroundThread(); | 172 StopBackgroundThread(); |
174 | 173 |
175 task.Run(); | 174 task.Run(); |
176 if (HasFatalFailure()) | 175 if (HasFatalFailure()) |
177 Done(); | 176 Done(); |
178 } | 177 } |
OLD | NEW |