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

Side by Side Diff: chrome_frame/test/test_with_web_server.h

Issue 10868027: Attempt to fix flake in FullTabModeIE_TestPostReissue by avoiding loopback address. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: another try with net tests Created 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome_frame/test/test_server_test.cc ('k') | chrome_frame/test/test_with_web_server.cc » ('j') | 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) 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_FRAME_TEST_TEST_WITH_WEB_SERVER_H_ 5 #ifndef CHROME_FRAME_TEST_TEST_WITH_WEB_SERVER_H_
6 #define CHROME_FRAME_TEST_TEST_WITH_WEB_SERVER_H_ 6 #define CHROME_FRAME_TEST_TEST_WITH_WEB_SERVER_H_
7 7
8 #include <windows.h> 8 #include <windows.h>
9 #include <string> 9 #include <string>
10 10
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 static FilePath results_dir_; 235 static FilePath results_dir_;
236 static FilePath CFInstall_path_; 236 static FilePath CFInstall_path_;
237 static FilePath CFInstance_path_; 237 static FilePath CFInstance_path_;
238 static FilePath chrome_user_data_dir_; 238 static FilePath chrome_user_data_dir_;
239 239
240 // The user data directory used for Chrome instances. 240 // The user data directory used for Chrome instances.
241 static ScopedTempDir temp_dir_; 241 static ScopedTempDir temp_dir_;
242 242
243 // The web server from which we serve the web! 243 // The web server from which we serve the web!
244 static chrome_frame_test::TimedMsgLoop* loop_; 244 static chrome_frame_test::TimedMsgLoop* loop_;
245 static std::string local_address_;
245 static testing::StrictMock<MockWebServerListener>* listener_mock_; 246 static testing::StrictMock<MockWebServerListener>* listener_mock_;
246 static testing::StrictMock<MockWebServer>* server_mock_; 247 static testing::StrictMock<MockWebServer>* server_mock_;
247 248
248 BrowserKind browser_; 249 BrowserKind browser_;
249 base::win::ScopedHandle browser_handle_; 250 base::win::ScopedHandle browser_handle_;
250 }; 251 };
251 252
252 // A helper class for doing some bookkeeping when using the 253 // A helper class for doing some bookkeeping when using the
253 // SimpleWebServer class. 254 // SimpleWebServer class.
254 class SimpleWebServerTest { 255 class SimpleWebServerTest {
255 public: 256 public:
256 explicit SimpleWebServerTest(int port) : server_(port), port_(port) { 257 SimpleWebServerTest(const std::string& address, int port)
258 : server_(address, port), port_(port) {
257 } 259 }
258 260
259 ~SimpleWebServerTest() { 261 ~SimpleWebServerTest() {
260 server_.DeleteAllResponses(); 262 server_.DeleteAllResponses();
261 } 263 }
262 264
263 template <class ResponseClass> 265 template <class ResponseClass>
264 void PopulateStaticFileListT(const wchar_t* pages[], int count, 266 void PopulateStaticFileListT(const wchar_t* pages[], int count,
265 const FilePath& directory) { 267 const FilePath& directory) {
266 for (int i = 0; i < count; ++i) { 268 for (int i = 0; i < count; ++i) {
267 server_.AddResponse(new ResponseClass( 269 server_.AddResponse(new ResponseClass(
268 base::StringPrintf("/%ls", pages[i]).c_str(), 270 base::StringPrintf("/%ls", pages[i]).c_str(),
269 directory.Append(pages[i]))); 271 directory.Append(pages[i])));
270 } 272 }
271 } 273 }
272 274
273 std::wstring FormatHttpPath(const wchar_t* document_path) { 275 std::wstring FormatHttpPath(const wchar_t* document_path) {
274 return base::StringPrintf(L"http://localhost:%i/%ls", port_, 276 return base::StringPrintf(L"http://%ls:%i/%ls",
277 ASCIIToWide(server_.host()).c_str(), port_,
275 document_path); 278 document_path);
276 } 279 }
277 280
278 // Returns the last client request object. 281 // Returns the last client request object.
279 // Under normal circumstances this will be the request for /quit. 282 // Under normal circumstances this will be the request for /quit.
280 const test_server::Request& last_request() const { 283 const test_server::Request& last_request() const {
281 const test_server::ConnectionList& connections = server_.connections(); 284 const test_server::ConnectionList& connections = server_.connections();
282 DCHECK(connections.size()); 285 DCHECK(connections.size());
283 const test_server::Connection* c = connections.back(); 286 const test_server::Connection* c = connections.back();
284 return c->request(); 287 return c->request();
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 // Same as above except that the response does not include the no-cache header. 363 // Same as above except that the response does not include the no-cache header.
361 ACTION_P2(SendAllowCacheResponse, server, invocation) { 364 ACTION_P2(SendAllowCacheResponse, server, invocation) {
362 server->SendResponseHelper(arg0, arg1, invocation, false); 365 server->SendResponseHelper(arg0, arg1, invocation, false);
363 } 366 }
364 367
365 ACTION_P2(HandlePostedResponseHelper, server, invocation) { 368 ACTION_P2(HandlePostedResponseHelper, server, invocation) {
366 server->HandlePostedResponse(arg0, arg2); 369 server->HandlePostedResponse(arg0, arg2);
367 } 370 }
368 371
369 #endif // CHROME_FRAME_TEST_TEST_WITH_WEB_SERVER_H_ 372 #endif // CHROME_FRAME_TEST_TEST_WITH_WEB_SERVER_H_
OLDNEW
« no previous file with comments | « chrome_frame/test/test_server_test.cc ('k') | chrome_frame/test/test_with_web_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698