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

Side by Side Diff: chrome/test/in_process_browser_test.h

Issue 3034038: GTTF: Move more test server code from net/url_request/url_request_unittest.h (Closed)
Patch Set: hopefully final Created 10 years, 4 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_IN_PROCESS_BROWSER_TEST_H_ 5 #ifndef CHROME_TEST_IN_PROCESS_BROWSER_TEST_H_
6 #define CHROME_TEST_IN_PROCESS_BROWSER_TEST_H_ 6 #define CHROME_TEST_IN_PROCESS_BROWSER_TEST_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "net/url_request/url_request_unittest.h" 10 #include "base/ref_counted.h"
11 #include "base/scoped_ptr.h"
11 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
12 13
13 class Browser; 14 class Browser;
15 class CommandLine;
14 class Profile; 16 class Profile;
17
15 namespace net { 18 namespace net {
19 class HTTPTestServer;
16 class RuleBasedHostResolverProc; 20 class RuleBasedHostResolverProc;
17 } 21 }
18 22
19 // Base class for tests wanting to bring up a browser in the unit test process. 23 // Base class for tests wanting to bring up a browser in the unit test process.
20 // Writing tests with InProcessBrowserTest is slightly different than that of 24 // Writing tests with InProcessBrowserTest is slightly different than that of
21 // other tests. This is necessitated by InProcessBrowserTest running a message 25 // other tests. This is necessitated by InProcessBrowserTest running a message
22 // loop. To use InProcessBrowserTest do the following: 26 // loop. To use InProcessBrowserTest do the following:
23 // . Use the macro IN_PROC_BROWSER_TEST_F to define your test. 27 // . Use the macro IN_PROC_BROWSER_TEST_F to define your test.
24 // . Your test method is invoked on the ui thread. If you need to block until 28 // . Your test method is invoked on the ui thread. If you need to block until
25 // state changes you'll need to run the message loop from your test method. 29 // state changes you'll need to run the message loop from your test method.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 // main thread before the browser is torn down. 95 // main thread before the browser is torn down.
92 virtual void CleanUpOnMainThread() {} 96 virtual void CleanUpOnMainThread() {}
93 97
94 // Invoked when a test is not finishing in a timely manner. 98 // Invoked when a test is not finishing in a timely manner.
95 void TimedOut(); 99 void TimedOut();
96 100
97 // Sets Initial Timeout value. 101 // Sets Initial Timeout value.
98 void SetInitialTimeoutInMS(int initial_timeout); 102 void SetInitialTimeoutInMS(int initial_timeout);
99 103
100 // Starts an HTTP server. 104 // Starts an HTTP server.
101 HTTPTestServer* StartHTTPServer() WARN_UNUSED_RESULT; 105 net::HTTPTestServer* StartHTTPServer() WARN_UNUSED_RESULT;
102 106
103 // Creates a browser with a single tab (about:blank), waits for the tab to 107 // Creates a browser with a single tab (about:blank), waits for the tab to
104 // finish loading and shows the browser. 108 // finish loading and shows the browser.
105 // 109 //
106 // This is invoked from Setup. 110 // This is invoked from Setup.
107 virtual Browser* CreateBrowser(Profile* profile); 111 virtual Browser* CreateBrowser(Profile* profile);
108 112
109 // Returns the host resolver being used for the tests. Subclasses might want 113 // Returns the host resolver being used for the tests. Subclasses might want
110 // to configure it inside tests. 114 // to configure it inside tests.
111 net::RuleBasedHostResolverProc* host_resolver() { 115 net::RuleBasedHostResolverProc* host_resolver() {
(...skipping 14 matching lines...) Expand all
126 // (RunTestOnMainThread), quits the browsers and returns. 130 // (RunTestOnMainThread), quits the browsers and returns.
127 void RunTestOnMainThreadLoop(); 131 void RunTestOnMainThreadLoop();
128 132
129 // Quits all open browsers and waits until there are no more browsers. 133 // Quits all open browsers and waits until there are no more browsers.
130 void QuitBrowsers(); 134 void QuitBrowsers();
131 135
132 // Browser created from CreateBrowser. 136 // Browser created from CreateBrowser.
133 Browser* browser_; 137 Browser* browser_;
134 138
135 // HTTPServer, created when StartHTTPServer is invoked. 139 // HTTPServer, created when StartHTTPServer is invoked.
136 scoped_refptr<HTTPTestServer> http_server_; 140 scoped_refptr<net::HTTPTestServer> http_server_;
137 141
138 // Whether this test requires the browser windows to be shown (interactive 142 // Whether this test requires the browser windows to be shown (interactive
139 // tests for example need the windows shown). 143 // tests for example need the windows shown).
140 bool show_window_; 144 bool show_window_;
141 145
142 // Whether the JavaScript can access the DOMAutomationController (a JS object 146 // Whether the JavaScript can access the DOMAutomationController (a JS object
143 // that can send messages back to the browser). 147 // that can send messages back to the browser).
144 bool dom_automation_enabled_; 148 bool dom_automation_enabled_;
145 149
146 // Whether this test requires the TabCloseableStateWatcher. 150 // Whether this test requires the TabCloseableStateWatcher.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>);\ 197 GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>);\
194 void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::RunTestOnMainThread() 198 void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::RunTestOnMainThread()
195 199
196 #define IN_PROC_BROWSER_TEST_F(test_fixture, test_name)\ 200 #define IN_PROC_BROWSER_TEST_F(test_fixture, test_name)\
197 IN_PROC_BROWSER_TEST_(test_fixture, test_name, test_fixture,\ 201 IN_PROC_BROWSER_TEST_(test_fixture, test_name, test_fixture,\
198 ::testing::internal::GetTypeId<test_fixture>()) 202 ::testing::internal::GetTypeId<test_fixture>())
199 203
200 #endif // defined(ALLOW_IN_PROC_BROWSER_TEST) 204 #endif // defined(ALLOW_IN_PROC_BROWSER_TEST)
201 205
202 #endif // CHROME_TEST_IN_PROCESS_BROWSER_TEST_H_ 206 #endif // CHROME_TEST_IN_PROCESS_BROWSER_TEST_H_
OLDNEW
« no previous file with comments | « chrome/test/automation/automation_proxy_uitest.cc ('k') | chrome/test/in_process_browser_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698