| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/strings/stringprintf.h" | 6 #include "base/strings/stringprintf.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "content/browser/accessibility/browser_accessibility.h" | 8 #include "content/browser/accessibility/browser_accessibility.h" |
| 9 #include "content/browser/accessibility/browser_accessibility_manager.h" | 9 #include "content/browser/accessibility/browser_accessibility_manager.h" |
| 10 #include "content/browser/accessibility/browser_accessibility_state_impl.h" | 10 #include "content/browser/accessibility/browser_accessibility_state_impl.h" |
| 11 #include "content/browser/frame_host/cross_process_frame_connector.h" | 11 #include "content/browser/frame_host/cross_process_frame_connector.h" |
| 12 #include "content/browser/frame_host/frame_tree.h" | 12 #include "content/browser/frame_host/frame_tree.h" |
| 13 #include "content/browser/frame_host/render_frame_proxy_host.h" | 13 #include "content/browser/frame_host/render_frame_proxy_host.h" |
| 14 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" | 14 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
| 15 #include "content/browser/renderer_host/render_view_host_impl.h" | 15 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 16 #include "content/browser/site_per_process_browsertest.h" | 16 #include "content/browser/site_per_process_browsertest.h" |
| 17 #include "content/browser/web_contents/web_contents_impl.h" | 17 #include "content/browser/web_contents/web_contents_impl.h" |
| 18 #include "content/public/browser/notification_observer.h" | 18 #include "content/public/browser/notification_observer.h" |
| 19 #include "content/public/browser/notification_service.h" | 19 #include "content/public/browser/notification_service.h" |
| 20 #include "content/public/browser/notification_types.h" | 20 #include "content/public/browser/notification_types.h" |
| 21 #include "content/public/browser/web_contents_observer.h" | 21 #include "content/public/browser/web_contents_observer.h" |
| 22 #include "content/public/common/content_switches.h" | 22 #include "content/public/common/content_switches.h" |
| 23 #include "content/public/test/content_browser_test.h" | 23 #include "content/public/test/content_browser_test.h" |
| 24 #include "content/public/test/content_browser_test_utils.h" | 24 #include "content/public/test/content_browser_test_utils.h" |
| 25 #include "content/public/test/test_utils.h" | 25 #include "content/public/test/test_utils.h" |
| 26 #include "content/shell/browser/shell.h" | 26 #include "content/shell/browser/shell.h" |
| 27 #include "content/test/accessibility_browser_test_utils.h" | 27 #include "content/test/accessibility_browser_test_utils.h" |
| 28 #include "content/test/content_browser_test_utils_internal.h" | 28 #include "content/test/content_browser_test_utils_internal.h" |
| 29 #include "net/dns/mock_host_resolver.h" | 29 #include "net/dns/mock_host_resolver.h" |
| 30 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 30 #include "url/gurl.h" | 31 #include "url/gurl.h" |
| 31 #include "url/url_constants.h" | 32 #include "url/url_constants.h" |
| 32 | 33 |
| 33 namespace content { | 34 namespace content { |
| 34 | 35 |
| 35 class SitePerProcessAccessibilityBrowserTest | 36 class SitePerProcessAccessibilityBrowserTest |
| 36 : public SitePerProcessBrowserTest { | 37 : public SitePerProcessBrowserTest { |
| 37 public: | 38 public: |
| 38 SitePerProcessAccessibilityBrowserTest() {} | 39 SitePerProcessAccessibilityBrowserTest() {} |
| 39 }; | 40 }; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 62 #define MAYBE_CrossSiteIframeAccessibility DISABLED_CrossSiteIframeAccessibility | 63 #define MAYBE_CrossSiteIframeAccessibility DISABLED_CrossSiteIframeAccessibility |
| 63 #else | 64 #else |
| 64 #define MAYBE_CrossSiteIframeAccessibility CrossSiteIframeAccessibility | 65 #define MAYBE_CrossSiteIframeAccessibility CrossSiteIframeAccessibility |
| 65 #endif | 66 #endif |
| 66 IN_PROC_BROWSER_TEST_F(SitePerProcessAccessibilityBrowserTest, | 67 IN_PROC_BROWSER_TEST_F(SitePerProcessAccessibilityBrowserTest, |
| 67 MAYBE_CrossSiteIframeAccessibility) { | 68 MAYBE_CrossSiteIframeAccessibility) { |
| 68 // Enable full accessibility for all current and future WebContents. | 69 // Enable full accessibility for all current and future WebContents. |
| 69 BrowserAccessibilityState::GetInstance()->EnableAccessibility(); | 70 BrowserAccessibilityState::GetInstance()->EnableAccessibility(); |
| 70 | 71 |
| 71 host_resolver()->AddRule("*", "127.0.0.1"); | 72 host_resolver()->AddRule("*", "127.0.0.1"); |
| 72 ASSERT_TRUE(test_server()->Start()); | 73 GURL main_url(embedded_test_server()->GetURL("/site_per_process_main.html")); |
| 73 GURL main_url(test_server()->GetURL("files/site_per_process_main.html")); | |
| 74 NavigateToURL(shell(), main_url); | 74 NavigateToURL(shell(), main_url); |
| 75 | 75 |
| 76 // It is safe to obtain the root frame tree node here, as it doesn't change. | 76 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 77 FrameTreeNode* root = | 77 FrameTreeNode* root = |
| 78 static_cast<WebContentsImpl*>(shell()->web_contents())-> | 78 static_cast<WebContentsImpl*>(shell()->web_contents())-> |
| 79 GetFrameTree()->root(); | 79 GetFrameTree()->root(); |
| 80 | 80 |
| 81 // Load same-site page into iframe. | 81 // Load same-site page into iframe. |
| 82 FrameTreeNode* child = root->child_at(0); | 82 FrameTreeNode* child = root->child_at(0); |
| 83 GURL http_url(test_server()->GetURL("files/title1.html")); | 83 GURL http_url(embedded_test_server()->GetURL("/title1.html")); |
| 84 NavigateFrameToURL(child, http_url); | 84 NavigateFrameToURL(child, http_url); |
| 85 | 85 |
| 86 // Load cross-site page into iframe. | 86 // Load cross-site page into iframe. |
| 87 RenderFrameHostImpl* child_rfh = | 87 RenderFrameHostImpl* child_rfh = |
| 88 child->render_manager()->current_frame_host(); | 88 child->render_manager()->current_frame_host(); |
| 89 RenderFrameDeletedObserver deleted_observer(child_rfh); | 89 RenderFrameDeletedObserver deleted_observer(child_rfh); |
| 90 GURL::Replacements replace_host; | 90 GURL::Replacements replace_host; |
| 91 GURL cross_site_url(test_server()->GetURL("files/title2.html")); | 91 GURL cross_site_url(embedded_test_server()->GetURL("/title2.html")); |
| 92 replace_host.SetHostStr("foo.com"); | 92 replace_host.SetHostStr("foo.com"); |
| 93 cross_site_url = cross_site_url.ReplaceComponents(replace_host); | 93 cross_site_url = cross_site_url.ReplaceComponents(replace_host); |
| 94 NavigateFrameToURL(root->child_at(0), cross_site_url); | 94 NavigateFrameToURL(root->child_at(0), cross_site_url); |
| 95 | 95 |
| 96 // Ensure that we have created a new process for the subframe. | 96 // Ensure that we have created a new process for the subframe. |
| 97 ASSERT_EQ(2U, root->child_count()); | 97 ASSERT_EQ(2U, root->child_count()); |
| 98 SiteInstance* site_instance = child->current_frame_host()->GetSiteInstance(); | 98 SiteInstance* site_instance = child->current_frame_host()->GetSiteInstance(); |
| 99 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), site_instance); | 99 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), site_instance); |
| 100 | 100 |
| 101 // Wait until the iframe completes the swap. | 101 // Wait until the iframe completes the swap. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 BrowserAccessibility* ax_child_frame_static_text = | 146 BrowserAccessibility* ax_child_frame_static_text = |
| 147 ax_child_frame_group->PlatformGetChild(0); | 147 ax_child_frame_group->PlatformGetChild(0); |
| 148 EXPECT_EQ(ui::AX_ROLE_STATIC_TEXT, ax_child_frame_static_text->GetRole()); | 148 EXPECT_EQ(ui::AX_ROLE_STATIC_TEXT, ax_child_frame_static_text->GetRole()); |
| 149 ASSERT_EQ(0U, ax_child_frame_static_text->PlatformChildCount()); | 149 ASSERT_EQ(0U, ax_child_frame_static_text->PlatformChildCount()); |
| 150 | 150 |
| 151 // Last, check that the parent of the child frame root is correct. | 151 // Last, check that the parent of the child frame root is correct. |
| 152 EXPECT_EQ(ax_child_frame_root->GetParent(), ax_iframe); | 152 EXPECT_EQ(ax_child_frame_root->GetParent(), ax_iframe); |
| 153 } | 153 } |
| 154 | 154 |
| 155 } // namespace content | 155 } // namespace content |
| OLD | NEW |