| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 83 |
| 84 // Tests |webState:webStateDidDismissInterstitial:| forwarding. | 84 // Tests |webState:webStateDidDismissInterstitial:| forwarding. |
| 85 TEST_F(WebStateObserverBridgeTest, InterstitialDismissed) { | 85 TEST_F(WebStateObserverBridgeTest, InterstitialDismissed) { |
| 86 ASSERT_FALSE([observer_ dismissInterstitialInfo]); | 86 ASSERT_FALSE([observer_ dismissInterstitialInfo]); |
| 87 | 87 |
| 88 bridge_->InterstitialDismissed(); | 88 bridge_->InterstitialDismissed(); |
| 89 ASSERT_TRUE([observer_ dismissInterstitialInfo]); | 89 ASSERT_TRUE([observer_ dismissInterstitialInfo]); |
| 90 EXPECT_EQ(&test_web_state_, [observer_ dismissInterstitialInfo]->web_state); | 90 EXPECT_EQ(&test_web_state_, [observer_ dismissInterstitialInfo]->web_state); |
| 91 } | 91 } |
| 92 | 92 |
| 93 // Tests |webState:webStateDidChangeURLHash:| forwarding. | |
| 94 TEST_F(WebStateObserverBridgeTest, UrlHashChanged) { | |
| 95 ASSERT_FALSE([observer_ changeUrlHashInfo]); | |
| 96 | |
| 97 bridge_->UrlHashChanged(); | |
| 98 ASSERT_TRUE([observer_ changeUrlHashInfo]); | |
| 99 EXPECT_EQ(&test_web_state_, [observer_ changeUrlHashInfo]->web_state); | |
| 100 } | |
| 101 | |
| 102 // Tests |webState:webStateDidChangeHistoryState:| forwarding. | |
| 103 TEST_F(WebStateObserverBridgeTest, HistoryStateChanged) { | |
| 104 ASSERT_FALSE([observer_ changeHistoryStateInfo]); | |
| 105 | |
| 106 bridge_->HistoryStateChanged(); | |
| 107 ASSERT_TRUE([observer_ changeHistoryStateInfo]); | |
| 108 EXPECT_EQ(&test_web_state_, [observer_ changeHistoryStateInfo]->web_state); | |
| 109 } | |
| 110 | |
| 111 // Tests |webState:didChangeLoadingProgress:| forwarding. | 93 // Tests |webState:didChangeLoadingProgress:| forwarding. |
| 112 TEST_F(WebStateObserverBridgeTest, LoadProgressChanged) { | 94 TEST_F(WebStateObserverBridgeTest, LoadProgressChanged) { |
| 113 ASSERT_FALSE([observer_ changeLoadingProgressInfo]); | 95 ASSERT_FALSE([observer_ changeLoadingProgressInfo]); |
| 114 | 96 |
| 115 const double kTestLoadProgress = 0.75; | 97 const double kTestLoadProgress = 0.75; |
| 116 bridge_->LoadProgressChanged(kTestLoadProgress); | 98 bridge_->LoadProgressChanged(kTestLoadProgress); |
| 117 ASSERT_TRUE([observer_ changeLoadingProgressInfo]); | 99 ASSERT_TRUE([observer_ changeLoadingProgressInfo]); |
| 118 EXPECT_EQ(&test_web_state_, [observer_ changeLoadingProgressInfo]->web_state); | 100 EXPECT_EQ(&test_web_state_, [observer_ changeLoadingProgressInfo]->web_state); |
| 119 EXPECT_EQ(kTestLoadProgress, [observer_ changeLoadingProgressInfo]->progress); | 101 EXPECT_EQ(kTestLoadProgress, [observer_ changeLoadingProgressInfo]->progress); |
| 120 } | 102 } |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 // Tests |webState:webStateDidStartLoading:| forwarding. | 184 // Tests |webState:webStateDidStartLoading:| forwarding. |
| 203 TEST_F(WebStateObserverBridgeTest, DidStartLoading) { | 185 TEST_F(WebStateObserverBridgeTest, DidStartLoading) { |
| 204 ASSERT_FALSE([observer_ startLoadingInfo]); | 186 ASSERT_FALSE([observer_ startLoadingInfo]); |
| 205 | 187 |
| 206 bridge_->DidStartLoading(); | 188 bridge_->DidStartLoading(); |
| 207 ASSERT_TRUE([observer_ startLoadingInfo]); | 189 ASSERT_TRUE([observer_ startLoadingInfo]); |
| 208 EXPECT_EQ(&test_web_state_, [observer_ startLoadingInfo]->web_state); | 190 EXPECT_EQ(&test_web_state_, [observer_ startLoadingInfo]->web_state); |
| 209 } | 191 } |
| 210 | 192 |
| 211 } // namespace web | 193 } // namespace web |
| OLD | NEW |