| 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 #include "ios/web/public/test/fakes/test_web_state_observer.h" | 5 #include "ios/web/public/test/fakes/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 #include "ios/web/public/web_state/web_state.h" | 9 #include "ios/web/public/web_state/web_state.h" |
| 10 #include "ios/web/web_state/navigation_context_impl.h" | 10 #include "ios/web/web_state/navigation_context_impl.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 navigation_item_changed_info_->web_state = web_state(); | 58 navigation_item_changed_info_->web_state = web_state(); |
| 59 } | 59 } |
| 60 | 60 |
| 61 void TestWebStateObserver::DidStartNavigation(NavigationContext* navigation) { | 61 void TestWebStateObserver::DidStartNavigation(NavigationContext* navigation) { |
| 62 ASSERT_TRUE(!navigation->GetError() || !navigation->IsSameDocument()); | 62 ASSERT_TRUE(!navigation->GetError() || !navigation->IsSameDocument()); |
| 63 did_start_navigation_info_ = | 63 did_start_navigation_info_ = |
| 64 base::MakeUnique<web::TestDidStartNavigationInfo>(); | 64 base::MakeUnique<web::TestDidStartNavigationInfo>(); |
| 65 did_start_navigation_info_->web_state = web_state(); | 65 did_start_navigation_info_->web_state = web_state(); |
| 66 std::unique_ptr<web::NavigationContextImpl> context = | 66 std::unique_ptr<web::NavigationContextImpl> context = |
| 67 web::NavigationContextImpl::CreateNavigationContext( | 67 web::NavigationContextImpl::CreateNavigationContext( |
| 68 navigation->GetWebState(), navigation->GetUrl()); | 68 navigation->GetWebState(), navigation->GetUrl(), |
| 69 navigation->GetPageTransition()); |
| 69 context->SetIsSameDocument(navigation->IsSameDocument()); | 70 context->SetIsSameDocument(navigation->IsSameDocument()); |
| 70 context->SetError(navigation->GetError()); | 71 context->SetError(navigation->GetError()); |
| 71 did_start_navigation_info_->context = std::move(context); | 72 did_start_navigation_info_->context = std::move(context); |
| 72 } | 73 } |
| 73 | 74 |
| 74 void TestWebStateObserver::DidFinishNavigation(NavigationContext* navigation) { | 75 void TestWebStateObserver::DidFinishNavigation(NavigationContext* navigation) { |
| 75 ASSERT_TRUE(!navigation->GetError() || !navigation->IsSameDocument()); | 76 ASSERT_TRUE(!navigation->GetError() || !navigation->IsSameDocument()); |
| 76 did_finish_navigation_info_ = | 77 did_finish_navigation_info_ = |
| 77 base::MakeUnique<web::TestDidFinishNavigationInfo>(); | 78 base::MakeUnique<web::TestDidFinishNavigationInfo>(); |
| 78 did_finish_navigation_info_->web_state = web_state(); | 79 did_finish_navigation_info_->web_state = web_state(); |
| 79 std::unique_ptr<web::NavigationContextImpl> context = | 80 std::unique_ptr<web::NavigationContextImpl> context = |
| 80 web::NavigationContextImpl::CreateNavigationContext( | 81 web::NavigationContextImpl::CreateNavigationContext( |
| 81 navigation->GetWebState(), navigation->GetUrl()); | 82 navigation->GetWebState(), navigation->GetUrl(), |
| 83 navigation->GetPageTransition()); |
| 82 context->SetIsSameDocument(navigation->IsSameDocument()); | 84 context->SetIsSameDocument(navigation->IsSameDocument()); |
| 83 context->SetError(navigation->GetError()); | 85 context->SetError(navigation->GetError()); |
| 84 did_finish_navigation_info_->context = std::move(context); | 86 did_finish_navigation_info_->context = std::move(context); |
| 85 } | 87 } |
| 86 | 88 |
| 87 void TestWebStateObserver::TitleWasSet() { | 89 void TestWebStateObserver::TitleWasSet() { |
| 88 title_was_set_info_ = base::MakeUnique<web::TestTitleWasSetInfo>(); | 90 title_was_set_info_ = base::MakeUnique<web::TestTitleWasSetInfo>(); |
| 89 title_was_set_info_->web_state = web_state(); | 91 title_was_set_info_->web_state = web_state(); |
| 90 } | 92 } |
| 91 | 93 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 start_loading_info_ = base::MakeUnique<web::TestStartLoadingInfo>(); | 151 start_loading_info_ = base::MakeUnique<web::TestStartLoadingInfo>(); |
| 150 start_loading_info_->web_state = web_state(); | 152 start_loading_info_->web_state = web_state(); |
| 151 } | 153 } |
| 152 | 154 |
| 153 void TestWebStateObserver::DidStopLoading() { | 155 void TestWebStateObserver::DidStopLoading() { |
| 154 stop_loading_info_ = base::MakeUnique<web::TestStopLoadingInfo>(); | 156 stop_loading_info_ = base::MakeUnique<web::TestStopLoadingInfo>(); |
| 155 stop_loading_info_->web_state = web_state(); | 157 stop_loading_info_->web_state = web_state(); |
| 156 } | 158 } |
| 157 | 159 |
| 158 } // namespace web | 160 } // namespace web |
| OLD | NEW |