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

Side by Side Diff: content/browser/site_per_process_browsertest.cc

Issue 558943002: Revert of Cross-process iframe accessibility. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/site_per_process_browsertest.h"
6
7 #include "base/command_line.h" 5 #include "base/command_line.h"
8 #include "base/strings/stringprintf.h" 6 #include "base/strings/stringprintf.h"
9 #include "content/browser/frame_host/cross_process_frame_connector.h" 7 #include "content/browser/frame_host/cross_process_frame_connector.h"
10 #include "content/browser/frame_host/frame_tree.h" 8 #include "content/browser/frame_host/frame_tree.h"
11 #include "content/browser/frame_host/render_frame_proxy_host.h" 9 #include "content/browser/frame_host/render_frame_proxy_host.h"
12 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" 10 #include "content/browser/frame_host/render_widget_host_view_child_frame.h"
13 #include "content/browser/renderer_host/render_view_host_impl.h" 11 #include "content/browser/renderer_host/render_view_host_impl.h"
14 #include "content/browser/web_contents/web_contents_impl.h" 12 #include "content/browser/web_contents/web_contents_impl.h"
15 #include "content/public/browser/notification_observer.h" 13 #include "content/public/browser/notification_observer.h"
16 #include "content/public/browser/notification_service.h" 14 #include "content/public/browser/notification_service.h"
17 #include "content/public/browser/notification_types.h" 15 #include "content/public/browser/notification_types.h"
18 #include "content/public/browser/web_contents_observer.h" 16 #include "content/public/browser/web_contents_observer.h"
19 #include "content/public/common/content_switches.h" 17 #include "content/public/common/content_switches.h"
20 #include "content/public/test/browser_test_utils.h" 18 #include "content/public/test/browser_test_utils.h"
19 #include "content/public/test/content_browser_test.h"
21 #include "content/public/test/content_browser_test_utils.h" 20 #include "content/public/test/content_browser_test_utils.h"
22 #include "content/public/test/test_utils.h" 21 #include "content/public/test/test_utils.h"
23 #include "content/shell/browser/shell.h" 22 #include "content/shell/browser/shell.h"
24 #include "content/test/content_browser_test_utils_internal.h" 23 #include "content/test/content_browser_test_utils_internal.h"
25 #include "net/dns/mock_host_resolver.h" 24 #include "net/dns/mock_host_resolver.h"
25 #include "url/gurl.h"
26 26
27 namespace content { 27 namespace content {
28 28
29 class SitePerProcessWebContentsObserver: public WebContentsObserver { 29 class SitePerProcessWebContentsObserver: public WebContentsObserver {
30 public: 30 public:
31 explicit SitePerProcessWebContentsObserver(WebContents* web_contents) 31 explicit SitePerProcessWebContentsObserver(WebContents* web_contents)
32 : WebContentsObserver(web_contents), 32 : WebContentsObserver(web_contents),
33 navigation_succeeded_(false) {} 33 navigation_succeeded_(false) {}
34 virtual ~SitePerProcessWebContentsObserver() {} 34 virtual ~SitePerProcessWebContentsObserver() {}
35 35
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 details_ = details; 142 details_ = details;
143 seen_twice_ = seen_; 143 seen_twice_ = seen_;
144 seen_ = true; 144 seen_ = true;
145 if (!running_) 145 if (!running_)
146 return; 146 return;
147 147
148 message_loop_runner_->Quit(); 148 message_loop_runner_->Quit();
149 running_ = false; 149 running_ = false;
150 } 150 }
151 151
152 // 152 class SitePerProcessBrowserTest : public ContentBrowserTest {
153 // SitePerProcessBrowserTest 153 public:
154 // 154 SitePerProcessBrowserTest() {}
155 155
156 SitePerProcessBrowserTest::SitePerProcessBrowserTest() { 156 protected:
157 }; 157 // Start at a data URL so each extra navigation creates a navigation entry.
158 158 // (The first navigation will silently be classified as AUTO_SUBFRAME.)
159 void SitePerProcessBrowserTest::StartFrameAtDataURL() { 159 // TODO(creis): This won't be necessary when we can wait for LOAD_STOP.
160 std::string data_url_script = 160 void StartFrameAtDataURL() {
161 std::string data_url_script =
161 "var iframes = document.getElementById('test');iframes.src=" 162 "var iframes = document.getElementById('test');iframes.src="
162 "'data:text/html,dataurl';"; 163 "'data:text/html,dataurl';";
163 ASSERT_TRUE(ExecuteScript(shell()->web_contents(), data_url_script)); 164 ASSERT_TRUE(ExecuteScript(shell()->web_contents(), data_url_script));
164 } 165 }
165 166
166 bool SitePerProcessBrowserTest::NavigateIframeToURL(Shell* window, 167 bool NavigateIframeToURL(Shell* window,
167 const GURL& url, 168 const GURL& url,
168 std::string iframe_id) { 169 std::string iframe_id) {
169 // TODO(creis): This should wait for LOAD_STOP, but cross-site subframe 170 // TODO(creis): This should wait for LOAD_STOP, but cross-site subframe
170 // navigations generate extra DidStartLoading and DidStopLoading messages. 171 // navigations generate extra DidStartLoading and DidStopLoading messages.
171 // Until we replace swappedout:// with frame proxies, we need to listen for 172 // Until we replace swappedout:// with frame proxies, we need to listen for
172 // something else. For now, we trigger NEW_SUBFRAME navigations and listen 173 // something else. For now, we trigger NEW_SUBFRAME navigations and listen
173 // for commit. 174 // for commit.
174 std::string script = base::StringPrintf( 175 std::string script = base::StringPrintf(
175 "setTimeout(\"" 176 "setTimeout(\""
176 "var iframes = document.getElementById('%s');iframes.src='%s';" 177 "var iframes = document.getElementById('%s');iframes.src='%s';"
177 "\",0)", 178 "\",0)",
178 iframe_id.c_str(), url.spec().c_str()); 179 iframe_id.c_str(), url.spec().c_str());
179 WindowedNotificationObserver load_observer( 180 WindowedNotificationObserver load_observer(
180 NOTIFICATION_NAV_ENTRY_COMMITTED, 181 NOTIFICATION_NAV_ENTRY_COMMITTED,
181 Source<NavigationController>( 182 Source<NavigationController>(
182 &window->web_contents()->GetController())); 183 &window->web_contents()->GetController()));
183 bool result = ExecuteScript(window->web_contents(), script); 184 bool result = ExecuteScript(window->web_contents(), script);
184 load_observer.Wait(); 185 load_observer.Wait();
185 return result; 186 return result;
186 } 187 }
187 188
188 void SitePerProcessBrowserTest::SetUpCommandLine(CommandLine* command_line) { 189 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
189 command_line->AppendSwitch(switches::kSitePerProcess); 190 command_line->AppendSwitch(switches::kSitePerProcess);
191 }
190 }; 192 };
191 193
192 // Ensure that we can complete a cross-process subframe navigation. 194 // Ensure that we can complete a cross-process subframe navigation.
193 // Crashes ChromeOS bot, but the bug is probably present on other platforms 195 // Crashes ChromeOS bot, but the bug is probably present on other platforms
194 // also. http://crbug.com/399775 196 // also. http://crbug.com/399775
195 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, DISABLED_CrossSiteIframe) { 197 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, DISABLED_CrossSiteIframe) {
196 host_resolver()->AddRule("*", "127.0.0.1"); 198 host_resolver()->AddRule("*", "127.0.0.1");
197 ASSERT_TRUE(test_server()->Start()); 199 ASSERT_TRUE(test_server()->Start());
198 GURL main_url(test_server()->GetURL("files/site_per_process_main.html")); 200 GURL main_url(test_server()->GetURL("files/site_per_process_main.html"));
199 NavigateToURL(shell(), main_url); 201 NavigateToURL(shell(), main_url);
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 "server-redirect?" + client_redirect_http_url.spec())); 560 "server-redirect?" + client_redirect_http_url.spec()));
559 EXPECT_TRUE(NavigateIframeToURL(shell(), server_redirect_http_url, "test")); 561 EXPECT_TRUE(NavigateIframeToURL(shell(), server_redirect_http_url, "test"));
560 562
561 // DidFailProvisionalLoad when navigating to client_redirect_http_url. 563 // DidFailProvisionalLoad when navigating to client_redirect_http_url.
562 EXPECT_EQ(observer.navigation_url(), client_redirect_http_url); 564 EXPECT_EQ(observer.navigation_url(), client_redirect_http_url);
563 EXPECT_FALSE(observer.navigation_succeeded()); 565 EXPECT_FALSE(observer.navigation_succeeded());
564 } 566 }
565 } 567 }
566 568
567 } // namespace content 569 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/site_per_process_browsertest.h ('k') | content/browser/web_contents/web_contents_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698