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

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: Addressed comments 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
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..f34a193c04f22ff7eb0bb6c9642b047fa578a3b4 100644
--- a/content/test/web_contents_observer_sanity_checker.cc
+++ b/content/test/web_contents_observer_sanity_checker.cc
@@ -124,11 +124,9 @@ 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());
Charlie Reis 2015/09/21 16:40:42 We can check !IsErrorPage() as well, right? (Same
clamy 2015/09/22 00:38:05 Done.
ongoing_navigations_.insert(navigation_handle);
}
@@ -136,51 +134,32 @@ 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());
}
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(),
Charlie Reis 2015/09/21 16:40:42 Should this be CHECK_EQ? (In other words, does th
clamy 2015/09/22 00:38:05 No this is an implication because I've put a CHECK
+ navigation_handle->GetRenderFrameHost() != nullptr);
ongoing_navigations_.erase(navigation_handle);
}
@@ -287,7 +266,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 +318,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

Powered by Google App Engine
This is Rietveld 408576698