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

Side by Side Diff: chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc

Issue 1257603003: Revert of Add ExecuteJavaScriptForTest and make all tests use it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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
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 <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
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()->ExecuteJavaScriptForTests( 216 rvh_->GetMainFrame()->ExecuteJavaScript(base::UTF8ToUTF16(script_));
217 base::UTF8ToUTF16(script_));
218 } 217 }
219 script_was_executed_ = true; 218 script_was_executed_ = true;
220 } 219 }
221 220
222 void DidCommitProvisionalLoadForFrame( 221 void DidCommitProvisionalLoadForFrame(
223 content::RenderFrameHost* render_frame_host, 222 content::RenderFrameHost* render_frame_host,
224 const GURL& url, 223 const GURL& url,
225 ui::PageTransition transition_type) override { 224 ui::PageTransition transition_type) override {
226 if (script_was_executed_ && 225 if (script_was_executed_ &&
227 base::EndsWith(url.spec(), until_url_suffix_, 226 base::EndsWith(url.spec(), until_url_suffix_,
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 StartProvisionalLoadObserver cross_site_load(tab, cross_site_url); 667 StartProvisionalLoadObserver cross_site_load(tab, cross_site_url);
669 668
670 GURL same_site_url = 669 GURL same_site_url =
671 extension->GetResourceURL(extension->url(), "empty.html"); 670 extension->GetResourceURL(extension->url(), "empty.html");
672 test_navigation_listener()->DelayRequestsForURL(same_site_url); 671 test_navigation_listener()->DelayRequestsForURL(same_site_url);
673 StartProvisionalLoadObserver same_site_load(tab, same_site_url); 672 StartProvisionalLoadObserver same_site_load(tab, same_site_url);
674 673
675 // Ensure the cross-site navigation has started, then execute JavaScript 674 // Ensure the cross-site navigation has started, then execute JavaScript
676 // to cause the renderer-initiated, non-user navigation. 675 // to cause the renderer-initiated, non-user navigation.
677 cross_site_load.Wait(); 676 cross_site_load.Wait();
678 tab->GetMainFrame()->ExecuteJavaScriptForTests( 677 tab->GetMainFrame()->ExecuteJavaScript(base::UTF8ToUTF16("navigate2()"));
679 base::UTF8ToUTF16("navigate2()"));
680 678
681 // Wait for the same-site navigation to start and resume the cross-site 679 // Wait for the same-site navigation to start and resume the cross-site
682 // one, allowing it to commit. 680 // one, allowing it to commit.
683 same_site_load.Wait(); 681 same_site_load.Wait();
684 test_navigation_listener()->Resume(cross_site_url); 682 test_navigation_listener()->Resume(cross_site_url);
685 683
686 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); 684 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
687 } 685 }
688 686
689 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, CrossProcessFragment) { 687 IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, CrossProcessFragment) {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 "extensions/api_test/webnavigation/crash/b.html", 759 "extensions/api_test/webnavigation/crash/b.html",
762 embedded_test_server()->port())); 760 embedded_test_server()->port()));
763 ui_test_utils::NavigateToURL(browser(), url); 761 ui_test_utils::NavigateToURL(browser(), url);
764 762
765 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); 763 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
766 } 764 }
767 765
768 #endif 766 #endif
769 767
770 } // namespace extensions 768 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698