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

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

Issue 9071001: base::Bind: Remove ScopedRunnableMethodFactory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 11 months 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
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"
csilv 2012/01/03 18:57:42 I believe compiler_specific.h include can be remov
James Hawkins 2012/01/03 21:13:54 Done.
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 "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
19 #include "ui/gfx/compositor/test/compositor_test_support.h" 19 #include "ui/gfx/compositor/test/compositor_test_support.h"
20 #include "ui/views/view.h" 20 #include "ui/views/view.h"
21 #include "ui/views/widget/widget.h" 21 #include "ui/views/widget/widget.h"
22 22
23 #if defined(USE_AURA) 23 #if defined(USE_AURA)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 }; 55 };
56 56
57 // Delay in background thread before posting mouse move. 57 // Delay in background thread before posting mouse move.
58 const int kMouseMoveDelayMS = 200; 58 const int kMouseMoveDelayMS = 200;
59 59
60 } // namespace 60 } // namespace
61 61
62 ViewEventTestBase::ViewEventTestBase() 62 ViewEventTestBase::ViewEventTestBase()
63 : window_(NULL), 63 : window_(NULL),
64 content_view_(NULL), 64 content_view_(NULL),
65 ui_thread_(content::BrowserThread::UI, &message_loop_), 65 ui_thread_(content::BrowserThread::UI, &message_loop_) {
66 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) {
67 } 66 }
68 67
69 void ViewEventTestBase::Done() { 68 void ViewEventTestBase::Done() {
70 // Cancel the pending time-out.
71 method_factory_.RevokeAll();
72
73 MessageLoop::current()->Quit(); 69 MessageLoop::current()->Quit();
74 70
75 #if defined(OS_WIN) 71 #if defined(OS_WIN)
76 // We need to post a message to tickle the Dispatcher getting called and 72 // We need to post a message to tickle the Dispatcher getting called and
77 // exiting out of the nested loop. Without this the quit never runs. 73 // exiting out of the nested loop. Without this the quit never runs.
78 PostMessage(window_->GetNativeWindow(), WM_USER, 0, 0); 74 PostMessage(window_->GetNativeWindow(), WM_USER, 0, 0);
79 #endif 75 #endif
80 76
81 // If we're in a nested message loop, as is the case with menus, we 77 // If we're in a nested message loop, as is the case with menus, we
82 // need to quit twice. The second quit does that for us. Finish all 78 // need to quit twice. The second quit does that for us. Finish all
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 dnd_thread_.reset(NULL); 179 dnd_thread_.reset(NULL);
184 } 180 }
185 181
186 void ViewEventTestBase::RunTestMethod(const base::Closure& task) { 182 void ViewEventTestBase::RunTestMethod(const base::Closure& task) {
187 StopBackgroundThread(); 183 StopBackgroundThread();
188 184
189 task.Run(); 185 task.Run();
190 if (HasFatalFailure()) 186 if (HasFatalFailure())
191 Done(); 187 Done();
192 } 188 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698