| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 125 |
| 126 // Tests |webStateDidChangeTitle:| forwarding. | 126 // Tests |webStateDidChangeTitle:| forwarding. |
| 127 TEST_F(WebStateObserverBridgeTest, TitleWasSet) { | 127 TEST_F(WebStateObserverBridgeTest, TitleWasSet) { |
| 128 ASSERT_FALSE([observer_ titleWasSetInfo]); | 128 ASSERT_FALSE([observer_ titleWasSetInfo]); |
| 129 | 129 |
| 130 bridge_->TitleWasSet(); | 130 bridge_->TitleWasSet(); |
| 131 ASSERT_TRUE([observer_ titleWasSetInfo]); | 131 ASSERT_TRUE([observer_ titleWasSetInfo]); |
| 132 EXPECT_EQ(&test_web_state_, [observer_ titleWasSetInfo]->web_state); | 132 EXPECT_EQ(&test_web_state_, [observer_ titleWasSetInfo]->web_state); |
| 133 } | 133 } |
| 134 | 134 |
| 135 // Tests |webStateDidChangeVisibleSecurityState:| forwarding. |
| 136 TEST_F(WebStateObserverBridgeTest, DidChangeVisibleSecurityState) { |
| 137 ASSERT_FALSE([observer_ didChangeVisibleSecurityStateInfo]); |
| 138 |
| 139 bridge_->DidChangeVisibleSecurityState(); |
| 140 ASSERT_TRUE([observer_ didChangeVisibleSecurityStateInfo]); |
| 141 EXPECT_EQ(&test_web_state_, |
| 142 [observer_ didChangeVisibleSecurityStateInfo]->web_state); |
| 143 } |
| 144 |
| 135 // Tests |webState:didSubmitDocumentWithFormNamed:userInitiated:| forwarding. | 145 // Tests |webState:didSubmitDocumentWithFormNamed:userInitiated:| forwarding. |
| 136 TEST_F(WebStateObserverBridgeTest, DocumentSubmitted) { | 146 TEST_F(WebStateObserverBridgeTest, DocumentSubmitted) { |
| 137 ASSERT_FALSE([observer_ submitDocumentInfo]); | 147 ASSERT_FALSE([observer_ submitDocumentInfo]); |
| 138 | 148 |
| 139 std::string kTestFormName("form-name"); | 149 std::string kTestFormName("form-name"); |
| 140 BOOL user_initiated = YES; | 150 BOOL user_initiated = YES; |
| 141 bridge_->DocumentSubmitted(kTestFormName, user_initiated); | 151 bridge_->DocumentSubmitted(kTestFormName, user_initiated); |
| 142 ASSERT_TRUE([observer_ submitDocumentInfo]); | 152 ASSERT_TRUE([observer_ submitDocumentInfo]); |
| 143 EXPECT_EQ(&test_web_state_, [observer_ submitDocumentInfo]->web_state); | 153 EXPECT_EQ(&test_web_state_, [observer_ submitDocumentInfo]->web_state); |
| 144 EXPECT_EQ(kTestFormName, [observer_ submitDocumentInfo]->form_name); | 154 EXPECT_EQ(kTestFormName, [observer_ submitDocumentInfo]->form_name); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 // Tests |webState:webStateDidStartLoading:| forwarding. | 225 // Tests |webState:webStateDidStartLoading:| forwarding. |
| 216 TEST_F(WebStateObserverBridgeTest, DidStartLoading) { | 226 TEST_F(WebStateObserverBridgeTest, DidStartLoading) { |
| 217 ASSERT_FALSE([observer_ startLoadingInfo]); | 227 ASSERT_FALSE([observer_ startLoadingInfo]); |
| 218 | 228 |
| 219 bridge_->DidStartLoading(); | 229 bridge_->DidStartLoading(); |
| 220 ASSERT_TRUE([observer_ startLoadingInfo]); | 230 ASSERT_TRUE([observer_ startLoadingInfo]); |
| 221 EXPECT_EQ(&test_web_state_, [observer_ startLoadingInfo]->web_state); | 231 EXPECT_EQ(&test_web_state_, [observer_ startLoadingInfo]->web_state); |
| 222 } | 232 } |
| 223 | 233 |
| 224 } // namespace web | 234 } // namespace web |
| OLD | NEW |