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 <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
473 namespace { | 473 namespace { |
474 | 474 |
475 int RendererHistoryLength(Shell* shell) { | 475 int RendererHistoryLength(Shell* shell) { |
476 int value = 0; | 476 int value = 0; |
477 EXPECT_TRUE(ExecuteScriptAndExtractInt( | 477 EXPECT_TRUE(ExecuteScriptAndExtractInt( |
478 shell, "domAutomationController.send(history.length)", &value)); | 478 shell, "domAutomationController.send(history.length)", &value)); |
479 return value; | 479 return value; |
480 } | 480 } |
481 | 481 |
482 // Similar to the ones from content_browser_test_utils. | 482 // Similar to the ones from content_browser_test_utils. |
483 bool NavigateToURLAndReplace(Shell* shell, const GURL& url) { | 483 bool NavigateToURLAndReplace(Shell* shell, const GURL& url) { |
Charlie Reis
2016/08/08 21:27:11
I'm torn about the name. It sounds a lot like the
nasko
2016/08/08 21:57:08
How about RendererLocationReplace, which follows t
Charlie Reis
2016/08/08 22:06:15
Sounds good, thanks.
| |
484 WebContents* web_contents = shell->web_contents(); | 484 WebContents* web_contents = shell->web_contents(); |
485 WaitForLoadStop(web_contents); | 485 WaitForLoadStop(web_contents); |
486 TestNavigationObserver same_tab_observer(web_contents, 1); | 486 TestNavigationObserver same_tab_observer(web_contents, 1); |
487 NavigationController::LoadURLParams params(url); | 487 EXPECT_TRUE( |
488 params.should_replace_current_entry = true; | 488 ExecuteScript(shell, "window.location.replace('" + url.spec() + "');")); |
489 web_contents->GetController().LoadURLWithParams(params); | |
490 web_contents->Focus(); | |
491 same_tab_observer.Wait(); | 489 same_tab_observer.Wait(); |
492 if (!IsLastCommittedEntryOfPageType(web_contents, PAGE_TYPE_NORMAL)) | 490 if (!IsLastCommittedEntryOfPageType(web_contents, PAGE_TYPE_NORMAL)) |
493 return false; | 491 return false; |
494 return web_contents->GetLastCommittedURL() == url; | 492 return web_contents->GetLastCommittedURL() == url; |
495 } | 493 } |
496 | 494 |
497 } // namespace | 495 } // namespace |
498 | 496 |
499 // When loading a new page to replace an old page in the history list, make sure | 497 // When loading a new page to replace an old page in the history list, make sure |
500 // that the browser and renderer agree, and that both get it right. | 498 // that the browser and renderer agree, and that both get it right. |
(...skipping 5109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5610 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) { | 5608 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) { |
5611 EXPECT_EQ(1U, nav_entry->root_node()->children.size()); | 5609 EXPECT_EQ(1U, nav_entry->root_node()->children.size()); |
5612 EXPECT_EQ(tree_node, nav_entry->root_node()->children[0]); | 5610 EXPECT_EQ(tree_node, nav_entry->root_node()->children[0]); |
5613 } | 5611 } |
5614 | 5612 |
5615 EXPECT_TRUE(ExecuteScript(root, kRemoveFrameScript)); | 5613 EXPECT_TRUE(ExecuteScript(root, kRemoveFrameScript)); |
5616 EXPECT_EQ(0U, root->child_count()); | 5614 EXPECT_EQ(0U, root->child_count()); |
5617 } | 5615 } |
5618 | 5616 |
5619 } // namespace content | 5617 } // namespace content |
OLD | NEW |