| 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 web::NavigationContextImpl::CreateNavigationContext(&test_web_state_, | 50 web::NavigationContextImpl::CreateNavigationContext(&test_web_state_, |
| 51 url); | 51 url); |
| 52 bridge_->DidFinishNavigation(context.get()); | 52 bridge_->DidFinishNavigation(context.get()); |
| 53 | 53 |
| 54 ASSERT_TRUE([observer_ didFinishNavigationInfo]); | 54 ASSERT_TRUE([observer_ didFinishNavigationInfo]); |
| 55 EXPECT_EQ(&test_web_state_, [observer_ didFinishNavigationInfo]->web_state); | 55 EXPECT_EQ(&test_web_state_, [observer_ didFinishNavigationInfo]->web_state); |
| 56 web::NavigationContext* actual_context = | 56 web::NavigationContext* actual_context = |
| 57 [observer_ didFinishNavigationInfo]->context.get(); | 57 [observer_ didFinishNavigationInfo]->context.get(); |
| 58 ASSERT_TRUE(actual_context); | 58 ASSERT_TRUE(actual_context); |
| 59 EXPECT_EQ(&test_web_state_, actual_context->GetWebState()); | 59 EXPECT_EQ(&test_web_state_, actual_context->GetWebState()); |
| 60 EXPECT_EQ(context->IsSamePage(), actual_context->IsSamePage()); | 60 EXPECT_EQ(context->IsSameDocument(), actual_context->IsSameDocument()); |
| 61 EXPECT_EQ(context->IsErrorPage(), actual_context->IsErrorPage()); | 61 EXPECT_EQ(context->IsErrorPage(), actual_context->IsErrorPage()); |
| 62 EXPECT_EQ(context->GetUrl(), actual_context->GetUrl()); | 62 EXPECT_EQ(context->GetUrl(), actual_context->GetUrl()); |
| 63 } | 63 } |
| 64 | 64 |
| 65 // Tests |webState:didCommitNavigationWithDetails:| forwarding. | 65 // Tests |webState:didCommitNavigationWithDetails:| forwarding. |
| 66 TEST_F(WebStateObserverBridgeTest, NavigationItemCommitted) { | 66 TEST_F(WebStateObserverBridgeTest, NavigationItemCommitted) { |
| 67 ASSERT_FALSE([observer_ commitNavigationInfo]); | 67 ASSERT_FALSE([observer_ commitNavigationInfo]); |
| 68 | 68 |
| 69 LoadCommittedDetails load_details; | 69 LoadCommittedDetails load_details; |
| 70 load_details.item = reinterpret_cast<web::NavigationItem*>(1); | 70 load_details.item = reinterpret_cast<web::NavigationItem*>(1); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 // Tests |webState:webStateDidStartLoading:| forwarding. | 215 // Tests |webState:webStateDidStartLoading:| forwarding. |
| 216 TEST_F(WebStateObserverBridgeTest, DidStartLoading) { | 216 TEST_F(WebStateObserverBridgeTest, DidStartLoading) { |
| 217 ASSERT_FALSE([observer_ startLoadingInfo]); | 217 ASSERT_FALSE([observer_ startLoadingInfo]); |
| 218 | 218 |
| 219 bridge_->DidStartLoading(); | 219 bridge_->DidStartLoading(); |
| 220 ASSERT_TRUE([observer_ startLoadingInfo]); | 220 ASSERT_TRUE([observer_ startLoadingInfo]); |
| 221 EXPECT_EQ(&test_web_state_, [observer_ startLoadingInfo]->web_state); | 221 EXPECT_EQ(&test_web_state_, [observer_ startLoadingInfo]->web_state); |
| 222 } | 222 } |
| 223 | 223 |
| 224 } // namespace web | 224 } // namespace web |
| OLD | NEW |