| 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 #import "ios/web/public/web_state/navigation_context.h" | 8 #import "ios/web/public/web_state/navigation_context.h" |
| 9 #import "ios/web/web_state/navigation_context_impl.h" | 9 #import "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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 125 |
| 126 #pragma mark CRWWebStateObserver methods - | 126 #pragma mark CRWWebStateObserver methods - |
| 127 | 127 |
| 128 - (void)webState:(web::WebState*)webState | 128 - (void)webState:(web::WebState*)webState |
| 129 didStartNavigation:(web::NavigationContext*)navigation { | 129 didStartNavigation:(web::NavigationContext*)navigation { |
| 130 ASSERT_TRUE(!navigation->GetError() || !navigation->IsSameDocument()); | 130 ASSERT_TRUE(!navigation->GetError() || !navigation->IsSameDocument()); |
| 131 _didStartNavigationInfo = base::MakeUnique<web::TestDidStartNavigationInfo>(); | 131 _didStartNavigationInfo = base::MakeUnique<web::TestDidStartNavigationInfo>(); |
| 132 _didStartNavigationInfo->web_state = webState; | 132 _didStartNavigationInfo->web_state = webState; |
| 133 std::unique_ptr<web::NavigationContextImpl> context = | 133 std::unique_ptr<web::NavigationContextImpl> context = |
| 134 web::NavigationContextImpl::CreateNavigationContext( | 134 web::NavigationContextImpl::CreateNavigationContext( |
| 135 navigation->GetWebState(), navigation->GetUrl()); | 135 navigation->GetWebState(), navigation->GetUrl(), |
| 136 navigation->GetPageTransition()); |
| 136 context->SetIsSameDocument(navigation->IsSameDocument()); | 137 context->SetIsSameDocument(navigation->IsSameDocument()); |
| 137 context->SetError(navigation->GetError()); | 138 context->SetError(navigation->GetError()); |
| 138 _didStartNavigationInfo->context = std::move(context); | 139 _didStartNavigationInfo->context = std::move(context); |
| 139 } | 140 } |
| 140 | 141 |
| 141 - (void)webState:(web::WebState*)webState | 142 - (void)webState:(web::WebState*)webState |
| 142 didCommitNavigationWithDetails: | 143 didCommitNavigationWithDetails: |
| 143 (const web::LoadCommittedDetails&)load_details { | 144 (const web::LoadCommittedDetails&)load_details { |
| 144 _commitNavigationInfo = base::MakeUnique<web::TestCommitNavigationInfo>(); | 145 _commitNavigationInfo = base::MakeUnique<web::TestCommitNavigationInfo>(); |
| 145 _commitNavigationInfo->web_state = webState; | 146 _commitNavigationInfo->web_state = webState; |
| 146 _commitNavigationInfo->load_details = load_details; | 147 _commitNavigationInfo->load_details = load_details; |
| 147 } | 148 } |
| 148 | 149 |
| 149 - (void)webState:(web::WebState*)webState | 150 - (void)webState:(web::WebState*)webState |
| 150 didFinishNavigation:(web::NavigationContext*)navigation { | 151 didFinishNavigation:(web::NavigationContext*)navigation { |
| 151 ASSERT_TRUE(!navigation->GetError() || !navigation->IsSameDocument()); | 152 ASSERT_TRUE(!navigation->GetError() || !navigation->IsSameDocument()); |
| 152 _didFinishNavigationInfo = | 153 _didFinishNavigationInfo = |
| 153 base::MakeUnique<web::TestDidFinishNavigationInfo>(); | 154 base::MakeUnique<web::TestDidFinishNavigationInfo>(); |
| 154 _didFinishNavigationInfo->web_state = webState; | 155 _didFinishNavigationInfo->web_state = webState; |
| 155 std::unique_ptr<web::NavigationContextImpl> context = | 156 std::unique_ptr<web::NavigationContextImpl> context = |
| 156 web::NavigationContextImpl::CreateNavigationContext( | 157 web::NavigationContextImpl::CreateNavigationContext( |
| 157 navigation->GetWebState(), navigation->GetUrl()); | 158 navigation->GetWebState(), navigation->GetUrl(), |
| 159 navigation->GetPageTransition()); |
| 158 context->SetIsSameDocument(navigation->IsSameDocument()); | 160 context->SetIsSameDocument(navigation->IsSameDocument()); |
| 159 context->SetError(navigation->GetError()); | 161 context->SetError(navigation->GetError()); |
| 160 _didFinishNavigationInfo->context = std::move(context); | 162 _didFinishNavigationInfo->context = std::move(context); |
| 161 } | 163 } |
| 162 | 164 |
| 163 - (void)webState:(web::WebState*)webState didLoadPageWithSuccess:(BOOL)success { | 165 - (void)webState:(web::WebState*)webState didLoadPageWithSuccess:(BOOL)success { |
| 164 _loadPageInfo = base::MakeUnique<web::TestLoadPageInfo>(); | 166 _loadPageInfo = base::MakeUnique<web::TestLoadPageInfo>(); |
| 165 _loadPageInfo->web_state = webState; | 167 _loadPageInfo->web_state = webState; |
| 166 _loadPageInfo->success = success; | 168 _loadPageInfo->success = success; |
| 167 } | 169 } |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 _stopLoadingInfo = base::MakeUnique<web::TestStopLoadingInfo>(); | 245 _stopLoadingInfo = base::MakeUnique<web::TestStopLoadingInfo>(); |
| 244 _stopLoadingInfo->web_state = webState; | 246 _stopLoadingInfo->web_state = webState; |
| 245 } | 247 } |
| 246 | 248 |
| 247 - (void)webStateDidStartLoading:(web::WebState*)webState { | 249 - (void)webStateDidStartLoading:(web::WebState*)webState { |
| 248 _startLoadingInfo = base::MakeUnique<web::TestStartLoadingInfo>(); | 250 _startLoadingInfo = base::MakeUnique<web::TestStartLoadingInfo>(); |
| 249 _startLoadingInfo->web_state = webState; | 251 _startLoadingInfo->web_state = webState; |
| 250 } | 252 } |
| 251 | 253 |
| 252 @end | 254 @end |
| OLD | NEW |