Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(681)

Side by Side Diff: chrome/test/base/view_event_test_base.cc

Issue 8887002: aura/cc: fix interactive_ui_tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <ole2.h> 8 #include <ole2.h>
9 #endif 9 #endif
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/message_loop.h" 14 #include "base/message_loop.h"
15 #include "base/string_number_conversions.h" 15 #include "base/string_number_conversions.h"
16 #include "chrome/browser/automation/ui_controls.h" 16 #include "chrome/browser/automation/ui_controls.h"
17 #include "chrome/test/base/ui_test_utils.h" 17 #include "chrome/test/base/ui_test_utils.h"
18 #include "ui/gfx/compositor/test/compositor_test_support.h"
18 #include "ui/views/view.h" 19 #include "ui/views/view.h"
19 #include "ui/views/widget/widget.h" 20 #include "ui/views/widget/widget.h"
20 21
22 #if defined(USE_AURA)
23 #include "ui/aura/root_window.h"
24 #endif
25
21 namespace { 26 namespace {
22 27
23 // View subclass that allows you to specify the preferred size. 28 // View subclass that allows you to specify the preferred size.
24 class TestView : public views::View { 29 class TestView : public views::View {
25 public: 30 public:
26 TestView() {} 31 TestView() {}
27 32
28 void SetPreferredSize(const gfx::Size& size) { 33 void SetPreferredSize(const gfx::Size& size) {
29 preferred_size_ = size; 34 preferred_size_ = size;
30 PreferredSizeChanged(); 35 PreferredSizeChanged();
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 // need to quit twice. The second quit does that for us. Finish all 79 // need to quit twice. The second quit does that for us. Finish all
75 // pending UI events before posting closure because events it may be 80 // pending UI events before posting closure because events it may be
76 // executed before UI events are executed. 81 // executed before UI events are executed.
77 ui_controls::RunClosureAfterAllPendingUIEvents(MessageLoop::QuitClosure()); 82 ui_controls::RunClosureAfterAllPendingUIEvents(MessageLoop::QuitClosure());
78 } 83 }
79 84
80 void ViewEventTestBase::SetUp() { 85 void ViewEventTestBase::SetUp() {
81 #if defined(OS_WIN) 86 #if defined(OS_WIN)
82 OleInitialize(NULL); 87 OleInitialize(NULL);
83 #endif 88 #endif
89 ui::CompositorTestSupport::Initialize();
sky 2011/12/08 04:34:44 Should this be ifdef'd around VIEWS_COMPOSITOR?
piman 2011/12/08 07:10:18 We don't need to, but wee could if you prefer.
90 #if defined(USE_AURA)
91 aura::RootWindow::GetInstance();
92 #endif
84 window_ = views::Widget::CreateWindow(this); 93 window_ = views::Widget::CreateWindow(this);
85 } 94 }
86 95
87 void ViewEventTestBase::TearDown() { 96 void ViewEventTestBase::TearDown() {
88 if (window_) { 97 if (window_) {
89 #if defined(OS_WIN) 98 #if defined(OS_WIN)
90 DestroyWindow(window_->GetNativeWindow()); 99 DestroyWindow(window_->GetNativeWindow());
91 #else 100 #else
92 window_->Close(); 101 window_->Close();
93 ui_test_utils::RunAllPendingInMessageLoop(); 102 ui_test_utils::RunAllPendingInMessageLoop();
94 #endif 103 #endif
95 window_ = NULL; 104 window_ = NULL;
96 } 105 }
106 #if defined(USE_AURA)
107 aura::RootWindow::DeleteInstance();
108 #endif
109 ui::CompositorTestSupport::Terminate();
97 #if defined(OS_WIN) 110 #if defined(OS_WIN)
98 OleUninitialize(); 111 OleUninitialize();
99 #endif 112 #endif
100 } 113 }
101 114
102 bool ViewEventTestBase::CanResize() const { 115 bool ViewEventTestBase::CanResize() const {
103 return true; 116 return true;
104 } 117 }
105 118
106 views::View* ViewEventTestBase::GetContentsView() { 119 views::View* ViewEventTestBase::GetContentsView() {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 dnd_thread_.reset(NULL); 178 dnd_thread_.reset(NULL);
166 } 179 }
167 180
168 void ViewEventTestBase::RunTestMethod(const base::Closure& task) { 181 void ViewEventTestBase::RunTestMethod(const base::Closure& task) {
169 StopBackgroundThread(); 182 StopBackgroundThread();
170 183
171 task.Run(); 184 task.Run();
172 if (HasFatalFailure()) 185 if (HasFatalFailure())
173 Done(); 186 Done();
174 } 187 }
OLDNEW
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698