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

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

Issue 2584513003: PlzNavigate: identify same-page browser-initiated navigation. (Closed)
Patch Set: Fix 2 WebContentsImplTest by assigning a document_sequence_number. Created 3 years, 11 months 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
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 6150 matching lines...) Expand 10 before | Expand all | Expand 10 after
6161 // Navigate cross-origin, waiting for the commit to occur. 6161 // Navigate cross-origin, waiting for the commit to occur.
6162 UrlCommitObserver cross_origin_commit_observer(root, cross_origin_url); 6162 UrlCommitObserver cross_origin_commit_observer(root, cross_origin_url);
6163 UrlCommitObserver history_commit_observer(root, start_url); 6163 UrlCommitObserver history_commit_observer(root, start_url);
6164 shell()->LoadURL(cross_origin_url); 6164 shell()->LoadURL(cross_origin_url);
6165 cross_origin_commit_observer.Wait(); 6165 cross_origin_commit_observer.Wait();
6166 EXPECT_EQ(cross_origin_url, web_contents->GetLastCommittedURL()); 6166 EXPECT_EQ(cross_origin_url, web_contents->GetLastCommittedURL());
6167 EXPECT_EQ(2, web_contents->GetController().GetLastCommittedEntryIndex()); 6167 EXPECT_EQ(2, web_contents->GetController().GetLastCommittedEntryIndex());
6168 6168
6169 // Wait for the back navigation to commit as well. 6169 // Wait for the back navigation to commit as well.
6170 history_commit_observer.Wait(); 6170 history_commit_observer.Wait();
6171
6172 // The expected state of the history:
6173 // Without BrowserSideNavigation:
6174 // -> a.com/title1.html
6175 // a.com/title1.html#foo
6176 // suborigin.a.com/title2.html
6177 //
6178 // With BrowserSideNavigation:
6179 // a.com/title1.html
6180 // a.com/title1.html#foo
6181 // suborigin.a.com/title2.html
6182 // -> a.com/title1.html
clamy 2017/01/09 16:58:48 Why do we have a different history state in the Pl
arthursonzogni 2017/01/12 17:32:29 The navigation is relaunched from the renderer by
6171 EXPECT_EQ(start_url, web_contents->GetLastCommittedURL()); 6183 EXPECT_EQ(start_url, web_contents->GetLastCommittedURL());
6172 EXPECT_EQ(0, web_contents->GetController().GetLastCommittedEntryIndex()); 6184 if (IsBrowserSideNavigationEnabled()) {
6185 EXPECT_EQ(3, web_contents->GetController().GetLastCommittedEntryIndex());
6186 EXPECT_EQ(4, web_contents->GetController().GetEntryCount());
6187 }
6188 else {
6189 EXPECT_EQ(0, web_contents->GetController().GetLastCommittedEntryIndex());
6190 EXPECT_EQ(3, web_contents->GetController().GetEntryCount());
6191 }
6173 6192
6174 // Verify the expected origin through JavaScript. It also has the additional 6193 // Verify the expected origin through JavaScript. It also has the additional
6175 // verification of the process also being still alive. 6194 // verification of the process also being still alive.
6176 std::string origin; 6195 std::string origin;
6177 EXPECT_TRUE(ExecuteScriptAndExtractString( 6196 EXPECT_TRUE(ExecuteScriptAndExtractString(
6178 web_contents, "domAutomationController.send(document.origin)", &origin)); 6197 web_contents, "domAutomationController.send(document.origin)", &origin));
6179 EXPECT_EQ(start_url.GetOrigin().spec(), origin + "/"); 6198 EXPECT_EQ(start_url.GetOrigin().spec(), origin + "/");
6180 } 6199 }
6181 6200
6182 // Test that verifies that Referer and Origin http headers are correctly sent 6201 // Test that verifies that Referer and Origin http headers are correctly sent
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
6711 NavigationHandleCommitObserver handle_observer(shell()->web_contents(), 6730 NavigationHandleCommitObserver handle_observer(shell()->web_contents(),
6712 kFragmentURL); 6731 kFragmentURL);
6713 EXPECT_TRUE(NavigateToURL(shell(), kFragmentURL)); 6732 EXPECT_TRUE(NavigateToURL(shell(), kFragmentURL));
6714 6733
6715 EXPECT_TRUE(handle_observer.has_committed()); 6734 EXPECT_TRUE(handle_observer.has_committed());
6716 EXPECT_TRUE(handle_observer.was_same_page()); 6735 EXPECT_TRUE(handle_observer.was_same_page());
6717 EXPECT_FALSE(handle_observer.was_renderer_initiated()); 6736 EXPECT_FALSE(handle_observer.was_renderer_initiated());
6718 } 6737 }
6719 6738
6720 } // namespace content 6739 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698