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

Unified Diff: chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc

Issue 2272243002: Remove use of deprecated APIs in WebNavigationApiTest (Closed)
Patch Set: Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc
diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc b/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc
index 372cb8e30916035ab0f1e2e2d3ab109525104e98..46cae8c5235740c3e881ded6a8dbfc7536f4f3c2 100644
--- a/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc
+++ b/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc
@@ -32,6 +32,7 @@
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
@@ -188,7 +189,7 @@ class DelayLoadStartAndExecuteJavascript
script_(script),
has_user_gesture_(false),
script_was_executed_(false),
- rvh_(NULL) {
+ rfh_(NULL) {
nasko 2016/08/25 01:05:09 nit: nullptr
clamy 2016/08/25 18:09:26 Done.
registrar_.Add(this,
chrome::NOTIFICATION_TAB_ADDED,
content::NotificationService::AllSources());
@@ -208,35 +209,34 @@ class DelayLoadStartAndExecuteJavascript
registrar_.RemoveAll();
}
- void DidStartProvisionalLoadForFrame(
- content::RenderFrameHost* render_frame_host,
- const GURL& validated_url,
- bool is_error_page,
- bool is_iframe_srcdoc) override {
- if (validated_url != delay_url_ || !rvh_)
+ void DidStartNavigation(
+ content::NavigationHandle* navigation_handle) override {
+ if (navigation_handle->GetURL() != delay_url_ || !rfh_)
return;
if (has_user_gesture_) {
- rvh_->GetMainFrame()->ExecuteJavaScriptWithUserGestureForTests(
+ rfh_->ExecuteJavaScriptWithUserGestureForTests(
base::UTF8ToUTF16(script_));
} else {
- rvh_->GetMainFrame()->ExecuteJavaScriptForTests(
- base::UTF8ToUTF16(script_));
+ rfh_->ExecuteJavaScriptForTests(base::UTF8ToUTF16(script_));
}
script_was_executed_ = true;
}
- void DidCommitProvisionalLoadForFrame(
- content::RenderFrameHost* render_frame_host,
- const GURL& url,
- ui::PageTransition transition_type) override {
+ void DidFinishNavigation(
+ content::NavigationHandle* navigation_handle) override {
+ if (!navigation_handle->HasCommitted())
nasko 2016/08/25 01:05:09 Should this also check if the commit was an error
clamy 2016/08/25 18:09:26 Done.
+ return;
+
if (script_was_executed_ &&
- base::EndsWith(url.spec(), until_url_suffix_,
+ base::EndsWith(navigation_handle->GetURL().spec(), until_url_suffix_,
base::CompareCase::SENSITIVE)) {
content::WebContentsObserver::Observe(NULL);
test_navigation_listener_->ResumeAll();
}
- rvh_ = render_frame_host->GetRenderViewHost();
+
+ if (navigation_handle->IsInMainFrame())
+ rfh_ = navigation_handle->GetRenderFrameHost();
}
void set_has_user_gesture(bool has_user_gesture) {
@@ -253,7 +253,7 @@ class DelayLoadStartAndExecuteJavascript
std::string script_;
bool has_user_gesture_;
bool script_was_executed_;
- content::RenderViewHost* rvh_;
+ content::RenderFrameHost* rfh_;
DISALLOW_COPY_AND_ASSIGN(DelayLoadStartAndExecuteJavascript);
};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698