OLD | NEW |
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 #include "chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.h" | 5 #include "chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 content::WebUIMessageHandler* NetInternalsTest::GetMockMessageHandler() { | 410 content::WebUIMessageHandler* NetInternalsTest::GetMockMessageHandler() { |
411 return message_handler_.get(); | 411 return message_handler_.get(); |
412 } | 412 } |
413 | 413 |
414 GURL NetInternalsTest::CreatePrerenderLoaderUrl( | 414 GURL NetInternalsTest::CreatePrerenderLoaderUrl( |
415 const GURL& prerender_url) { | 415 const GURL& prerender_url) { |
416 EXPECT_TRUE(StartTestServer()); | 416 EXPECT_TRUE(StartTestServer()); |
417 std::vector<net::SpawnedTestServer::StringPair> replacement_text; | 417 std::vector<net::SpawnedTestServer::StringPair> replacement_text; |
418 replacement_text.push_back( | 418 replacement_text.push_back( |
419 make_pair("REPLACE_WITH_PRERENDER_URL", prerender_url.spec())); | 419 make_pair("REPLACE_WITH_PRERENDER_URL", prerender_url.spec())); |
420 replacement_text.push_back( | |
421 make_pair("REPLACE_WITH_DESTINATION_URL", prerender_url.spec())); | |
422 std::string replacement_path; | 420 std::string replacement_path; |
423 EXPECT_TRUE(net::SpawnedTestServer::GetFilePathWithReplacements( | 421 EXPECT_TRUE(net::SpawnedTestServer::GetFilePathWithReplacements( |
424 "files/prerender/prerender_loader.html", | 422 "files/prerender/prerender_loader.html", |
425 replacement_text, | 423 replacement_text, |
426 &replacement_path)); | 424 &replacement_path)); |
427 GURL url_loader = test_server()->GetURL(replacement_path); | 425 GURL url_loader = test_server()->GetURL(replacement_path); |
428 return url_loader; | 426 return url_loader; |
429 } | 427 } |
430 | 428 |
431 bool NetInternalsTest::StartTestServer() { | 429 bool NetInternalsTest::StartTestServer() { |
432 if (test_server_started_) | 430 if (test_server_started_) |
433 return true; | 431 return true; |
434 test_server_started_ = test_server()->Start(); | 432 test_server_started_ = test_server()->Start(); |
435 return test_server_started_; | 433 return test_server_started_; |
436 } | 434 } |
OLD | NEW |