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

Unified Diff: content/test/web_contents_observer_sanity_checker.cc

Issue 1350673003: Remove WebContentsObserver::DidCommitNavigation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 3 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/test/web_contents_observer_sanity_checker.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/web_contents_observer_sanity_checker.cc
diff --git a/content/test/web_contents_observer_sanity_checker.cc b/content/test/web_contents_observer_sanity_checker.cc
index 82bcb60461840a005453f0d271ce50cd3de1e7bd..f3b0f7258eb37c13513921c9ced627138024057d 100644
--- a/content/test/web_contents_observer_sanity_checker.cc
+++ b/content/test/web_contents_observer_sanity_checker.cc
@@ -124,11 +124,10 @@ void WebContentsObserverSanityChecker::FrameDeleted(
void WebContentsObserverSanityChecker::DidStartNavigation(
NavigationHandle* navigation_handle) {
CHECK(!NavigationIsOngoing(navigation_handle));
- CHECK(!NavigationIsOngoingAndCommitted(navigation_handle));
CHECK(navigation_handle->GetNetErrorCode() == net::OK);
- CHECK(!navigation_handle->HasCommittedDocument());
- CHECK(!navigation_handle->HasCommittedErrorPage());
+ CHECK(!navigation_handle->HasCommitted());
+ CHECK(!navigation_handle->IsErrorPage());
ongoing_navigations_.insert(navigation_handle);
}
@@ -136,51 +135,33 @@ void WebContentsObserverSanityChecker::DidStartNavigation(
void WebContentsObserverSanityChecker::DidRedirectNavigation(
NavigationHandle* navigation_handle) {
CHECK(NavigationIsOngoing(navigation_handle));
- CHECK(!NavigationIsOngoingAndCommitted(navigation_handle));
CHECK(navigation_handle->GetNetErrorCode() == net::OK);
- CHECK(!navigation_handle->HasCommittedDocument());
- CHECK(!navigation_handle->HasCommittedErrorPage());
+ CHECK(!navigation_handle->HasCommitted());
+ CHECK(!navigation_handle->IsErrorPage());
}
void WebContentsObserverSanityChecker::ReadyToCommitNavigation(
NavigationHandle* navigation_handle) {
CHECK(NavigationIsOngoing(navigation_handle));
- CHECK(!NavigationIsOngoingAndCommitted(navigation_handle));
- CHECK(!navigation_handle->HasCommittedDocument());
- CHECK(!navigation_handle->HasCommittedErrorPage());
-}
-
-void WebContentsObserverSanityChecker::DidCommitNavigation(
- NavigationHandle* navigation_handle) {
- CHECK(NavigationIsOngoing(navigation_handle));
- CHECK(!NavigationIsOngoingAndCommitted(navigation_handle));
-
- CHECK_NE(navigation_handle->HasCommittedDocument(),
- navigation_handle->HasCommittedErrorPage());
- CHECK_IMPLIES(navigation_handle->HasCommittedDocument(),
- navigation_handle->GetNetErrorCode() == net::OK);
- CHECK_IMPLIES(navigation_handle->HasCommittedErrorPage(),
- navigation_handle->GetNetErrorCode() != net::OK);
-
- ongoing_committed_navigations_.insert(navigation_handle);
+ CHECK(!navigation_handle->HasCommitted());
+ CHECK(navigation_handle->GetRenderFrameHost());
}
void WebContentsObserverSanityChecker::DidFinishNavigation(
NavigationHandle* navigation_handle) {
CHECK(NavigationIsOngoing(navigation_handle));
- CHECK_IMPLIES(NavigationIsOngoingAndCommitted(navigation_handle),
- navigation_handle->HasCommittedDocument() !=
- navigation_handle->HasCommittedErrorPage());
- CHECK_IMPLIES(navigation_handle->HasCommittedDocument(),
- navigation_handle->GetNetErrorCode() == net::OK);
- CHECK_IMPLIES(navigation_handle->HasCommittedErrorPage(),
- navigation_handle->GetNetErrorCode() != net::OK);
+ CHECK_IMPLIES(
+ navigation_handle->HasCommitted() && !navigation_handle->IsErrorPage(),
+ navigation_handle->GetNetErrorCode() == net::OK);
+ CHECK_IMPLIES(
+ navigation_handle->HasCommitted() && navigation_handle->IsErrorPage(),
+ navigation_handle->GetNetErrorCode() != net::OK);
- if (NavigationIsOngoingAndCommitted(navigation_handle))
- ongoing_committed_navigations_.erase(navigation_handle);
+ CHECK_IMPLIES(navigation_handle->HasCommitted(),
+ navigation_handle->GetRenderFrameHost() != nullptr);
ongoing_navigations_.erase(navigation_handle);
}
@@ -287,7 +268,6 @@ void WebContentsObserverSanityChecker::WebContentsDestroyed() {
CHECK(!web_contents_destroyed_);
web_contents_destroyed_ = true;
CHECK(ongoing_navigations_.empty());
- CHECK(ongoing_committed_navigations_.empty());
}
WebContentsObserverSanityChecker::WebContentsObserverSanityChecker(
@@ -340,10 +320,4 @@ bool WebContentsObserverSanityChecker::NavigationIsOngoing(
return it != ongoing_navigations_.end();
}
-bool WebContentsObserverSanityChecker::NavigationIsOngoingAndCommitted(
- NavigationHandle* navigation_handle) {
- auto it = ongoing_committed_navigations_.find(navigation_handle);
- return it != ongoing_committed_navigations_.end();
-}
-
} // namespace content
« no previous file with comments | « content/test/web_contents_observer_sanity_checker.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698