| 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_, true)) { | 227 base::EndsWith(url.spec(), until_url_suffix_, true)) { |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 StartProvisionalLoadObserver cross_site_load(tab, cross_site_url); | 667 StartProvisionalLoadObserver cross_site_load(tab, cross_site_url); |
| 667 | 668 |
| 668 GURL same_site_url = | 669 GURL same_site_url = |
| 669 extension->GetResourceURL(extension->url(), "empty.html"); | 670 extension->GetResourceURL(extension->url(), "empty.html"); |
| 670 test_navigation_listener()->DelayRequestsForURL(same_site_url); | 671 test_navigation_listener()->DelayRequestsForURL(same_site_url); |
| 671 StartProvisionalLoadObserver same_site_load(tab, same_site_url); | 672 StartProvisionalLoadObserver same_site_load(tab, same_site_url); |
| 672 | 673 |
| 673 // Ensure the cross-site navigation has started, then execute JavaScript | 674 // Ensure the cross-site navigation has started, then execute JavaScript |
| 674 // to cause the renderer-initiated, non-user navigation. | 675 // to cause the renderer-initiated, non-user navigation. |
| 675 cross_site_load.Wait(); | 676 cross_site_load.Wait(); |
| 676 tab->GetMainFrame()->ExecuteJavaScript(base::UTF8ToUTF16("navigate2()")); | 677 tab->GetMainFrame()->ExecuteJavaScriptForTests( |
| 678 base::UTF8ToUTF16("navigate2()")); |
| 677 | 679 |
| 678 // Wait for the same-site navigation to start and resume the cross-site | 680 // Wait for the same-site navigation to start and resume the cross-site |
| 679 // one, allowing it to commit. | 681 // one, allowing it to commit. |
| 680 same_site_load.Wait(); | 682 same_site_load.Wait(); |
| 681 test_navigation_listener()->Resume(cross_site_url); | 683 test_navigation_listener()->Resume(cross_site_url); |
| 682 | 684 |
| 683 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 685 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 684 } | 686 } |
| 685 | 687 |
| 686 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, CrossProcessFragment) { | 688 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, CrossProcessFragment) { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 "extensions/api_test/webnavigation/crash/b.html", | 760 "extensions/api_test/webnavigation/crash/b.html", |
| 759 embedded_test_server()->port())); | 761 embedded_test_server()->port())); |
| 760 ui_test_utils::NavigateToURL(browser(), url); | 762 ui_test_utils::NavigateToURL(browser(), url); |
| 761 | 763 |
| 762 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 764 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 763 } | 765 } |
| 764 | 766 |
| 765 #endif | 767 #endif |
| 766 | 768 |
| 767 } // namespace extensions | 769 } // namespace extensions |
| OLD | NEW |