| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/web_state/web_state_impl.h" | 5 #import "ios/web/web_state/web_state_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 EXPECT_TRUE(expected_value->Equals(&value)); | 155 EXPECT_TRUE(expected_value->Equals(&value)); |
| 156 EXPECT_EQ(expected_url, url); | 156 EXPECT_EQ(expected_url, url); |
| 157 return should_handle; | 157 return should_handle; |
| 158 } | 158 } |
| 159 | 159 |
| 160 } // namespace | 160 } // namespace |
| 161 | 161 |
| 162 // Test fixture for web::WebStateImpl class. | 162 // Test fixture for web::WebStateImpl class. |
| 163 class WebStateImplTest : public web::WebTest { | 163 class WebStateImplTest : public web::WebTest { |
| 164 protected: | 164 protected: |
| 165 WebStateImplTest() : web_state_(new WebStateImpl(GetBrowserState())) {} | 165 WebStateImplTest() : web::WebTest() { |
| 166 web::WebState::CreateParams params(GetBrowserState()); |
| 167 web_state_ = base::MakeUnique<web::WebStateImpl>(params); |
| 168 } |
| 166 | 169 |
| 167 std::unique_ptr<WebStateImpl> web_state_; | 170 std::unique_ptr<WebStateImpl> web_state_; |
| 168 }; | 171 }; |
| 169 | 172 |
| 170 TEST_F(WebStateImplTest, WebUsageEnabled) { | 173 TEST_F(WebStateImplTest, WebUsageEnabled) { |
| 171 // Default is false. | 174 // Default is false. |
| 172 ASSERT_FALSE(web_state_->IsWebUsageEnabled()); | 175 ASSERT_FALSE(web_state_->IsWebUsageEnabled()); |
| 173 | 176 |
| 174 web_state_->SetWebUsageEnabled(true); | 177 web_state_->SetWebUsageEnabled(true); |
| 175 EXPECT_TRUE(web_state_->IsWebUsageEnabled()); | 178 EXPECT_TRUE(web_state_->IsWebUsageEnabled()); |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 // Check that a false return value is forwarded correctly. | 671 // Check that a false return value is forwarded correctly. |
| 669 EXPECT_FALSE( | 672 EXPECT_FALSE( |
| 670 web_state_->OnScriptCommandReceived(kCommand2, value_2, kUrl2, false)); | 673 web_state_->OnScriptCommandReceived(kCommand2, value_2, kUrl2, false)); |
| 671 EXPECT_FALSE(is_called_1); | 674 EXPECT_FALSE(is_called_1); |
| 672 EXPECT_TRUE(is_called_2); | 675 EXPECT_TRUE(is_called_2); |
| 673 | 676 |
| 674 web_state_->RemoveScriptCommandCallback(kPrefix2); | 677 web_state_->RemoveScriptCommandCallback(kPrefix2); |
| 675 } | 678 } |
| 676 | 679 |
| 677 } // namespace web | 680 } // namespace web |
| OLD | NEW |