| 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/web_state/web_state_observer_bridge.h" | 5 #import "ios/web/public/web_state/web_state_observer_bridge.h" |
| 6 | 6 |
| 7 #import "base/mac/scoped_nsobject.h" | 7 #import "base/mac/scoped_nsobject.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "ios/web/public/favicon_url.h" | 9 #include "ios/web/public/favicon_url.h" |
| 10 #import "ios/web/public/test/fakes/crw_test_web_state_observer.h" | 10 #import "ios/web/public/test/fakes/crw_test_web_state_observer.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 [observer_ startProvisionalNavigationInfo]->web_state); | 50 [observer_ startProvisionalNavigationInfo]->web_state); |
| 51 EXPECT_EQ(url, [observer_ startProvisionalNavigationInfo]->url); | 51 EXPECT_EQ(url, [observer_ startProvisionalNavigationInfo]->url); |
| 52 } | 52 } |
| 53 | 53 |
| 54 // Tests |webState:didFinishNavigation:| forwarding. | 54 // Tests |webState:didFinishNavigation:| forwarding. |
| 55 TEST_F(WebStateObserverBridgeTest, DidFinishNavigation) { | 55 TEST_F(WebStateObserverBridgeTest, DidFinishNavigation) { |
| 56 ASSERT_FALSE([observer_ didFinishNavigationInfo]); | 56 ASSERT_FALSE([observer_ didFinishNavigationInfo]); |
| 57 | 57 |
| 58 GURL url("https://chromium.test/"); | 58 GURL url("https://chromium.test/"); |
| 59 std::unique_ptr<web::NavigationContext> context = | 59 std::unique_ptr<web::NavigationContext> context = |
| 60 web::NavigationContextImpl::CreateNavigationContext(&test_web_state_, url, | 60 web::NavigationContextImpl::CreateNavigationContext(&test_web_state_, |
| 61 response_headers_); | 61 url); |
| 62 bridge_->DidFinishNavigation(context.get()); | 62 bridge_->DidFinishNavigation(context.get()); |
| 63 | 63 |
| 64 ASSERT_TRUE([observer_ didFinishNavigationInfo]); | 64 ASSERT_TRUE([observer_ didFinishNavigationInfo]); |
| 65 EXPECT_EQ(&test_web_state_, [observer_ didFinishNavigationInfo]->web_state); | 65 EXPECT_EQ(&test_web_state_, [observer_ didFinishNavigationInfo]->web_state); |
| 66 web::NavigationContext* actual_context = | 66 web::NavigationContext* actual_context = |
| 67 [observer_ didFinishNavigationInfo]->context.get(); | 67 [observer_ didFinishNavigationInfo]->context.get(); |
| 68 ASSERT_TRUE(actual_context); | 68 ASSERT_TRUE(actual_context); |
| 69 EXPECT_EQ(&test_web_state_, actual_context->GetWebState()); | 69 EXPECT_EQ(&test_web_state_, actual_context->GetWebState()); |
| 70 EXPECT_EQ(context->IsSameDocument(), actual_context->IsSameDocument()); | 70 EXPECT_EQ(context->IsSameDocument(), actual_context->IsSameDocument()); |
| 71 EXPECT_EQ(context->IsErrorPage(), actual_context->IsErrorPage()); | 71 EXPECT_EQ(context->IsErrorPage(), actual_context->IsErrorPage()); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 // Tests |webState:webStateDidStartLoading:| forwarding. | 246 // Tests |webState:webStateDidStartLoading:| forwarding. |
| 247 TEST_F(WebStateObserverBridgeTest, DidStartLoading) { | 247 TEST_F(WebStateObserverBridgeTest, DidStartLoading) { |
| 248 ASSERT_FALSE([observer_ startLoadingInfo]); | 248 ASSERT_FALSE([observer_ startLoadingInfo]); |
| 249 | 249 |
| 250 bridge_->DidStartLoading(); | 250 bridge_->DidStartLoading(); |
| 251 ASSERT_TRUE([observer_ startLoadingInfo]); | 251 ASSERT_TRUE([observer_ startLoadingInfo]); |
| 252 EXPECT_EQ(&test_web_state_, [observer_ startLoadingInfo]->web_state); | 252 EXPECT_EQ(&test_web_state_, [observer_ startLoadingInfo]->web_state); |
| 253 } | 253 } |
| 254 | 254 |
| 255 } // namespace web | 255 } // namespace web |
| OLD | NEW |