| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 CHECK(!navigation_handle->HasCommitted()); | 150 CHECK(!navigation_handle->HasCommitted()); |
| 151 CHECK(navigation_handle->GetRenderFrameHost()); | 151 CHECK(navigation_handle->GetRenderFrameHost()); |
| 152 CHECK_EQ(navigation_handle->GetWebContents(), web_contents()); | 152 CHECK_EQ(navigation_handle->GetWebContents(), web_contents()); |
| 153 CHECK(navigation_handle->GetRenderFrameHost() != nullptr); | 153 CHECK(navigation_handle->GetRenderFrameHost() != nullptr); |
| 154 } | 154 } |
| 155 | 155 |
| 156 void WebContentsObserverSanityChecker::DidFinishNavigation( | 156 void WebContentsObserverSanityChecker::DidFinishNavigation( |
| 157 NavigationHandle* navigation_handle) { | 157 NavigationHandle* navigation_handle) { |
| 158 CHECK(NavigationIsOngoing(navigation_handle)); | 158 CHECK(NavigationIsOngoing(navigation_handle)); |
| 159 | 159 |
| 160 CHECK(!(navigation_handle->HasCommitted() && | 160 CHECK_IMPLIES( |
| 161 !navigation_handle->IsErrorPage()) || | 161 navigation_handle->HasCommitted() && !navigation_handle->IsErrorPage(), |
| 162 navigation_handle->GetNetErrorCode() == net::OK); | 162 navigation_handle->GetNetErrorCode() == net::OK); |
| 163 CHECK(!(navigation_handle->HasCommitted() && | 163 CHECK_IMPLIES( |
| 164 navigation_handle->IsErrorPage()) || | 164 navigation_handle->HasCommitted() && navigation_handle->IsErrorPage(), |
| 165 navigation_handle->GetNetErrorCode() != net::OK); | 165 navigation_handle->GetNetErrorCode() != net::OK); |
| 166 CHECK_EQ(navigation_handle->GetWebContents(), web_contents()); | 166 CHECK_EQ(navigation_handle->GetWebContents(), web_contents()); |
| 167 | 167 |
| 168 CHECK(!navigation_handle->HasCommitted() || | 168 CHECK_IMPLIES(navigation_handle->HasCommitted(), |
| 169 navigation_handle->GetRenderFrameHost() != nullptr); | 169 navigation_handle->GetRenderFrameHost() != nullptr); |
| 170 | 170 |
| 171 ongoing_navigations_.erase(navigation_handle); | 171 ongoing_navigations_.erase(navigation_handle); |
| 172 } | 172 } |
| 173 | 173 |
| 174 void WebContentsObserverSanityChecker::DidStartProvisionalLoadForFrame( | 174 void WebContentsObserverSanityChecker::DidStartProvisionalLoadForFrame( |
| 175 RenderFrameHost* render_frame_host, | 175 RenderFrameHost* render_frame_host, |
| 176 const GURL& validated_url, | 176 const GURL& validated_url, |
| 177 bool is_error_page, | 177 bool is_error_page, |
| 178 bool is_iframe_srcdoc) { | 178 bool is_iframe_srcdoc) { |
| 179 AssertRenderFrameExists(render_frame_host); | 179 AssertRenderFrameExists(render_frame_host); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 render_frame_host->GetSiteInstance()->GetSiteURL().spec().c_str()); | 319 render_frame_host->GetSiteInstance()->GetSiteURL().spec().c_str()); |
| 320 } | 320 } |
| 321 | 321 |
| 322 bool WebContentsObserverSanityChecker::NavigationIsOngoing( | 322 bool WebContentsObserverSanityChecker::NavigationIsOngoing( |
| 323 NavigationHandle* navigation_handle) { | 323 NavigationHandle* navigation_handle) { |
| 324 auto it = ongoing_navigations_.find(navigation_handle); | 324 auto it = ongoing_navigations_.find(navigation_handle); |
| 325 return it != ongoing_navigations_.end(); | 325 return it != ongoing_navigations_.end(); |
| 326 } | 326 } |
| 327 | 327 |
| 328 } // namespace content | 328 } // namespace content |
| OLD | NEW |