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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 TEST_F(WebStateObserverBridgeTest, LoadProgressChanged) { | 94 TEST_F(WebStateObserverBridgeTest, LoadProgressChanged) { |
95 ASSERT_FALSE([observer_ changeLoadingProgressInfo]); | 95 ASSERT_FALSE([observer_ changeLoadingProgressInfo]); |
96 | 96 |
97 const double kTestLoadProgress = 0.75; | 97 const double kTestLoadProgress = 0.75; |
98 bridge_->LoadProgressChanged(kTestLoadProgress); | 98 bridge_->LoadProgressChanged(kTestLoadProgress); |
99 ASSERT_TRUE([observer_ changeLoadingProgressInfo]); | 99 ASSERT_TRUE([observer_ changeLoadingProgressInfo]); |
100 EXPECT_EQ(&test_web_state_, [observer_ changeLoadingProgressInfo]->web_state); | 100 EXPECT_EQ(&test_web_state_, [observer_ changeLoadingProgressInfo]->web_state); |
101 EXPECT_EQ(kTestLoadProgress, [observer_ changeLoadingProgressInfo]->progress); | 101 EXPECT_EQ(kTestLoadProgress, [observer_ changeLoadingProgressInfo]->progress); |
102 } | 102 } |
103 | 103 |
| 104 // Tests |webStateDidChangeTitle:| forwarding. |
| 105 TEST_F(WebStateObserverBridgeTest, TitleWasSet) { |
| 106 ASSERT_FALSE([observer_ titleWasSetInfo]); |
| 107 |
| 108 bridge_->TitleWasSet(); |
| 109 ASSERT_TRUE([observer_ titleWasSetInfo]); |
| 110 EXPECT_EQ(&test_web_state_, [observer_ titleWasSetInfo]->web_state); |
| 111 } |
| 112 |
104 // Tests |webState:didSubmitDocumentWithFormNamed:userInitiated:| forwarding. | 113 // Tests |webState:didSubmitDocumentWithFormNamed:userInitiated:| forwarding. |
105 TEST_F(WebStateObserverBridgeTest, DocumentSubmitted) { | 114 TEST_F(WebStateObserverBridgeTest, DocumentSubmitted) { |
106 ASSERT_FALSE([observer_ submitDocumentInfo]); | 115 ASSERT_FALSE([observer_ submitDocumentInfo]); |
107 | 116 |
108 std::string kTestFormName("form-name"); | 117 std::string kTestFormName("form-name"); |
109 BOOL user_initiated = YES; | 118 BOOL user_initiated = YES; |
110 bridge_->DocumentSubmitted(kTestFormName, user_initiated); | 119 bridge_->DocumentSubmitted(kTestFormName, user_initiated); |
111 ASSERT_TRUE([observer_ submitDocumentInfo]); | 120 ASSERT_TRUE([observer_ submitDocumentInfo]); |
112 EXPECT_EQ(&test_web_state_, [observer_ submitDocumentInfo]->web_state); | 121 EXPECT_EQ(&test_web_state_, [observer_ submitDocumentInfo]->web_state); |
113 EXPECT_EQ(kTestFormName, [observer_ submitDocumentInfo]->form_name); | 122 EXPECT_EQ(kTestFormName, [observer_ submitDocumentInfo]->form_name); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 // Tests |webState:webStateDidStartLoading:| forwarding. | 193 // Tests |webState:webStateDidStartLoading:| forwarding. |
185 TEST_F(WebStateObserverBridgeTest, DidStartLoading) { | 194 TEST_F(WebStateObserverBridgeTest, DidStartLoading) { |
186 ASSERT_FALSE([observer_ startLoadingInfo]); | 195 ASSERT_FALSE([observer_ startLoadingInfo]); |
187 | 196 |
188 bridge_->DidStartLoading(); | 197 bridge_->DidStartLoading(); |
189 ASSERT_TRUE([observer_ startLoadingInfo]); | 198 ASSERT_TRUE([observer_ startLoadingInfo]); |
190 EXPECT_EQ(&test_web_state_, [observer_ startLoadingInfo]->web_state); | 199 EXPECT_EQ(&test_web_state_, [observer_ startLoadingInfo]->web_state); |
191 } | 200 } |
192 | 201 |
193 } // namespace web | 202 } // namespace web |
OLD | NEW |