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

Side by Side Diff: content/test/browser_test_utils_browsertest.cc

Issue 667023004: Remove unnecessary ServeFilesFromDirectory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 unified diff | Download patch
« no previous file with comments | « content/browser/site_per_process_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/public/browser/resource_request_details.h" 5 #include "content/public/browser/resource_request_details.h"
6 #include "content/public/test/browser_test_utils.h" 6 #include "content/public/test/browser_test_utils.h"
7 #include "content/public/test/content_browser_test.h" 7 #include "content/public/test/content_browser_test.h"
8 #include "content/public/test/content_browser_test_utils.h" 8 #include "content/public/test/content_browser_test_utils.h"
9 #include "content/shell/browser/shell.h" 9 #include "content/shell/browser/shell.h"
10 #include "net/dns/mock_host_resolver.h" 10 #include "net/dns/mock_host_resolver.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 public: 50 public:
51 CrossSiteRedirectorBrowserTest() {} 51 CrossSiteRedirectorBrowserTest() {}
52 }; 52 };
53 53
54 IN_PROC_BROWSER_TEST_F(CrossSiteRedirectorBrowserTest, 54 IN_PROC_BROWSER_TEST_F(CrossSiteRedirectorBrowserTest,
55 VerifyCrossSiteRedirectURL) { 55 VerifyCrossSiteRedirectURL) {
56 // Map all hosts to localhost and setup the EmbeddedTestServer for redirects. 56 // Map all hosts to localhost and setup the EmbeddedTestServer for redirects.
57 host_resolver()->AddRule("*", "127.0.0.1"); 57 host_resolver()->AddRule("*", "127.0.0.1");
58 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 58 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
59 SetupCrossSiteRedirector(embedded_test_server()); 59 SetupCrossSiteRedirector(embedded_test_server());
60 embedded_test_server()->ServeFilesFromDirectory(GetTestFilePath("files", ""));
61 60
62 // Navigate to http://localhost:<port>/cross-site/foo.com/title2.html and 61 // Navigate to http://localhost:<port>/cross-site/foo.com/title2.html and
63 // ensure that the redirector forwards the navigation to 62 // ensure that the redirector forwards the navigation to
64 // http://foo.com:<port>/title2.html 63 // http://foo.com:<port>/title2.html
65 NavigationObserver observer(shell()->web_contents()); 64 NavigationObserver observer(shell()->web_contents());
66 NavigateToURL( 65 NavigateToURL(
67 shell(), 66 shell(),
68 embedded_test_server()->GetURL("/cross-site/foo.com/title2.html")); 67 embedded_test_server()->GetURL("/cross-site/foo.com/title2.html"));
69 68
70 // The expectation is that the cross-site redirector will take the 69 // The expectation is that the cross-site redirector will take the
71 // hostname supplied in the URL and rewrite the URL. Build the 70 // hostname supplied in the URL and rewrite the URL. Build the
72 // expected URL to ensure navigation was properly redirected. 71 // expected URL to ensure navigation was properly redirected.
73 GURL::Replacements replace_host; 72 GURL::Replacements replace_host;
74 std::string foo_com("foo.com"); 73 std::string foo_com("foo.com");
75 GURL expected_url(embedded_test_server()->GetURL("/title2.html")); 74 GURL expected_url(embedded_test_server()->GetURL("/title2.html"));
76 replace_host.SetHostStr(foo_com); 75 replace_host.SetHostStr(foo_com);
77 expected_url = expected_url.ReplaceComponents(replace_host); 76 expected_url = expected_url.ReplaceComponents(replace_host);
78 77
79 EXPECT_EQ(expected_url, observer.navigation_url()); 78 EXPECT_EQ(expected_url, observer.navigation_url());
80 EXPECT_EQ(observer.redirect_url(), observer.navigation_url()); 79 EXPECT_EQ(observer.redirect_url(), observer.navigation_url());
81 } 80 }
82 81
83 } // namespace content 82 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/site_per_process_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698