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 <list> | 5 #include <list> |
6 #include <set> | 6 #include <set> |
7 | 7 |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 const GURL& validated_url, | 206 const GURL& validated_url, |
207 bool is_error_page, | 207 bool is_error_page, |
208 bool is_iframe_srcdoc) override { | 208 bool is_iframe_srcdoc) override { |
209 if (validated_url != delay_url_ || !rvh_) | 209 if (validated_url != delay_url_ || !rvh_) |
210 return; | 210 return; |
211 | 211 |
212 if (has_user_gesture_) { | 212 if (has_user_gesture_) { |
213 rvh_->GetMainFrame()->ExecuteJavaScriptWithUserGestureForTests( | 213 rvh_->GetMainFrame()->ExecuteJavaScriptWithUserGestureForTests( |
214 base::UTF8ToUTF16(script_)); | 214 base::UTF8ToUTF16(script_)); |
215 } else { | 215 } else { |
216 rvh_->GetMainFrame()->ExecuteJavaScript(base::UTF8ToUTF16(script_)); | 216 rvh_->GetMainFrame()->ExecuteJavaScriptForTests( |
| 217 base::UTF8ToUTF16(script_)); |
217 } | 218 } |
218 script_was_executed_ = true; | 219 script_was_executed_ = true; |
219 } | 220 } |
220 | 221 |
221 void DidCommitProvisionalLoadForFrame( | 222 void DidCommitProvisionalLoadForFrame( |
222 content::RenderFrameHost* render_frame_host, | 223 content::RenderFrameHost* render_frame_host, |
223 const GURL& url, | 224 const GURL& url, |
224 ui::PageTransition transition_type) override { | 225 ui::PageTransition transition_type) override { |
225 if (script_was_executed_ && | 226 if (script_was_executed_ && |
226 base::EndsWith(url.spec(), until_url_suffix_, | 227 base::EndsWith(url.spec(), until_url_suffix_, |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 StartProvisionalLoadObserver cross_site_load(tab, cross_site_url); | 668 StartProvisionalLoadObserver cross_site_load(tab, cross_site_url); |
668 | 669 |
669 GURL same_site_url = | 670 GURL same_site_url = |
670 extension->GetResourceURL(extension->url(), "empty.html"); | 671 extension->GetResourceURL(extension->url(), "empty.html"); |
671 test_navigation_listener()->DelayRequestsForURL(same_site_url); | 672 test_navigation_listener()->DelayRequestsForURL(same_site_url); |
672 StartProvisionalLoadObserver same_site_load(tab, same_site_url); | 673 StartProvisionalLoadObserver same_site_load(tab, same_site_url); |
673 | 674 |
674 // Ensure the cross-site navigation has started, then execute JavaScript | 675 // Ensure the cross-site navigation has started, then execute JavaScript |
675 // to cause the renderer-initiated, non-user navigation. | 676 // to cause the renderer-initiated, non-user navigation. |
676 cross_site_load.Wait(); | 677 cross_site_load.Wait(); |
677 tab->GetMainFrame()->ExecuteJavaScript(base::UTF8ToUTF16("navigate2()")); | 678 tab->GetMainFrame()->ExecuteJavaScriptForTests( |
| 679 base::UTF8ToUTF16("navigate2()")); |
678 | 680 |
679 // Wait for the same-site navigation to start and resume the cross-site | 681 // Wait for the same-site navigation to start and resume the cross-site |
680 // one, allowing it to commit. | 682 // one, allowing it to commit. |
681 same_site_load.Wait(); | 683 same_site_load.Wait(); |
682 test_navigation_listener()->Resume(cross_site_url); | 684 test_navigation_listener()->Resume(cross_site_url); |
683 | 685 |
684 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 686 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
685 } | 687 } |
686 | 688 |
687 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, CrossProcessFragment) { | 689 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, CrossProcessFragment) { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 "extensions/api_test/webnavigation/crash/b.html", | 761 "extensions/api_test/webnavigation/crash/b.html", |
760 embedded_test_server()->port())); | 762 embedded_test_server()->port())); |
761 ui_test_utils::NavigateToURL(browser(), url); | 763 ui_test_utils::NavigateToURL(browser(), url); |
762 | 764 |
763 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 765 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
764 } | 766 } |
765 | 767 |
766 #endif | 768 #endif |
767 | 769 |
768 } // namespace extensions | 770 } // namespace extensions |
OLD | NEW |