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

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

Issue 8937007: Initialize shell and browser thread for views event tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: consolidated ui_thread in bookmark test and vieweventtestbase 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
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 #ifndef CHROME_TEST_BASE_VIEW_EVENT_TEST_BASE_H_ 5 #ifndef CHROME_TEST_BASE_VIEW_EVENT_TEST_BASE_H_
6 #define CHROME_TEST_BASE_VIEW_EVENT_TEST_BASE_H_ 6 #define CHROME_TEST_BASE_VIEW_EVENT_TEST_BASE_H_
7 #pragma once 7 #pragma once
8 8
9 // We only want to use ViewEventTestBase in test targets which properly 9 // We only want to use ViewEventTestBase in test targets which properly
10 // isolate each test case by running each test in a separate process. 10 // isolate each test case by running each test in a separate process.
11 // This way if a test hangs the test launcher can reliably terminate it. 11 // This way if a test hangs the test launcher can reliably terminate it.
12 #if defined(HAS_OUT_OF_PROC_TEST_RUNNER) 12 #if defined(HAS_OUT_OF_PROC_TEST_RUNNER)
13 13
14 #include "base/bind.h" 14 #include "base/bind.h"
15 #include "base/callback.h" 15 #include "base/callback.h"
16 #include "base/compiler_specific.h" 16 #include "base/compiler_specific.h"
17 #include "base/message_loop.h" 17 #include "base/message_loop.h"
18 #include "base/threading/thread.h" 18 #include "base/threading/thread.h"
19 #include "content/test/test_browser_thread.h"
19 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
20 #include "ui/views/widget/widget_delegate.h" 21 #include "ui/views/widget/widget_delegate.h"
21 22
22 namespace gfx { 23 namespace gfx {
23 class Size; 24 class Size;
24 } 25 }
25 26
26 // Base class for Views based tests that dispatch events. 27 // Base class for Views based tests that dispatch events.
27 // 28 //
28 // As views based event test involves waiting for events to be processed, 29 // As views based event test involves waiting for events to be processed,
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 void RunTestMethod(const base::Closure& task); 128 void RunTestMethod(const base::Closure& task);
128 129
129 // The content of the Window. 130 // The content of the Window.
130 views::View* content_view_; 131 views::View* content_view_;
131 132
132 // Thread for posting background MouseMoves. 133 // Thread for posting background MouseMoves.
133 scoped_ptr<base::Thread> dnd_thread_; 134 scoped_ptr<base::Thread> dnd_thread_;
134 135
135 MessageLoopForUI message_loop_; 136 MessageLoopForUI message_loop_;
136 137
138 content::TestBrowserThread ui_thread_;
139
137 // Method factory used for time-outs. 140 // Method factory used for time-outs.
138 ScopedRunnableMethodFactory<ViewEventTestBase> method_factory_; 141 ScopedRunnableMethodFactory<ViewEventTestBase> method_factory_;
139 142
140 DISALLOW_COPY_AND_ASSIGN(ViewEventTestBase); 143 DISALLOW_COPY_AND_ASSIGN(ViewEventTestBase);
141 }; 144 };
142 145
143 // Convenience macro for defining a ViewEventTestBase. See class description 146 // Convenience macro for defining a ViewEventTestBase. See class description
144 // of ViewEventTestBase for details. 147 // of ViewEventTestBase for details.
145 #define VIEW_TEST(test_class, name) \ 148 #define VIEW_TEST(test_class, name) \
146 TEST_F(test_class, name) {\ 149 TEST_F(test_class, name) {\
147 StartMessageLoopAndRunTest();\ 150 StartMessageLoopAndRunTest();\
148 } 151 }
149 152
150 #endif // defined(HAS_OUT_OF_PROC_TEST_RUNNER) 153 #endif // defined(HAS_OUT_OF_PROC_TEST_RUNNER)
151 154
152 #endif // CHROME_TEST_BASE_VIEW_EVENT_TEST_BASE_H_ 155 #endif // CHROME_TEST_BASE_VIEW_EVENT_TEST_BASE_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc ('k') | chrome/test/base/view_event_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698