| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 TEST_F(WebStateObserverBridgeTest, LoadProgressChanged) { | 112 TEST_F(WebStateObserverBridgeTest, LoadProgressChanged) { |
| 113 ASSERT_FALSE([observer_ changeLoadingProgressInfo]); | 113 ASSERT_FALSE([observer_ changeLoadingProgressInfo]); |
| 114 | 114 |
| 115 const double kTestLoadProgress = 0.75; | 115 const double kTestLoadProgress = 0.75; |
| 116 bridge_->LoadProgressChanged(kTestLoadProgress); | 116 bridge_->LoadProgressChanged(kTestLoadProgress); |
| 117 ASSERT_TRUE([observer_ changeLoadingProgressInfo]); | 117 ASSERT_TRUE([observer_ changeLoadingProgressInfo]); |
| 118 EXPECT_EQ(&test_web_state_, [observer_ changeLoadingProgressInfo]->web_state); | 118 EXPECT_EQ(&test_web_state_, [observer_ changeLoadingProgressInfo]->web_state); |
| 119 EXPECT_EQ(kTestLoadProgress, [observer_ changeLoadingProgressInfo]->progress); | 119 EXPECT_EQ(kTestLoadProgress, [observer_ changeLoadingProgressInfo]->progress); |
| 120 } | 120 } |
| 121 | 121 |
| 122 // Tests |webStateDidChangeTitle:| forwarding. |
| 123 TEST_F(WebStateObserverBridgeTest, TitleWasSet) { |
| 124 ASSERT_FALSE([observer_ titleWasSetInfo]); |
| 125 |
| 126 bridge_->TitleWasSet(); |
| 127 ASSERT_TRUE([observer_ titleWasSetInfo]); |
| 128 EXPECT_EQ(&test_web_state_, [observer_ titleWasSetInfo]->web_state); |
| 129 } |
| 130 |
| 122 // Tests |webState:didSubmitDocumentWithFormNamed:userInitiated:| forwarding. | 131 // Tests |webState:didSubmitDocumentWithFormNamed:userInitiated:| forwarding. |
| 123 TEST_F(WebStateObserverBridgeTest, DocumentSubmitted) { | 132 TEST_F(WebStateObserverBridgeTest, DocumentSubmitted) { |
| 124 ASSERT_FALSE([observer_ submitDocumentInfo]); | 133 ASSERT_FALSE([observer_ submitDocumentInfo]); |
| 125 | 134 |
| 126 std::string kTestFormName("form-name"); | 135 std::string kTestFormName("form-name"); |
| 127 BOOL user_initiated = YES; | 136 BOOL user_initiated = YES; |
| 128 bridge_->DocumentSubmitted(kTestFormName, user_initiated); | 137 bridge_->DocumentSubmitted(kTestFormName, user_initiated); |
| 129 ASSERT_TRUE([observer_ submitDocumentInfo]); | 138 ASSERT_TRUE([observer_ submitDocumentInfo]); |
| 130 EXPECT_EQ(&test_web_state_, [observer_ submitDocumentInfo]->web_state); | 139 EXPECT_EQ(&test_web_state_, [observer_ submitDocumentInfo]->web_state); |
| 131 EXPECT_EQ(kTestFormName, [observer_ submitDocumentInfo]->form_name); | 140 EXPECT_EQ(kTestFormName, [observer_ submitDocumentInfo]->form_name); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 // Tests |webState:webStateDidStartLoading:| forwarding. | 211 // Tests |webState:webStateDidStartLoading:| forwarding. |
| 203 TEST_F(WebStateObserverBridgeTest, DidStartLoading) { | 212 TEST_F(WebStateObserverBridgeTest, DidStartLoading) { |
| 204 ASSERT_FALSE([observer_ startLoadingInfo]); | 213 ASSERT_FALSE([observer_ startLoadingInfo]); |
| 205 | 214 |
| 206 bridge_->DidStartLoading(); | 215 bridge_->DidStartLoading(); |
| 207 ASSERT_TRUE([observer_ startLoadingInfo]); | 216 ASSERT_TRUE([observer_ startLoadingInfo]); |
| 208 EXPECT_EQ(&test_web_state_, [observer_ startLoadingInfo]->web_state); | 217 EXPECT_EQ(&test_web_state_, [observer_ startLoadingInfo]->web_state); |
| 209 } | 218 } |
| 210 | 219 |
| 211 } // namespace web | 220 } // namespace web |
| OLD | NEW |