diff options
author | creis <creis@chromium.org> | 2016-01-19 16:10:18 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-20 00:11:29 +0000 |
commit | e435e68cc4368fed6407d205202d39a46d817286 (patch) | |
tree | 8280d02b57d98d8644bb89320db6611abb6d3720 /chrome/browser/browser_commands_unittest.cc | |
parent | dd179e9972f9519611e3e8b99dd174707182bde9 (diff) | |
download | chromium_src-e435e68cc4368fed6407d205202d39a46d817286.zip chromium_src-e435e68cc4368fed6407d205202d39a46d817286.tar.gz chromium_src-e435e68cc4368fed6407d205202d39a46d817286.tar.bz2 |
OOPIF: Fix SetPageState for ViewSource with subframes.
With subframe FrameNavigationEntries enabled, SetPageState creates FNEs
for each session history item in the PageState. It's not meant to be
called after the page has loaded.
However, some callers expect to call it after subframe FNEs already
exist (e.g., after a Clone in ViewSource). For these cases, we need to
clear the current subframe FNEs.
Also update the unit test framework to support AUTO_SUBFRAME commits.
BUG=579134
TEST=No DCHECK for ViewSource with subframe in --site-per-process.
Review URL: https://codereview.chromium.org/1587363006
Cr-Commit-Position: refs/heads/master@{#370230}
Diffstat (limited to 'chrome/browser/browser_commands_unittest.cc')
-rw-r--r-- | chrome/browser/browser_commands_unittest.cc | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/chrome/browser/browser_commands_unittest.cc b/chrome/browser/browser_commands_unittest.cc index 2c39bbb..3679378 100644 --- a/chrome/browser/browser_commands_unittest.cc +++ b/chrome/browser/browser_commands_unittest.cc @@ -21,6 +21,7 @@ #include "content/public/browser/navigation_controller.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/web_contents.h" +#include "content/public/test/test_renderer_host.h" #include "testing/gtest/include/gtest/gtest.h" typedef BrowserWithTestWindowTest BrowserCommandsTest; @@ -107,10 +108,22 @@ TEST_F(BrowserCommandsTest, DuplicateTab) { // Tests IDC_VIEW_SOURCE (See http://crbug.com/138140). TEST_F(BrowserCommandsTest, ViewSource) { GURL url1("http://foo/1"); + GURL url1_subframe("http://foo/subframe"); GURL url2("http://foo/2"); - // Navigate to a URL, plus a pending URL that hasn't committed. + // Navigate to a URL and simulate a subframe committing. AddTab(browser(), url1); + content::RenderFrameHostTester* rfh_tester = + content::RenderFrameHostTester::For( + browser()->tab_strip_model()->GetWebContentsAt(0)->GetMainFrame()); + content::RenderFrameHost* subframe = rfh_tester->AppendChild("subframe"); + content::RenderFrameHostTester* subframe_tester = + content::RenderFrameHostTester::For(subframe); + subframe_tester->SimulateNavigationStart(GURL(url1_subframe)); + subframe_tester->SimulateNavigationCommit(GURL(url1_subframe)); + subframe_tester->SimulateNavigationStop(); + + // Now start a pending navigation that hasn't committed. content::NavigationController& orig_controller = browser()->tab_strip_model()->GetWebContentsAt(0)->GetController(); orig_controller.LoadURL( |