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

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

Issue 2093123002: Make RestoreSubframeFileAccessForHistoryNavigation pass in OOPIF modes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test expectations. Created 4 years, 6 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
« no previous file with comments | « no previous file | testing/buildbot/filters/isolate-extensions.content_browsertests.filter » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <memory> 8 #include <memory>
9 #include <set> 9 #include <set>
10 10
(...skipping 1997 matching lines...) Expand 10 before | Expand all | Expand 10 after
2008 shell()->web_contents()->SetDelegate(delegate.get()); 2008 shell()->web_contents()->SetDelegate(delegate.get());
2009 EXPECT_TRUE(ExecuteScript(root->child_at(0), 2009 EXPECT_TRUE(ExecuteScript(root->child_at(0),
2010 "document.getElementById('fileinput').click();")); 2010 "document.getElementById('fileinput').click();"));
2011 EXPECT_TRUE(delegate->file_chosen()); 2011 EXPECT_TRUE(delegate->file_chosen());
2012 EXPECT_TRUE(ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile( 2012 EXPECT_TRUE(ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile(
2013 process_id, file)); 2013 process_id, file));
2014 2014
2015 // Disable the swap out timer so we wait for the UpdateState message. 2015 // Disable the swap out timer so we wait for the UpdateState message.
2016 root->current_frame_host()->DisableSwapOutTimerForTesting(); 2016 root->current_frame_host()->DisableSwapOutTimerForTesting();
2017 2017
2018 // Do an in-page navigation in the child to make sure we hear a PageState with
2019 // the chosen file before the subframe's FrameTreeNode is deleted. In
2020 // practice, we'll get the PageState 1 second after the file is chosen.
2021 // TODO(creis): Remove this in-page navigation once we keep track of
2022 // FrameTreeNodes that are pending deletion. See https://crbug.com/609963.
2023 {
2024 TestNavigationObserver nav_observer(shell()->web_contents());
2025 std::string script = "location.href='#foo';";
2026 EXPECT_TRUE(ExecuteScript(root->child_at(0), script));
2027 nav_observer.Wait();
2028 }
2029
2018 // Navigate to a different process without access to the file, and wait for 2030 // Navigate to a different process without access to the file, and wait for
2019 // the old process to exit. 2031 // the old process to exit.
2020 RenderProcessHostWatcher exit_observer( 2032 RenderProcessHostWatcher exit_observer(
2021 shell()->web_contents()->GetRenderProcessHost(), 2033 shell()->web_contents()->GetRenderProcessHost(),
2022 RenderProcessHostWatcher::WATCH_FOR_HOST_DESTRUCTION); 2034 RenderProcessHostWatcher::WATCH_FOR_HOST_DESTRUCTION);
2023 NavigateToURL(shell(), GetCrossSiteURL("/title1.html")); 2035 NavigateToURL(shell(), GetCrossSiteURL("/title1.html"));
2024 exit_observer.Wait(); 2036 exit_observer.Wait();
2025 EXPECT_FALSE(ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile( 2037 EXPECT_FALSE(ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile(
2026 shell()->web_contents()->GetRenderProcessHost()->GetID(), file)); 2038 shell()->web_contents()->GetRenderProcessHost()->GetID(), file));
2027 2039
2028 // Ensure that the file ended up in the PageState of the previous entry. 2040 // Ensure that the file ended up in the PageState of the previous entry.
2029 NavigationEntry* prev_entry = 2041 NavigationEntry* prev_entry =
2030 shell()->web_contents()->GetController().GetEntryAtIndex(0); 2042 shell()->web_contents()->GetController().GetEntryAtIndex(0);
2031 EXPECT_EQ(url1, prev_entry->GetURL()); 2043 EXPECT_EQ(url1, prev_entry->GetURL());
2032 const std::vector<base::FilePath>& files = 2044 const std::vector<base::FilePath>& files =
2033 prev_entry->GetPageState().GetReferencedFiles(); 2045 prev_entry->GetPageState().GetReferencedFiles();
2034 ASSERT_EQ(1U, files.size()); 2046 ASSERT_EQ(1U, files.size());
2035 EXPECT_EQ(file, files.at(0)); 2047 EXPECT_EQ(file, files.at(0));
2036 2048
2037 // Go back, ending up in a different RenderProcessHost than before. 2049 // Go back, ending up in a different RenderProcessHost than before.
2038 TestNavigationObserver back_nav_load_observer(shell()->web_contents()); 2050 TestNavigationObserver back_nav_load_observer(shell()->web_contents());
2039 shell()->web_contents()->GetController().GoBack(); 2051 shell()->web_contents()->GetController().GoToIndex(0);
2040 back_nav_load_observer.Wait(); 2052 back_nav_load_observer.Wait();
2041 EXPECT_NE(process_id, 2053 EXPECT_NE(process_id,
2042 shell()->web_contents()->GetRenderProcessHost()->GetID()); 2054 shell()->web_contents()->GetRenderProcessHost()->GetID());
2043 2055
2044 // Ensure that the file access still exists in the new process ID. 2056 // Ensure that the file access still exists in the new process ID.
2045 EXPECT_TRUE(ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile( 2057 EXPECT_TRUE(ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile(
2046 shell()->web_contents()->GetRenderProcessHost()->GetID(), file)); 2058 shell()->web_contents()->GetRenderProcessHost()->GetID(), file));
2047 } 2059 }
2048 2060
2049 // Ensures that no RenderFrameHost/RenderViewHost objects are leaked when 2061 // Ensures that no RenderFrameHost/RenderViewHost objects are leaked when
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
2784 TestNavigationObserver commit_observer(web_contents); 2796 TestNavigationObserver commit_observer(web_contents);
2785 shell()->LoadURL(embedded_test_server()->GetURL("b.com", "/title1.html")); 2797 shell()->LoadURL(embedded_test_server()->GetURL("b.com", "/title1.html"));
2786 commit_observer.Wait(); 2798 commit_observer.Wait();
2787 exit_observer.Wait(); 2799 exit_observer.Wait();
2788 2800
2789 // Ensure the entry's title hasn't changed after the ignored commit. 2801 // Ensure the entry's title hasn't changed after the ignored commit.
2790 EXPECT_EQ(title, entry->GetTitle()); 2802 EXPECT_EQ(title, entry->GetTitle());
2791 } 2803 }
2792 2804
2793 } // namespace content 2805 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | testing/buildbot/filters/isolate-extensions.content_browsertests.filter » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698