| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/test/web_contents_observer_sanity_checker.h" | 5 #include "content/test/web_contents_observer_sanity_checker.h" |
| 6 | 6 |
| 7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "content/browser/frame_host/render_frame_host_impl.h" | 8 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 9 #include "content/common/frame_messages.h" | 9 #include "content/common/frame_messages.h" |
| 10 #include "content/public/browser/navigation_handle.h" | 10 #include "content/public/browser/navigation_handle.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 void WebContentsObserverSanityChecker::DidRedirectNavigation( | 136 void WebContentsObserverSanityChecker::DidRedirectNavigation( |
| 137 NavigationHandle* navigation_handle) { | 137 NavigationHandle* navigation_handle) { |
| 138 CHECK(NavigationIsOngoing(navigation_handle)); | 138 CHECK(NavigationIsOngoing(navigation_handle)); |
| 139 CHECK(!NavigationIsOngoingAndCommitted(navigation_handle)); | 139 CHECK(!NavigationIsOngoingAndCommitted(navigation_handle)); |
| 140 | 140 |
| 141 CHECK(navigation_handle->GetNetErrorCode() == net::OK); | 141 CHECK(navigation_handle->GetNetErrorCode() == net::OK); |
| 142 CHECK(!navigation_handle->HasCommittedDocument()); | 142 CHECK(!navigation_handle->HasCommittedDocument()); |
| 143 CHECK(!navigation_handle->HasCommittedErrorPage()); | 143 CHECK(!navigation_handle->HasCommittedErrorPage()); |
| 144 } | 144 } |
| 145 | 145 |
| 146 void WebContentsObserverSanityChecker::ReadyToCommitNavigation( |
| 147 NavigationHandle* navigation_handle) { |
| 148 CHECK(NavigationIsOngoing(navigation_handle)); |
| 149 CHECK(!NavigationIsOngoingAndCommitted(navigation_handle)); |
| 150 |
| 151 CHECK(!navigation_handle->HasCommittedDocument()); |
| 152 CHECK(!navigation_handle->HasCommittedErrorPage()); |
| 153 } |
| 154 |
| 146 void WebContentsObserverSanityChecker::DidCommitNavigation( | 155 void WebContentsObserverSanityChecker::DidCommitNavigation( |
| 147 NavigationHandle* navigation_handle) { | 156 NavigationHandle* navigation_handle) { |
| 148 CHECK(NavigationIsOngoing(navigation_handle)); | 157 CHECK(NavigationIsOngoing(navigation_handle)); |
| 149 CHECK(!NavigationIsOngoingAndCommitted(navigation_handle)); | 158 CHECK(!NavigationIsOngoingAndCommitted(navigation_handle)); |
| 150 | 159 |
| 151 CHECK_NE(navigation_handle->HasCommittedDocument(), | 160 CHECK_NE(navigation_handle->HasCommittedDocument(), |
| 152 navigation_handle->HasCommittedErrorPage()); | 161 navigation_handle->HasCommittedErrorPage()); |
| 153 CHECK_IMPLIES(navigation_handle->HasCommittedDocument(), | 162 CHECK_IMPLIES(navigation_handle->HasCommittedDocument(), |
| 154 navigation_handle->GetNetErrorCode() == net::OK); | 163 navigation_handle->GetNetErrorCode() == net::OK); |
| 155 CHECK_IMPLIES(navigation_handle->HasCommittedErrorPage(), | 164 CHECK_IMPLIES(navigation_handle->HasCommittedErrorPage(), |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 return it != ongoing_navigations_.end(); | 340 return it != ongoing_navigations_.end(); |
| 332 } | 341 } |
| 333 | 342 |
| 334 bool WebContentsObserverSanityChecker::NavigationIsOngoingAndCommitted( | 343 bool WebContentsObserverSanityChecker::NavigationIsOngoingAndCommitted( |
| 335 NavigationHandle* navigation_handle) { | 344 NavigationHandle* navigation_handle) { |
| 336 auto it = ongoing_committed_navigations_.find(navigation_handle); | 345 auto it = ongoing_committed_navigations_.find(navigation_handle); |
| 337 return it != ongoing_committed_navigations_.end(); | 346 return it != ongoing_committed_navigations_.end(); |
| 338 } | 347 } |
| 339 | 348 |
| 340 } // namespace content | 349 } // namespace content |
| OLD | NEW |