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

Side by Side Diff: content/browser/frame_host/navigation_controller_impl_browsertest.cc

Issue 2433743004: PlzNavigate: Transmit referrer into FrameNavigationEntry. (Closed)
Patch Set: Merge tests Created 4 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 | « no previous file | content/renderer/render_frame_impl.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 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/browser/frame_host/navigation_controller_impl.h" 5 #include "content/browser/frame_host/navigation_controller_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 6741 matching lines...) Expand 10 before | Expand all | Expand 10 after
6752 EXPECT_TRUE(WaitForLoadStop(shell()->web_contents())); 6752 EXPECT_TRUE(WaitForLoadStop(shell()->web_contents()));
6753 histogram.ExpectTotalCount(kReloadToReloadMetricName, 4); 6753 histogram.ExpectTotalCount(kReloadToReloadMetricName, 4);
6754 histogram.ExpectTotalCount(kReloadMainResourceToReloadMetricName, 3); 6754 histogram.ExpectTotalCount(kReloadMainResourceToReloadMetricName, 3);
6755 6755
6756 controller.ReloadToRefreshContent(false); 6756 controller.ReloadToRefreshContent(false);
6757 EXPECT_TRUE(WaitForLoadStop(shell()->web_contents())); 6757 EXPECT_TRUE(WaitForLoadStop(shell()->web_contents()));
6758 histogram.ExpectTotalCount(kReloadToReloadMetricName, 4); 6758 histogram.ExpectTotalCount(kReloadToReloadMetricName, 4);
6759 histogram.ExpectTotalCount(kReloadMainResourceToReloadMetricName, 3); 6759 histogram.ExpectTotalCount(kReloadMainResourceToReloadMetricName, 3);
6760 } 6760 }
6761 6761
6762 // Check that the referrer is stored inside FrameNavigationEntry for subframes.
6763 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
6764 RefererStoredForSubFrame) {
6765 if (!SiteIsolationPolicy::UseSubframeNavigationEntries())
6766 return;
6767
6768 const NavigationControllerImpl& controller =
6769 static_cast<const NavigationControllerImpl&>(
6770 shell()->web_contents()->GetController());
6771
6772 GURL url_simple(embedded_test_server()->GetURL(
6773 "/navigation_controller/page_with_iframe_simple.html"));
6774 GURL url_redirect(embedded_test_server()->GetURL(
6775 "/navigation_controller/page_with_iframe_redirect.html"));
6776
6777 // Run this test twice: with and without a redirection.
6778 for (const GURL& url : {url_simple, url_redirect}) {
6779 // Navigate to a page with an iframe.
6780 EXPECT_TRUE(NavigateToURL(shell(), url));
6781
6782 // Check the FrameNavigationEntry's referrer.
6783 NavigationEntryImpl* entry = controller.GetLastCommittedEntry();
6784 ASSERT_EQ(1U, entry->root_node()->children.size());
6785 FrameNavigationEntry* frame_entry =
6786 entry->root_node()->children[0]->frame_entry.get();
6787 EXPECT_EQ(frame_entry->referrer().url, url);
6788 }
6789 }
6790
6762 namespace { 6791 namespace {
6763 6792
6764 class RequestMonitoringNavigationBrowserTest : public ContentBrowserTest { 6793 class RequestMonitoringNavigationBrowserTest : public ContentBrowserTest {
6765 public: 6794 public:
6766 RequestMonitoringNavigationBrowserTest() : weak_factory_(this) {} 6795 RequestMonitoringNavigationBrowserTest() : weak_factory_(this) {}
6767 6796
6768 const net::test_server::HttpRequest* FindAccumulatedRequest( 6797 const net::test_server::HttpRequest* FindAccumulatedRequest(
6769 const GURL& url_to_find) { 6798 const GURL& url_to_find) {
6770 // net::test_server::HttpRequest::GetURL hardcodes "http://localhost/" part. 6799 // net::test_server::HttpRequest::GetURL hardcodes "http://localhost/" part.
6771 GURL::Replacements replacements; 6800 GURL::Replacements replacements;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
6874 // Verify that the extra header was NOT present for the subresource. 6903 // Verify that the extra header was NOT present for the subresource.
6875 const net::test_server::HttpRequest* image_request = 6904 const net::test_server::HttpRequest* image_request =
6876 FindAccumulatedRequest(image_url); 6905 FindAccumulatedRequest(image_url);
6877 ASSERT_TRUE(image_request); 6906 ASSERT_TRUE(image_request);
6878 EXPECT_THAT(image_request->headers, 6907 EXPECT_THAT(image_request->headers,
6879 testing::Not(testing::Contains( 6908 testing::Not(testing::Contains(
6880 testing::Key("X-ExtraHeadersVsSubresources")))); 6909 testing::Key("X-ExtraHeadersVsSubresources"))));
6881 } 6910 }
6882 6911
6883 } // namespace content 6912 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698