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

Unified Diff: content/public/test/test_navigation_observer.cc

Issue 2650033008: Convert TestNavigationObserver to use the new navigation callbacks. (Closed)
Patch Set: fix test Created 3 years, 11 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 | « content/public/test/test_navigation_observer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/test/test_navigation_observer.cc
diff --git a/content/public/test/test_navigation_observer.cc b/content/public/test/test_navigation_observer.cc
index 6f48b2f23f9978b47b2f4e615bb6f83988874b17..4fe4a69e9be668e0432c339e844897e6fafa0799 100644
--- a/content/public/test/test_navigation_observer.cc
+++ b/content/public/test/test_navigation_observer.cc
@@ -5,13 +5,10 @@
#include "content/public/test/test_navigation_observer.h"
#include "base/bind.h"
-#include "base/macros.h"
-#include "base/memory/ptr_util.h"
#include "base/message_loop/message_loop.h"
-#include "base/run_loop.h"
#include "content/browser/web_contents/web_contents_impl.h"
+#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/web_contents_observer.h"
-#include "testing/gtest/include/gtest/gtest.h"
namespace content {
@@ -47,29 +44,19 @@ class TestNavigationObserver::TestWebContentsObserver
parent_->OnDidStopLoading(web_contents());
}
- void DidStartProvisionalLoadForFrame(RenderFrameHost* render_frame_host,
- const GURL& validated_url,
- bool is_error_page) override {
- parent_->OnDidStartProvisionalLoad(render_frame_host, validated_url,
- is_error_page);
- }
+ void DidStartNavigation(NavigationHandle* navigation_handle) override {
+ if (navigation_handle->IsSamePage())
+ return;
- void DidFailProvisionalLoad(
- RenderFrameHost* render_frame_host,
- const GURL& validated_url,
- int error_code,
- const base::string16& error_description,
- bool was_ignored_by_handler) override {
- parent_->OnDidFailProvisionalLoad(render_frame_host, validated_url,
- error_code, error_description);
+ parent_->OnDidStartNavigation();
}
- void DidCommitProvisionalLoadForFrame(
- RenderFrameHost* render_frame_host,
- const GURL& url,
- ui::PageTransition transition_type) override {
- parent_->OnDidCommitProvisionalLoadForFrame(
- render_frame_host, url, transition_type);
+ void DidFinishNavigation(NavigationHandle* navigation_handle) override {
+ if (!navigation_handle->HasCommitted())
+ return;
+
+ parent_->OnDidFinishNavigation(navigation_handle->IsErrorPage(),
+ navigation_handle->GetURL());
}
TestNavigationObserver* parent_;
@@ -172,28 +159,14 @@ void TestNavigationObserver::OnDidStopLoading(WebContents* web_contents) {
}
}
-void TestNavigationObserver::OnDidStartProvisionalLoad(
- RenderFrameHost* render_frame_host,
- const GURL& validated_url,
- bool is_error_page) {
- last_navigation_succeeded_ = false;
-}
-
-void TestNavigationObserver::OnDidFailProvisionalLoad(
- RenderFrameHost* render_frame_host,
- const GURL& validated_url,
- int error_code,
- const base::string16& error_description) {
- last_navigation_url_ = validated_url;
+void TestNavigationObserver::OnDidStartNavigation() {
last_navigation_succeeded_ = false;
}
-void TestNavigationObserver::OnDidCommitProvisionalLoadForFrame(
- RenderFrameHost* render_frame_host,
- const GURL& url,
- ui::PageTransition transition_type) {
+void TestNavigationObserver::OnDidFinishNavigation(bool is_error_page,
+ const GURL& url) {
last_navigation_url_ = url;
- last_navigation_succeeded_ = true;
+ last_navigation_succeeded_ = !is_error_page;
}
} // namespace content
« no previous file with comments | « content/public/test/test_navigation_observer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698