| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #import "ios/web/public/test/fakes/crw_test_web_state_observer.h" | 5 #import "ios/web/public/test/fakes/crw_test_web_state_observer.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "ios/web/public/web_state/navigation_context.h" | 8 #include "ios/web/public/web_state/navigation_context.h" |
| 9 #include "ios/web/web_state/navigation_context_impl.h" | 9 #include "ios/web/web_state/navigation_context_impl.h" |
| 10 #include "net/http/http_response_headers.h" | 10 #include "net/http/http_response_headers.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 - (void)webState:(web::WebState*)webState | 137 - (void)webState:(web::WebState*)webState |
| 138 didCommitNavigationWithDetails: | 138 didCommitNavigationWithDetails: |
| 139 (const web::LoadCommittedDetails&)load_details { | 139 (const web::LoadCommittedDetails&)load_details { |
| 140 _commitNavigationInfo = base::MakeUnique<web::TestCommitNavigationInfo>(); | 140 _commitNavigationInfo = base::MakeUnique<web::TestCommitNavigationInfo>(); |
| 141 _commitNavigationInfo->web_state = webState; | 141 _commitNavigationInfo->web_state = webState; |
| 142 _commitNavigationInfo->load_details = load_details; | 142 _commitNavigationInfo->load_details = load_details; |
| 143 } | 143 } |
| 144 | 144 |
| 145 - (void)webState:(web::WebState*)webState | 145 - (void)webState:(web::WebState*)webState |
| 146 didFinishNavigation:(web::NavigationContext*)navigation { | 146 didFinishNavigation:(web::NavigationContext*)navigation { |
| 147 ASSERT_TRUE(!navigation->IsErrorPage() || !navigation->IsSameDocument()); |
| 147 _didFinishNavigationInfo = | 148 _didFinishNavigationInfo = |
| 148 base::MakeUnique<web::TestDidFinishNavigationInfo>(); | 149 base::MakeUnique<web::TestDidFinishNavigationInfo>(); |
| 149 _didFinishNavigationInfo->web_state = webState; | 150 _didFinishNavigationInfo->web_state = webState; |
| 150 if (navigation->IsSameDocument()) { | 151 std::unique_ptr<web::NavigationContextImpl> context = |
| 151 ASSERT_FALSE(navigation->IsErrorPage()); | 152 web::NavigationContextImpl::CreateNavigationContext( |
| 152 _didFinishNavigationInfo->context = | 153 navigation->GetWebState(), navigation->GetUrl()); |
| 153 web::NavigationContextImpl::CreateSameDocumentNavigationContext( | 154 context->SetIsSameDocument(navigation->IsSameDocument()); |
| 154 navigation->GetWebState(), navigation->GetUrl()); | 155 context->SetIsErrorPage(navigation->IsErrorPage()); |
| 155 } else if (navigation->IsErrorPage()) { | 156 _didFinishNavigationInfo->context = std::move(context); |
| 156 ASSERT_FALSE(navigation->IsSameDocument()); | |
| 157 _didFinishNavigationInfo->context = | |
| 158 web::NavigationContextImpl::CreateErrorPageNavigationContext( | |
| 159 navigation->GetWebState(), navigation->GetUrl(), | |
| 160 navigation->GetResponseHeaders()); | |
| 161 } else { | |
| 162 _didFinishNavigationInfo->context = | |
| 163 web::NavigationContextImpl::CreateNavigationContext( | |
| 164 navigation->GetWebState(), navigation->GetUrl(), | |
| 165 navigation->GetResponseHeaders()); | |
| 166 } | |
| 167 } | 157 } |
| 168 | 158 |
| 169 - (void)webState:(web::WebState*)webState didLoadPageWithSuccess:(BOOL)success { | 159 - (void)webState:(web::WebState*)webState didLoadPageWithSuccess:(BOOL)success { |
| 170 _loadPageInfo = base::MakeUnique<web::TestLoadPageInfo>(); | 160 _loadPageInfo = base::MakeUnique<web::TestLoadPageInfo>(); |
| 171 _loadPageInfo->web_state = webState; | 161 _loadPageInfo->web_state = webState; |
| 172 _loadPageInfo->success = success; | 162 _loadPageInfo->success = success; |
| 173 } | 163 } |
| 174 | 164 |
| 175 - (void)webStateDidDismissInterstitial:(web::WebState*)webState { | 165 - (void)webStateDidDismissInterstitial:(web::WebState*)webState { |
| 176 _dismissInterstitialInfo = | 166 _dismissInterstitialInfo = |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 _stopLoadingInfo = base::MakeUnique<web::TestStopLoadingInfo>(); | 239 _stopLoadingInfo = base::MakeUnique<web::TestStopLoadingInfo>(); |
| 250 _stopLoadingInfo->web_state = webState; | 240 _stopLoadingInfo->web_state = webState; |
| 251 } | 241 } |
| 252 | 242 |
| 253 - (void)webStateDidStartLoading:(web::WebState*)webState { | 243 - (void)webStateDidStartLoading:(web::WebState*)webState { |
| 254 _startLoadingInfo = base::MakeUnique<web::TestStartLoadingInfo>(); | 244 _startLoadingInfo = base::MakeUnique<web::TestStartLoadingInfo>(); |
| 255 _startLoadingInfo->web_state = webState; | 245 _startLoadingInfo->web_state = webState; |
| 256 } | 246 } |
| 257 | 247 |
| 258 @end | 248 @end |
| OLD | NEW |