| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 // Tests |webStateDidChangeVisibleSecurityState:| forwarding. | 135 // Tests |webStateDidChangeVisibleSecurityState:| forwarding. |
| 136 TEST_F(WebStateObserverBridgeTest, DidChangeVisibleSecurityState) { | 136 TEST_F(WebStateObserverBridgeTest, DidChangeVisibleSecurityState) { |
| 137 ASSERT_FALSE([observer_ didChangeVisibleSecurityStateInfo]); | 137 ASSERT_FALSE([observer_ didChangeVisibleSecurityStateInfo]); |
| 138 | 138 |
| 139 bridge_->DidChangeVisibleSecurityState(); | 139 bridge_->DidChangeVisibleSecurityState(); |
| 140 ASSERT_TRUE([observer_ didChangeVisibleSecurityStateInfo]); | 140 ASSERT_TRUE([observer_ didChangeVisibleSecurityStateInfo]); |
| 141 EXPECT_EQ(&test_web_state_, | 141 EXPECT_EQ(&test_web_state_, |
| 142 [observer_ didChangeVisibleSecurityStateInfo]->web_state); | 142 [observer_ didChangeVisibleSecurityStateInfo]->web_state); |
| 143 } | 143 } |
| 144 | 144 |
| 145 // Tests |webStateDidSuppressDialog:| forwarding. |
| 146 TEST_F(WebStateObserverBridgeTest, DidSuppressDialog) { |
| 147 ASSERT_FALSE([observer_ didSuppressDialogInfo]); |
| 148 |
| 149 bridge_->DidSuppressDialog(); |
| 150 ASSERT_TRUE([observer_ didSuppressDialogInfo]); |
| 151 EXPECT_EQ(&test_web_state_, [observer_ didSuppressDialogInfo]->web_state); |
| 152 } |
| 153 |
| 145 // Tests |webState:didSubmitDocumentWithFormNamed:userInitiated:| forwarding. | 154 // Tests |webState:didSubmitDocumentWithFormNamed:userInitiated:| forwarding. |
| 146 TEST_F(WebStateObserverBridgeTest, DocumentSubmitted) { | 155 TEST_F(WebStateObserverBridgeTest, DocumentSubmitted) { |
| 147 ASSERT_FALSE([observer_ submitDocumentInfo]); | 156 ASSERT_FALSE([observer_ submitDocumentInfo]); |
| 148 | 157 |
| 149 std::string kTestFormName("form-name"); | 158 std::string kTestFormName("form-name"); |
| 150 BOOL user_initiated = YES; | 159 BOOL user_initiated = YES; |
| 151 bridge_->DocumentSubmitted(kTestFormName, user_initiated); | 160 bridge_->DocumentSubmitted(kTestFormName, user_initiated); |
| 152 ASSERT_TRUE([observer_ submitDocumentInfo]); | 161 ASSERT_TRUE([observer_ submitDocumentInfo]); |
| 153 EXPECT_EQ(&test_web_state_, [observer_ submitDocumentInfo]->web_state); | 162 EXPECT_EQ(&test_web_state_, [observer_ submitDocumentInfo]->web_state); |
| 154 EXPECT_EQ(kTestFormName, [observer_ submitDocumentInfo]->form_name); | 163 EXPECT_EQ(kTestFormName, [observer_ submitDocumentInfo]->form_name); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 // Tests |webState:webStateDidStartLoading:| forwarding. | 234 // Tests |webState:webStateDidStartLoading:| forwarding. |
| 226 TEST_F(WebStateObserverBridgeTest, DidStartLoading) { | 235 TEST_F(WebStateObserverBridgeTest, DidStartLoading) { |
| 227 ASSERT_FALSE([observer_ startLoadingInfo]); | 236 ASSERT_FALSE([observer_ startLoadingInfo]); |
| 228 | 237 |
| 229 bridge_->DidStartLoading(); | 238 bridge_->DidStartLoading(); |
| 230 ASSERT_TRUE([observer_ startLoadingInfo]); | 239 ASSERT_TRUE([observer_ startLoadingInfo]); |
| 231 EXPECT_EQ(&test_web_state_, [observer_ startLoadingInfo]->web_state); | 240 EXPECT_EQ(&test_web_state_, [observer_ startLoadingInfo]->web_state); |
| 232 } | 241 } |
| 233 | 242 |
| 234 } // namespace web | 243 } // namespace web |
| OLD | NEW |