OLD | NEW |
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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/stringprintf.h" | 6 #include "base/stringprintf.h" |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "content/browser/web_contents/web_contents_impl.h" | 8 #include "content/browser/web_contents/web_contents_impl.h" |
9 #include "content/public/browser/notification_observer.h" | 9 #include "content/public/browser/notification_observer.h" |
10 #include "content/public/browser/notification_service.h" | 10 #include "content/public/browser/notification_service.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 bool NavigateIframeToURL(Shell* window, | 145 bool NavigateIframeToURL(Shell* window, |
146 const GURL& url, | 146 const GURL& url, |
147 std::string iframe_id) { | 147 std::string iframe_id) { |
148 std::string script = base::StringPrintf( | 148 std::string script = base::StringPrintf( |
149 "var iframes = document.getElementById('%s');iframes.src='%s';", | 149 "var iframes = document.getElementById('%s');iframes.src='%s';", |
150 iframe_id.c_str(), url.spec().c_str()); | 150 iframe_id.c_str(), url.spec().c_str()); |
151 WindowedNotificationObserver load_observer( | 151 WindowedNotificationObserver load_observer( |
152 NOTIFICATION_LOAD_STOP, | 152 NOTIFICATION_LOAD_STOP, |
153 Source<NavigationController>( | 153 Source<NavigationController>( |
154 &shell()->web_contents()->GetController())); | 154 &shell()->web_contents()->GetController())); |
155 bool result = ExecuteJavaScript(window->web_contents()->GetRenderViewHost(), | 155 bool result = ExecuteScript(window->web_contents(), script); |
156 "", script); | |
157 load_observer.Wait(); | 156 load_observer.Wait(); |
158 return result; | 157 return result; |
159 } | 158 } |
160 | 159 |
161 void SetUpCommandLine(CommandLine* command_line) { | 160 void SetUpCommandLine(CommandLine* command_line) { |
162 command_line->AppendSwitch(switches::kSitePerProcess); | 161 command_line->AppendSwitch(switches::kSitePerProcess); |
163 } | 162 } |
164 }; | 163 }; |
165 | 164 |
166 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CrossSiteIframe) { | 165 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CrossSiteIframe) { |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 "server-redirect?" + client_redirect_http_url.spec())); | 386 "server-redirect?" + client_redirect_http_url.spec())); |
388 EXPECT_TRUE(NavigateIframeToURL(shell(), server_redirect_http_url, "test")); | 387 EXPECT_TRUE(NavigateIframeToURL(shell(), server_redirect_http_url, "test")); |
389 | 388 |
390 // DidFailProvisionalLoad when navigating to client_redirect_http_url. | 389 // DidFailProvisionalLoad when navigating to client_redirect_http_url. |
391 EXPECT_EQ(observer.navigation_url(), client_redirect_http_url); | 390 EXPECT_EQ(observer.navigation_url(), client_redirect_http_url); |
392 EXPECT_FALSE(observer.navigation_succeeded()); | 391 EXPECT_FALSE(observer.navigation_succeeded()); |
393 } | 392 } |
394 } | 393 } |
395 | 394 |
396 } | 395 } |
OLD | NEW |