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

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

Issue 2151323003: Add a check for mismatching URL and origin in the renderer process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Disable the test on Mac, until more debugging can be done. Created 4 years, 5 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 | content/renderer/render_frame_impl.cc » ('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 23 matching lines...) Expand all
34 #include "content/public/browser/render_process_host.h" 34 #include "content/public/browser/render_process_host.h"
35 #include "content/public/browser/resource_dispatcher_host.h" 35 #include "content/public/browser/resource_dispatcher_host.h"
36 #include "content/public/browser/web_contents.h" 36 #include "content/public/browser/web_contents.h"
37 #include "content/public/browser/web_contents_observer.h" 37 #include "content/public/browser/web_contents_observer.h"
38 #include "content/public/browser/web_ui_message_handler.h" 38 #include "content/public/browser/web_ui_message_handler.h"
39 #include "content/public/common/bindings_policy.h" 39 #include "content/public/common/bindings_policy.h"
40 #include "content/public/common/browser_side_navigation_policy.h" 40 #include "content/public/common/browser_side_navigation_policy.h"
41 #include "content/public/common/content_switches.h" 41 #include "content/public/common/content_switches.h"
42 #include "content/public/common/page_state.h" 42 #include "content/public/common/page_state.h"
43 #include "content/public/common/url_constants.h" 43 #include "content/public/common/url_constants.h"
44 #include "content/public/common/web_preferences.h"
44 #include "content/public/test/browser_test_utils.h" 45 #include "content/public/test/browser_test_utils.h"
45 #include "content/public/test/content_browser_test.h" 46 #include "content/public/test/content_browser_test.h"
46 #include "content/public/test/content_browser_test_utils.h" 47 #include "content/public/test/content_browser_test_utils.h"
47 #include "content/public/test/test_navigation_observer.h" 48 #include "content/public/test/test_navigation_observer.h"
48 #include "content/public/test/test_utils.h" 49 #include "content/public/test/test_utils.h"
49 #include "content/shell/browser/shell.h" 50 #include "content/shell/browser/shell.h"
50 #include "content/test/content_browser_test_utils_internal.h" 51 #include "content/test/content_browser_test_utils_internal.h"
51 #include "content/test/test_frame_navigation_observer.h" 52 #include "content/test/test_frame_navigation_observer.h"
52 #include "net/dns/mock_host_resolver.h" 53 #include "net/dns/mock_host_resolver.h"
53 #include "net/test/embedded_test_server/embedded_test_server.h" 54 #include "net/test/embedded_test_server/embedded_test_server.h"
(...skipping 2741 matching lines...) Expand 10 before | Expand all | Expand 10 after
2795 rfh_a->GetProcess(), RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); 2796 rfh_a->GetProcess(), RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
2796 TestNavigationObserver commit_observer(web_contents); 2797 TestNavigationObserver commit_observer(web_contents);
2797 shell()->LoadURL(embedded_test_server()->GetURL("b.com", "/title1.html")); 2798 shell()->LoadURL(embedded_test_server()->GetURL("b.com", "/title1.html"));
2798 commit_observer.Wait(); 2799 commit_observer.Wait();
2799 exit_observer.Wait(); 2800 exit_observer.Wait();
2800 2801
2801 // Ensure the entry's title hasn't changed after the ignored commit. 2802 // Ensure the entry's title hasn't changed after the ignored commit.
2802 EXPECT_EQ(title, entry->GetTitle()); 2803 EXPECT_EQ(title, entry->GetTitle());
2803 } 2804 }
2804 2805
2806 // Ensure that document hosted on file: URL can successfully execute pushState
2807 // with arbitrary origin, when universal access setting is enabled.
2808 // TODO(nasko): The test is disabled on Mac, since universal access from file
2809 // scheme behaves differently.
2810 #if defined(OS_MACOSX)
2811 #define MAYBE_EnsureUniversalAccessFromFileSchemeSucceeds \
2812 DISABLED_EnsureUniversalAccessFromFileSchemeSucceeds
2813 #else
2814 #define MAYBE_EnsureUniversalAccessFromFileSchemeSucceeds \
2815 EnsureUniversalAccessFromFileSchemeSucceeds
2816 #endif
2817 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest,
2818 MAYBE_EnsureUniversalAccessFromFileSchemeSucceeds) {
2819 StartEmbeddedServer();
2820 WebContentsImpl* web_contents =
2821 static_cast<WebContentsImpl*>(shell()->web_contents());
2822 FrameTreeNode* root = web_contents->GetFrameTree()->root();
2823
2824 WebPreferences prefs =
2825 web_contents->GetRenderViewHost()->GetWebkitPreferences();
2826 prefs.allow_universal_access_from_file_urls = true;
2827 web_contents->GetRenderViewHost()->UpdateWebkitPreferences(prefs);
2828
2829 GURL file_url = GetTestUrl("", "title1.html");
2830 ASSERT_TRUE(NavigateToURL(shell(), file_url));
2831 EXPECT_EQ(1, web_contents->GetController().GetEntryCount());
2832 EXPECT_TRUE(ExecuteScript(
2833 root, "window.history.pushState({}, '', 'https://chromium.org');"));
2834 EXPECT_EQ(2, web_contents->GetController().GetEntryCount());
2835 EXPECT_TRUE(web_contents->GetMainFrame()->IsRenderFrameLive());
2836 }
2837
2805 } // namespace content 2838 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698