Chromium Code Reviews| Index: chrome/browser/predictors/resource_prefetch_predictor_browsertest.cc |
| diff --git a/chrome/browser/predictors/resource_prefetch_predictor_browsertest.cc b/chrome/browser/predictors/resource_prefetch_predictor_browsertest.cc |
| index 0c1437b98c446f37f67c7f129698d08808dffb0a..2deff8b92401a5fdd6eee9127523e175d2e5e6a9 100644 |
| --- a/chrome/browser/predictors/resource_prefetch_predictor_browsertest.cc |
| +++ b/chrome/browser/predictors/resource_prefetch_predictor_browsertest.cc |
| @@ -4,6 +4,7 @@ |
| #include <stddef.h> |
| +#include <algorithm> |
| #include <set> |
| #include "base/command_line.h" |
| @@ -24,9 +25,11 @@ |
| #include "chrome/test/base/in_process_browser_test.h" |
| #include "chrome/test/base/ui_test_utils.h" |
| #include "net/base/host_port_pair.h" |
| +#include "net/base/url_util.h" |
| #include "net/dns/mock_host_resolver.h" |
| #include "net/test/embedded_test_server/http_request.h" |
| #include "net/test/embedded_test_server/http_response.h" |
| +#include "net/test/embedded_test_server/request_handler_util.h" |
| #include "testing/gmock/include/gmock/gmock.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| @@ -34,6 +37,7 @@ namespace predictors { |
| namespace { |
| +const char kLocalHost[] = "127.0.0.1"; |
| const char kFooHost[] = "foo.com"; |
| const char kBarHost[] = "bar.com"; |
| const char kBazHost[] = "baz.com"; |
| @@ -69,6 +73,11 @@ const char kHtmlIframePath[] = "/predictors/html_iframe.html"; |
| const char kHtmlJavascriptRedirectPath[] = |
| "/predictors/javascript_redirect.html"; |
| +const std::pair<std::string, std::string> kScript = {kFooHost, kScriptPath}; |
| +const std::pair<std::string, std::string> kImage = {kBarHost, kImagePath}; |
| +const std::pair<std::string, std::string> kFont = {kFooHost, kFontPath}; |
| +const std::pair<std::string, std::string> kStyle = {kBazHost, kStylePath}; |
|
alexilin
2017/04/19 09:31:06
The compilation error (warning, actually) is a MSV
Benoit L
2017/04/19 12:59:21
Done.
|
| + |
| struct ResourceSummary { |
| ResourceSummary() |
| : version(0), |
| @@ -318,16 +327,25 @@ class ResourcePrefetchPredictorBrowserTest : public InProcessBrowserTest { |
| // Resolving all hosts to local allows us to have |
| // cross domains navigations (matching url_visit_count_, etc). |
| host_resolver()->AddRule("*", "127.0.0.1"); |
| - embedded_test_server()->RegisterRequestHandler( |
| - base::Bind(&ResourcePrefetchPredictorBrowserTest::HandleRedirectRequest, |
| - base::Unretained(this))); |
| - embedded_test_server()->RegisterRequestHandler( |
| - base::Bind(&ResourcePrefetchPredictorBrowserTest::HandleResourceRequest, |
| - base::Unretained(this))); |
| - embedded_test_server()->RegisterRequestMonitor(base::Bind( |
| - &ResourcePrefetchPredictorBrowserTest::MonitorResourceRequest, |
| - base::Unretained(this))); |
| - ASSERT_TRUE(embedded_test_server()->Start()); |
| + |
| + https_server_ = base::MakeUnique<net::EmbeddedTestServer>( |
| + net::EmbeddedTestServer::TYPE_HTTPS); |
| + |
| + for (auto* server : {embedded_test_server(), https_server()}) { |
| + server->AddDefaultHandlers( |
| + base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); |
| + server->RegisterRequestHandler(base::Bind( |
| + &ResourcePrefetchPredictorBrowserTest::HandleRedirectRequest, |
| + base::Unretained(this))); |
| + server->RegisterRequestHandler(base::Bind( |
| + &ResourcePrefetchPredictorBrowserTest::HandleResourceRequest, |
| + base::Unretained(this))); |
| + server->RegisterRequestMonitor(base::Bind( |
| + &ResourcePrefetchPredictorBrowserTest::MonitorResourceRequest, |
| + base::Unretained(this))); |
| + ASSERT_TRUE(server->Start()); |
| + } |
| + |
| predictor_ = |
| ResourcePrefetchPredictorFactory::GetForProfile(browser()->profile()); |
| ASSERT_TRUE(predictor_); |
| @@ -484,31 +502,40 @@ class ResourcePrefetchPredictorBrowserTest : public InProcessBrowserTest { |
| kv.second.request.was_cached = false; |
| } |
| - // Shortcut for convenience. |
| + // Shortcuts for convenience. |
| GURL GetURL(const std::string& path) const { |
| return embedded_test_server()->GetURL(path); |
| } |
| - void EnableHttpsServer() { |
| - ASSERT_FALSE(https_server_); |
| - https_server_ = base::MakeUnique<net::EmbeddedTestServer>( |
| - net::EmbeddedTestServer::TYPE_HTTPS); |
| - https_server()->AddDefaultHandlers( |
| - base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); |
| - https_server()->RegisterRequestHandler( |
| - base::Bind(&ResourcePrefetchPredictorBrowserTest::HandleRedirectRequest, |
| - base::Unretained(this))); |
| - https_server()->RegisterRequestHandler( |
| - base::Bind(&ResourcePrefetchPredictorBrowserTest::HandleResourceRequest, |
| - base::Unretained(this))); |
| - https_server()->RegisterRequestMonitor(base::Bind( |
| - &ResourcePrefetchPredictorBrowserTest::MonitorResourceRequest, |
| - base::Unretained(this))); |
| - ASSERT_TRUE(https_server()->Start()); |
| - } |
| - |
| - // Returns the embedded test server working over HTTPS. Must be enabled by |
| - // calling EnableHttpsServer() before use. |
| + GURL GetURLWithHost(const std::string& host, |
| + const std::string& path, |
| + bool https = false) const { |
| + auto* server = https ? https_server() : embedded_test_server(); |
| + return server->GetURL(host, path); |
| + } |
| + |
| + GURL GetSubresource( |
| + const std::pair<std::string, std::string>& host_path) const { |
| + return GetURLWithHost(host_path.first, host_path.second); |
| + } |
| + |
| + std::string GetPathWithReplacements(const std::string& path, |
| + bool https) const { |
|
alexilin
2017/04/19 09:31:07
unused parameter
Probably you wanted to use it as
Benoit L
2017/04/19 12:59:21
That was the plan, yes, you guessed what was the p
|
| + std::string port = base::StringPrintf("%d", embedded_test_server()->port()); |
| + std::string path_with_replacements; |
| + net::test_server::GetFilePathWithReplacements( |
| + path, {{"REPLACE_WITH_PORT", port}}, &path_with_replacements); |
| + return path_with_replacements; |
| + } |
| + |
| + GURL GetPageURLWithReplacements(const std::string& host, |
|
alexilin
2017/04/19 09:31:07
Add a warning comment that the result URL is only
Benoit L
2017/04/19 12:59:21
Done.
|
| + const std::string& path, |
| + bool https = false) const { |
| + std::string path_with_replacements = GetPathWithReplacements(path, https); |
|
alexilin
2017/04/19 09:31:07
just nit:
Scheme also could be set with replacemen
Benoit L
2017/04/19 12:59:21
As above...
|
| + return GetURLWithHost(host, path_with_replacements, https); |
| + } |
| + |
| + // Returns the embedded test server working over HTTPS. |
| const net::EmbeddedTestServer* https_server() const { |
| return https_server_.get(); |
| } |
| @@ -519,6 +546,20 @@ class ResourcePrefetchPredictorBrowserTest : public InProcessBrowserTest { |
| return navigation_id_history_.size(); |
| } |
| + // Expects the resources from kHtmlSubresourcesPath. |
| + std::vector<ResourceSummary*> AddResourcesFromSubresourceHtml() { |
| + // These resources have default priorities that correspond to |
| + // blink::TypeToPriority(). |
| + return {AddResource(GetSubresource(kImage), content::RESOURCE_TYPE_IMAGE, |
| + net::LOWEST), |
| + AddResource(GetSubresource(kStyle), |
| + content::RESOURCE_TYPE_STYLESHEET, net::HIGHEST), |
| + AddResource(GetSubresource(kScript), content::RESOURCE_TYPE_SCRIPT, |
| + net::MEDIUM), |
| + AddResource(GetSubresource(kFont), |
| + content::RESOURCE_TYPE_FONT_RESOURCE, net::HIGHEST)}; |
| + } |
| + |
| std::unique_ptr<base::HistogramTester> histogram_tester_; |
| private: |
| @@ -684,15 +725,9 @@ class ResourcePrefetchPredictorPrefetchingBrowserTest |
| }; |
| IN_PROC_BROWSER_TEST_F(ResourcePrefetchPredictorBrowserTest, Simple) { |
| - // These resources have default priorities that correspond to |
| - // blink::typeToPriority function. |
| - AddResource(GetURL(kImagePath), content::RESOURCE_TYPE_IMAGE, net::LOWEST); |
| - AddResource(GetURL(kStylePath), content::RESOURCE_TYPE_STYLESHEET, |
| - net::HIGHEST); |
| - AddResource(GetURL(kScriptPath), content::RESOURCE_TYPE_SCRIPT, net::MEDIUM); |
| - AddResource(GetURL(kFontPath), content::RESOURCE_TYPE_FONT_RESOURCE, |
| - net::HIGHEST); |
| - TestLearningAndPrefetching(GetURL(kHtmlSubresourcesPath)); |
| + AddResourcesFromSubresourceHtml(); |
| + GURL url = GetPageURLWithReplacements(kFooHost, kHtmlSubresourcesPath); |
| + TestLearningAndPrefetching(url); |
| // The local cache is cleared. |
| histogram_tester_->ExpectBucketCount( |
| @@ -713,49 +748,41 @@ IN_PROC_BROWSER_TEST_F(ResourcePrefetchPredictorBrowserTest, Simple) { |
| IN_PROC_BROWSER_TEST_F(ResourcePrefetchPredictorBrowserTest, Redirect) { |
| GURL initial_url = embedded_test_server()->GetURL(kFooHost, kRedirectPath); |
| - AddRedirectChain(initial_url, {{net::HTTP_MOVED_PERMANENTLY, |
| - GetURL(kHtmlSubresourcesPath)}}); |
| - AddResource(GetURL(kImagePath), content::RESOURCE_TYPE_IMAGE, net::LOWEST); |
| - AddResource(GetURL(kStylePath), content::RESOURCE_TYPE_STYLESHEET, |
| - net::HIGHEST); |
| - AddResource(GetURL(kScriptPath), content::RESOURCE_TYPE_SCRIPT, net::MEDIUM); |
| - AddResource(GetURL(kFontPath), content::RESOURCE_TYPE_FONT_RESOURCE, |
| - net::HIGHEST); |
| + GURL redirected_url = |
| + GetPageURLWithReplacements(kBarHost, kHtmlSubresourcesPath); |
| + AddRedirectChain(initial_url, |
| + {{net::HTTP_MOVED_PERMANENTLY, redirected_url}}); |
| + AddResourcesFromSubresourceHtml(); |
| TestLearningAndPrefetching(initial_url); |
| } |
| IN_PROC_BROWSER_TEST_F(ResourcePrefetchPredictorBrowserTest, RedirectChain) { |
| GURL initial_url = embedded_test_server()->GetURL(kFooHost, kRedirectPath); |
| + GURL redirected_url = |
| + GetPageURLWithReplacements(kFooHost, kHtmlSubresourcesPath); |
| AddRedirectChain(initial_url, |
| {{net::HTTP_FOUND, |
| embedded_test_server()->GetURL(kBarHost, kRedirectPath2)}, |
| {net::HTTP_MOVED_PERMANENTLY, |
| embedded_test_server()->GetURL(kBazHost, kRedirectPath3)}, |
| - {net::HTTP_FOUND, GetURL(kHtmlSubresourcesPath)}}); |
| - AddResource(GetURL(kImagePath), content::RESOURCE_TYPE_IMAGE, net::LOWEST); |
| - AddResource(GetURL(kStylePath), content::RESOURCE_TYPE_STYLESHEET, |
| - net::HIGHEST); |
| - AddResource(GetURL(kScriptPath), content::RESOURCE_TYPE_SCRIPT, net::MEDIUM); |
| - AddResource(GetURL(kFontPath), content::RESOURCE_TYPE_FONT_RESOURCE, |
| - net::HIGHEST); |
| + {net::HTTP_FOUND, redirected_url}}); |
| + AddResourcesFromSubresourceHtml(); |
| TestLearningAndPrefetching(initial_url); |
| } |
| IN_PROC_BROWSER_TEST_F(ResourcePrefetchPredictorBrowserTest, |
| HttpToHttpsRedirect) { |
| - EnableHttpsServer(); |
| - GURL initial_url = embedded_test_server()->GetURL(kFooHost, kRedirectPath); |
| - AddRedirectChain(initial_url, |
| - {{net::HTTP_MOVED_PERMANENTLY, |
| - https_server()->GetURL(kHtmlSubresourcesPath)}}); |
| - AddResource(https_server()->GetURL(kImagePath), content::RESOURCE_TYPE_IMAGE, |
| + GURL initial_url = GetURLWithHost(kFooHost, kRedirectPath); |
| + GURL redirected_url = |
| + GetPageURLWithReplacements(kLocalHost, kHtmlSubresourcesPath, true); |
| + |
| + // Only one resource, as HTTP images in HTTPS pages are only a warning, not |
| + // an error. |
| + AddResource(GetSubresource(kImage), content::RESOURCE_TYPE_IMAGE, |
| net::LOWEST); |
| - AddResource(https_server()->GetURL(kStylePath), |
| - content::RESOURCE_TYPE_STYLESHEET, net::HIGHEST); |
| - AddResource(https_server()->GetURL(kScriptPath), |
| - content::RESOURCE_TYPE_SCRIPT, net::MEDIUM); |
| - AddResource(https_server()->GetURL(kFontPath), |
| - content::RESOURCE_TYPE_FONT_RESOURCE, net::HIGHEST); |
| + |
| + AddRedirectChain(initial_url, |
| + {{net::HTTP_MOVED_PERMANENTLY, redirected_url}}); |
| TestLearningAndPrefetching(initial_url); |
| } |
| @@ -835,30 +862,17 @@ IN_PROC_BROWSER_TEST_F(ResourcePrefetchPredictorBrowserTest, |
| IN_PROC_BROWSER_TEST_F(ResourcePrefetchPredictorBrowserTest, |
| CrossSiteNavigation) { |
| - AddResource(embedded_test_server()->GetURL(kFooHost, kImagePath), |
| - content::RESOURCE_TYPE_IMAGE, net::LOWEST); |
| - AddResource(embedded_test_server()->GetURL(kFooHost, kStylePath), |
| - content::RESOURCE_TYPE_STYLESHEET, net::HIGHEST); |
| - AddResource(embedded_test_server()->GetURL(kFooHost, kScriptPath), |
| - content::RESOURCE_TYPE_SCRIPT, net::MEDIUM); |
| - AddResource(embedded_test_server()->GetURL(kFooHost, kFontPath), |
| - content::RESOURCE_TYPE_FONT_RESOURCE, net::HIGHEST); |
| - TestLearningAndPrefetching( |
| - embedded_test_server()->GetURL(kFooHost, kHtmlSubresourcesPath)); |
| - ClearResources(); |
| + AddResourcesFromSubresourceHtml(); |
| + GURL url = GetPageURLWithReplacements(kFooHost, kHtmlSubresourcesPath); |
| + TestLearningAndPrefetching(url); |
| - AddResource(embedded_test_server()->GetURL(kBarHost, kImagePath), |
| - content::RESOURCE_TYPE_IMAGE, net::LOWEST); |
| - AddResource(embedded_test_server()->GetURL(kBarHost, kStylePath), |
| - content::RESOURCE_TYPE_STYLESHEET, net::HIGHEST); |
| - AddResource(embedded_test_server()->GetURL(kBarHost, kScriptPath), |
| - content::RESOURCE_TYPE_SCRIPT, net::MEDIUM); |
| - AddResource(embedded_test_server()->GetURL(kBarHost, kFontPath), |
| - content::RESOURCE_TYPE_FONT_RESOURCE, net::HIGHEST); |
| + ClearResources(); |
| + ClearCache(); |
| + AddResourcesFromSubresourceHtml(); |
| // Navigating to kBarHost, although done in the same tab, will generate a new |
| // process. |
| - TestLearningAndPrefetching( |
| - embedded_test_server()->GetURL(kBarHost, kHtmlSubresourcesPath)); |
| + url = GetPageURLWithReplacements(kBarHost, kHtmlSubresourcesPath); |
| + TestLearningAndPrefetching(url); |
| } |
| // In this test we are trying to assess if : |
| @@ -867,45 +881,31 @@ IN_PROC_BROWSER_TEST_F(ResourcePrefetchPredictorBrowserTest, |
| // - Navigating twice to a new browser/popup yields different NavigationID's. |
| IN_PROC_BROWSER_TEST_F(ResourcePrefetchPredictorBrowserTest, |
| TabIdBehavingAsExpected) { |
| - AddResource(GetURL(kImagePath), content::RESOURCE_TYPE_IMAGE, net::LOWEST); |
| - AddResource(GetURL(kStylePath), content::RESOURCE_TYPE_STYLESHEET, |
| - net::HIGHEST); |
| - AddResource(GetURL(kScriptPath), content::RESOURCE_TYPE_SCRIPT, net::MEDIUM); |
| - AddResource(GetURL(kFontPath), content::RESOURCE_TYPE_FONT_RESOURCE, |
| - net::HIGHEST); |
| - NavigateToURLAndCheckSubresources(GetURL(kHtmlSubresourcesPath)); |
| + AddResourcesFromSubresourceHtml(); |
| + GURL url = GetPageURLWithReplacements(kFooHost, kHtmlSubresourcesPath); |
| + NavigateToURLAndCheckSubresources(url); |
| EXPECT_EQ(navigation_ids_history_size(), 1U); |
| ClearCache(); |
| - NavigateToURLAndCheckSubresources(GetURL(kHtmlSubresourcesPath)); |
| + NavigateToURLAndCheckSubresources(url); |
| EXPECT_EQ(navigation_ids_history_size(), 1U); |
| ClearCache(); |
| - NavigateToURLAndCheckSubresources(GetURL(kHtmlSubresourcesPath), |
| + NavigateToURLAndCheckSubresources(url, |
| WindowOpenDisposition::NEW_BACKGROUND_TAB); |
| EXPECT_EQ(navigation_ids_history_size(), 2U); |
| ClearCache(); |
| - NavigateToURLAndCheckSubresources(GetURL(kHtmlSubresourcesPath), |
| - WindowOpenDisposition::NEW_WINDOW); |
| + NavigateToURLAndCheckSubresources(url, WindowOpenDisposition::NEW_WINDOW); |
| EXPECT_EQ(navigation_ids_history_size(), 3U); |
| ClearCache(); |
| - NavigateToURLAndCheckSubresources(GetURL(kHtmlSubresourcesPath), |
| - WindowOpenDisposition::NEW_POPUP); |
| + NavigateToURLAndCheckSubresources(url, WindowOpenDisposition::NEW_POPUP); |
| EXPECT_EQ(navigation_ids_history_size(), 4U); |
| } |
| IN_PROC_BROWSER_TEST_F(ResourcePrefetchPredictorBrowserTest, AlwaysRevalidate) { |
| - std::vector<ResourceSummary*> resources = { |
| - AddResource(GetURL(kImagePath), content::RESOURCE_TYPE_IMAGE, |
| - net::LOWEST), |
| - AddResource(GetURL(kStylePath), content::RESOURCE_TYPE_STYLESHEET, |
| - net::HIGHEST), |
| - AddResource(GetURL(kScriptPath), content::RESOURCE_TYPE_SCRIPT, |
| - net::MEDIUM), |
| - AddResource(GetURL(kFontPath), content::RESOURCE_TYPE_FONT_RESOURCE, |
| - net::HIGHEST), |
| - }; |
| + auto resources = AddResourcesFromSubresourceHtml(); |
| + GURL url = GetPageURLWithReplacements(kFooHost, kHtmlSubresourcesPath); |
| for (auto* resource : resources) |
| resource->request.always_revalidate = true; |
| - TestLearningAndPrefetching(GetURL(kHtmlSubresourcesPath)); |
| + TestLearningAndPrefetching(url); |
| } |
| // Client-side redirects currently aren't tracked by ResourcePrefetchPredictor. |
| @@ -913,19 +913,16 @@ IN_PROC_BROWSER_TEST_F(ResourcePrefetchPredictorBrowserTest, AlwaysRevalidate) { |
| // URL and aborts the current navigation so that the OnLoad event is not fired. |
| IN_PROC_BROWSER_TEST_F(ResourcePrefetchPredictorBrowserTest, |
| JavascriptRedirectsAreNotHandled) { |
| - std::string redirect_path_with_query = |
| - std::string(kHtmlJavascriptRedirectPath) + "?url=" + |
| - GetURL(kHtmlSubresourcesPath).spec(); |
| + GURL redirected_url = |
| + GetPageURLWithReplacements(kFooHost, kHtmlSubresourcesPath); |
| GURL initial_url = |
| - embedded_test_server()->GetURL(kBarHost, redirect_path_with_query); |
| - AddRedirectChain(initial_url, {{net::HTTP_TEMPORARY_REDIRECT, |
| - GetURL(kHtmlSubresourcesPath), true}}); |
| - AddResource(GetURL(kImagePath), content::RESOURCE_TYPE_IMAGE, net::LOWEST); |
| - AddResource(GetURL(kStylePath), content::RESOURCE_TYPE_STYLESHEET, |
| - net::HIGHEST); |
| - AddResource(GetURL(kScriptPath), content::RESOURCE_TYPE_SCRIPT, net::MEDIUM); |
| - AddResource(GetURL(kFontPath), content::RESOURCE_TYPE_FONT_RESOURCE, |
| - net::HIGHEST); |
| + embedded_test_server()->GetURL(kBarHost, kHtmlJavascriptRedirectPath); |
| + initial_url = |
| + net::AppendQueryParameter(initial_url, "url", redirected_url.spec()); |
| + |
| + AddRedirectChain(initial_url, |
| + {{net::HTTP_TEMPORARY_REDIRECT, redirected_url, true}}); |
| + AddResourcesFromSubresourceHtml(); |
| // Two navigations will occur. LearningObserver will get events only for the |
| // second navigation because the first one will be aborted. |
| @@ -941,21 +938,17 @@ IN_PROC_BROWSER_TEST_F(ResourcePrefetchPredictorBrowserTest, |
| ClearCache(); |
| // But the predictor database contains all subresources for the endpoint url |
| // so this prefetch works. |
| - PrefetchURL(GetURL(kHtmlSubresourcesPath)); |
| - NavigateToURLAndCheckSubresourcesAllCached(GetURL(kHtmlSubresourcesPath)); |
| + PrefetchURL(redirected_url); |
| + NavigateToURLAndCheckSubresourcesAllCached(redirected_url); |
| } |
| // Makes sure that {Stop,Start}Prefetching are called with the same argument. |
| IN_PROC_BROWSER_TEST_F(ResourcePrefetchPredictorPrefetchingBrowserTest, |
| Simple) { |
| - AddResource(GetURL(kImagePath), content::RESOURCE_TYPE_IMAGE, net::LOWEST); |
| - AddResource(GetURL(kStylePath), content::RESOURCE_TYPE_STYLESHEET, |
| - net::HIGHEST); |
| - AddResource(GetURL(kScriptPath), content::RESOURCE_TYPE_SCRIPT, net::MEDIUM); |
| - AddResource(GetURL(kFontPath), content::RESOURCE_TYPE_FONT_RESOURCE, |
| - net::HIGHEST); |
| + AddResourcesFromSubresourceHtml(); |
| - GURL main_frame_url = GetURL(kHtmlSubresourcesPath); |
| + GURL main_frame_url = |
| + GetPageURLWithReplacements(kFooHost, kHtmlSubresourcesPath); |
| NavigateToURLAndCheckSubresources(main_frame_url); |
| ClearCache(); |
| NavigateToURLAndCheckSubresources(main_frame_url); |
| @@ -968,14 +961,11 @@ IN_PROC_BROWSER_TEST_F(ResourcePrefetchPredictorPrefetchingBrowserTest, |
| IN_PROC_BROWSER_TEST_F(ResourcePrefetchPredictorPrefetchingBrowserTest, |
| Redirect) { |
| GURL initial_url = embedded_test_server()->GetURL(kFooHost, kRedirectPath); |
| - AddRedirectChain(initial_url, {{net::HTTP_MOVED_PERMANENTLY, |
| - GetURL(kHtmlSubresourcesPath)}}); |
| - AddResource(GetURL(kImagePath), content::RESOURCE_TYPE_IMAGE, net::LOWEST); |
| - AddResource(GetURL(kStylePath), content::RESOURCE_TYPE_STYLESHEET, |
| - net::HIGHEST); |
| - AddResource(GetURL(kScriptPath), content::RESOURCE_TYPE_SCRIPT, net::MEDIUM); |
| - AddResource(GetURL(kFontPath), content::RESOURCE_TYPE_FONT_RESOURCE, |
| - net::HIGHEST); |
| + GURL redirected_url = |
| + GetPageURLWithReplacements(kFooHost, kHtmlSubresourcesPath); |
|
alexilin
2017/04/19 09:31:06
s/kFooHost/kBarHost to preserve cross-host redirec
Benoit L
2017/04/19 12:59:21
Oops.
Done.
|
| + AddRedirectChain(initial_url, |
| + {{net::HTTP_MOVED_PERMANENTLY, redirected_url}}); |
| + AddResourcesFromSubresourceHtml(); |
| NavigateToURLAndCheckSubresources(initial_url); |
| ClearCache(); |