Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 6148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6159 web_contents->GetMainFrame()->GetProcess()->AddFilter(filter.get()); | 6159 web_contents->GetMainFrame()->GetProcess()->AddFilter(filter.get()); |
| 6160 | 6160 |
| 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 if (IsBrowserSideNavigationEnabled()) { | |
| 6170 // With browser-side-navigation, the history navigation is dropped. | |
|
nasko
2017/01/13 02:51:09
I thought the discussion we had concluded that we
arthursonzogni
2017/01/13 15:18:37
It's difficult to relaunch every navigations. I ha
nasko
2017/01/13 19:36:56
Why would you need to relaunch every navigation? I
clamy
2017/01/16 12:16:11
In order to properly resolve it as a different doc
| |
| 6171 // Verify the expected origin through JavaScript. It also has the additional | |
|
nasko
2017/01/13 02:51:09
This comment doesn't seem correct, as the code doe
arthursonzogni
2017/01/13 15:18:37
Done.
| |
| 6172 // verification of the process also being still alive. | |
| 6173 std::string is_alive; | |
| 6174 EXPECT_TRUE(ExecuteScriptAndExtractString( | |
| 6175 web_contents, "domAutomationController.send('alive')", &is_alive)); | |
| 6176 EXPECT_EQ("alive", is_alive); | |
| 6177 EXPECT_EQ(2, web_contents->GetController().GetLastCommittedEntryIndex()); | |
| 6178 EXPECT_EQ(3, web_contents->GetController().GetEntryCount()); | |
| 6179 return; | |
|
nasko
2017/01/13 02:51:09
Let's use an else block so it is more clear that t
arthursonzogni
2017/01/13 15:18:37
Done.
| |
| 6180 } | |
| 6169 // Wait for the back navigation to commit as well. | 6181 // Wait for the back navigation to commit as well. |
| 6170 history_commit_observer.Wait(); | 6182 history_commit_observer.Wait(); |
| 6171 EXPECT_EQ(start_url, web_contents->GetLastCommittedURL()); | 6183 |
|
nasko
2017/01/13 02:51:09
Why drop this expectation?
arthursonzogni
2017/01/13 15:18:37
It's a mistake, thanks!
| |
| 6172 EXPECT_EQ(0, web_contents->GetController().GetLastCommittedEntryIndex()); | 6184 EXPECT_EQ(0, web_contents->GetController().GetLastCommittedEntryIndex()); |
| 6185 EXPECT_EQ(3, web_contents->GetController().GetEntryCount()); | |
| 6173 | 6186 |
| 6174 // Verify the expected origin through JavaScript. It also has the additional | 6187 // Verify the expected origin through JavaScript. It also has the additional |
| 6175 // verification of the process also being still alive. | 6188 // verification of the process also being still alive. |
| 6176 std::string origin; | 6189 std::string origin; |
| 6177 EXPECT_TRUE(ExecuteScriptAndExtractString( | 6190 EXPECT_TRUE(ExecuteScriptAndExtractString( |
| 6178 web_contents, "domAutomationController.send(document.origin)", &origin)); | 6191 web_contents, "domAutomationController.send(document.origin)", &origin)); |
| 6179 EXPECT_EQ(start_url.GetOrigin().spec(), origin + "/"); | 6192 EXPECT_EQ(start_url.GetOrigin().spec(), origin + "/"); |
| 6180 } | 6193 } |
| 6181 | 6194 |
| 6182 // Test that verifies that Referer and Origin http headers are correctly sent | 6195 // Test that verifies that Referer and Origin http headers are correctly sent |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6711 NavigationHandleCommitObserver handle_observer(shell()->web_contents(), | 6724 NavigationHandleCommitObserver handle_observer(shell()->web_contents(), |
| 6712 kFragmentURL); | 6725 kFragmentURL); |
| 6713 EXPECT_TRUE(NavigateToURL(shell(), kFragmentURL)); | 6726 EXPECT_TRUE(NavigateToURL(shell(), kFragmentURL)); |
| 6714 | 6727 |
| 6715 EXPECT_TRUE(handle_observer.has_committed()); | 6728 EXPECT_TRUE(handle_observer.has_committed()); |
| 6716 EXPECT_TRUE(handle_observer.was_same_page()); | 6729 EXPECT_TRUE(handle_observer.was_same_page()); |
| 6717 EXPECT_FALSE(handle_observer.was_renderer_initiated()); | 6730 EXPECT_FALSE(handle_observer.was_renderer_initiated()); |
| 6718 } | 6731 } |
| 6719 | 6732 |
| 6720 } // namespace content | 6733 } // namespace content |
| OLD | NEW |