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

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

Issue 273223002: views: Make view::Views::GetPreferredSize() const. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add two more const for Windows. Created 6 years, 7 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) 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 #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 7
8 // We only want to use ViewEventTestBase in test targets which properly 8 // We only want to use ViewEventTestBase in test targets which properly
9 // isolate each test case by running each test in a separate process. 9 // isolate each test case by running each test in a separate process.
10 // This way if a test hangs the test launcher can reliably terminate it. 10 // This way if a test hangs the test launcher can reliably terminate it.
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 // Called once the message loop is running. 111 // Called once the message loop is running.
112 virtual void DoTestOnMessageLoop() = 0; 112 virtual void DoTestOnMessageLoop() = 0;
113 113
114 // Invoke from test main. Shows the window, starts the message loop and 114 // Invoke from test main. Shows the window, starts the message loop and
115 // schedules a task that invokes DoTestOnMessageLoop. 115 // schedules a task that invokes DoTestOnMessageLoop.
116 void StartMessageLoopAndRunTest(); 116 void StartMessageLoopAndRunTest();
117 117
118 // Returns an empty Size. Subclasses that want a preferred size other than 118 // Returns an empty Size. Subclasses that want a preferred size other than
119 // that of the View returned by CreateContentsView should override this 119 // that of the View returned by CreateContentsView should override this
120 // appropriately. 120 // appropriately.
121 virtual gfx::Size GetPreferredSize(); 121 virtual gfx::Size GetPreferredSize() const;
122 122
123 // Creates a task that calls the specified method back. The specified 123 // Creates a task that calls the specified method back. The specified
124 // method is called in such a way that if there are any test failures 124 // method is called in such a way that if there are any test failures
125 // Done is invoked. 125 // Done is invoked.
126 template <class T, class Method> 126 template <class T, class Method>
127 base::Closure CreateEventTask(T* target, Method method) { 127 base::Closure CreateEventTask(T* target, Method method) {
128 return base::Bind(&ViewEventTestBase::RunTestMethod, this, 128 return base::Bind(&ViewEventTestBase::RunTestMethod, this,
129 base::Bind(method, target)); 129 base::Bind(method, target));
130 } 130 }
131 131
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 // Convenience macro for defining a ViewEventTestBase. See class description 167 // Convenience macro for defining a ViewEventTestBase. See class description
168 // of ViewEventTestBase for details. 168 // of ViewEventTestBase for details.
169 #define VIEW_TEST(test_class, name) \ 169 #define VIEW_TEST(test_class, name) \
170 TEST_F(test_class, name) {\ 170 TEST_F(test_class, name) {\
171 StartMessageLoopAndRunTest();\ 171 StartMessageLoopAndRunTest();\
172 } 172 }
173 173
174 #endif // defined(HAS_OUT_OF_PROC_TEST_RUNNER) 174 #endif // defined(HAS_OUT_OF_PROC_TEST_RUNNER)
175 175
176 #endif // CHROME_TEST_BASE_VIEW_EVENT_TEST_BASE_H_ 176 #endif // CHROME_TEST_BASE_VIEW_EVENT_TEST_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698