Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, | |
| 2809 EnsureUniversalAccessFromFileSchemeSucceeds) { | |
| 2810 StartEmbeddedServer(); | |
| 2811 WebContentsImpl* web_contents = | |
| 2812 static_cast<WebContentsImpl*>(shell()->web_contents()); | |
| 2813 FrameTreeNode* root = web_contents->GetFrameTree()->root(); | |
| 2814 | |
| 2815 WebPreferences prefs = | |
| 2816 web_contents->GetRenderViewHost()->GetWebkitPreferences(); | |
| 2817 prefs.allow_universal_access_from_file_urls = true; | |
| 2818 web_contents->GetRenderViewHost()->UpdateWebkitPreferences(prefs); | |
| 2819 | |
| 2820 GURL file_url = GetTestUrl("", "title1.html"); | |
| 2821 ASSERT_TRUE(NavigateToURL(shell(), file_url)); | |
| 2822 EXPECT_EQ(1, web_contents->GetController().GetEntryCount()); | |
| 2823 EXPECT_TRUE(ExecuteScript( | |
| 2824 root, "window.history.pushState({}, '', 'https://chromium.org');")); | |
| 2825 EXPECT_EQ(2, web_contents->GetController().GetEntryCount()); | |
|
Charlie Reis
2016/07/15 22:30:40
Maybe verify that the renderer process is still li
nasko
2016/07/15 22:35:54
Done.
| |
| 2826 } | |
| 2827 | |
| 2805 } // namespace content | 2828 } // namespace content |
| OLD | NEW |