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

Unified Diff: chrome/browser/renderer_host/test/render_view_host_manager_browsertest.cc

Issue 4664009: All SSL UI tests work with ephemeral ports. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: #include <utility> Created 10 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ssl/ssl_browser_tests.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/renderer_host/test/render_view_host_manager_browsertest.cc
diff --git a/chrome/browser/renderer_host/test/render_view_host_manager_browsertest.cc b/chrome/browser/renderer_host/test/render_view_host_manager_browsertest.cc
index 2e7c56b3b03b726711e41cd6f3d62c713a5ace6e..f0d1e3bbc059b074cd446aeb5da53988d4fcd017 100644
--- a/chrome/browser/renderer_host/test/render_view_host_manager_browsertest.cc
+++ b/chrome/browser/renderer_host/test/render_view_host_manager_browsertest.cc
@@ -5,7 +5,6 @@
#include "base/file_util.h"
#include "base/path_service.h"
#include "base/ref_counted.h"
-#include "base/stringprintf.h"
#include "chrome/browser/browser.h"
#include "chrome/browser/download/download_manager.h"
#include "chrome/browser/extensions/extension_error_reporter.h"
@@ -30,23 +29,18 @@ class RenderViewHostManagerTest : public InProcessBrowserTest {
EnableDOMAutomation();
}
- std::string GetFileWithHostAndPortReplacement(
- const std::string& original_path,
- const net::HostPortPair& host_port_pair) const {
- return StringPrintf("%s?replace_orig=%s&replace_new=%s",
- original_path.c_str(),
- kReplaceText_,
- host_port_pair.ToString().c_str());
+ static bool GetFilePathWithHostAndPortReplacement(
+ const std::string& original_file_path,
+ const net::HostPortPair& host_port_pair,
+ std::string* replacement_path) {
+ std::vector<net::TestServer::StringPair> replacement_text;
+ replacement_text.push_back(
+ make_pair("REPLACE_WITH_HOST_AND_PORT", host_port_pair.ToString()));
+ return net::TestServer::GetFilePathWithReplacements(
+ original_file_path, replacement_text, replacement_path);
}
-
- private:
- static const char* const kReplaceText_;
};
-// static
-const char* const RenderViewHostManagerTest::kReplaceText_ =
- "REPLACE_WITH_HOST_AND_PORT";
-
// Test for crbug.com/24447. Following a cross-site link with rel=noreferrer
// and target=_blank should create a new SiteInstance.
IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest,
@@ -59,9 +53,11 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest,
ASSERT_TRUE(https_server_.Start());
// Load a page with links that open in a new window.
- std::string replacement_path = GetFileWithHostAndPortReplacement(
+ std::string replacement_path;
+ ASSERT_TRUE(GetFilePathWithHostAndPortReplacement(
"files/click-noreferrer-links.html",
- https_server_.host_port_pair());
+ https_server_.host_port_pair(),
+ &replacement_path));
ui_test_utils::NavigateToURL(browser(),
test_server()->GetURL(replacement_path));
@@ -105,9 +101,11 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest,
ASSERT_TRUE(https_server_.Start());
// Load a page with links that open in a new window.
- std::string replacement_path = GetFileWithHostAndPortReplacement(
+ std::string replacement_path;
+ ASSERT_TRUE(GetFilePathWithHostAndPortReplacement(
"files/click-noreferrer-links.html",
- https_server_.host_port_pair());
+ https_server_.host_port_pair(),
+ &replacement_path));
ui_test_utils::NavigateToURL(browser(),
test_server()->GetURL(replacement_path));
@@ -151,9 +149,11 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest,
ASSERT_TRUE(https_server_.Start());
// Load a page with links that open in a new window.
- std::string replacement_path = GetFileWithHostAndPortReplacement(
+ std::string replacement_path;
+ ASSERT_TRUE(GetFilePathWithHostAndPortReplacement(
"files/click-noreferrer-links.html",
- https_server_.host_port_pair());
+ https_server_.host_port_pair(),
+ &replacement_path));
ui_test_utils::NavigateToURL(browser(),
test_server()->GetURL(replacement_path));
« no previous file with comments | « no previous file | chrome/browser/ssl/ssl_browser_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698