| 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 #include "ios/web/web_state/web_state_impl.h" | 5 #include "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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 | 289 |
| 290 web_state_->SetWebUsageEnabled(true); | 290 web_state_->SetWebUsageEnabled(true); |
| 291 EXPECT_TRUE(web_state_->IsWebUsageEnabled()); | 291 EXPECT_TRUE(web_state_->IsWebUsageEnabled()); |
| 292 EXPECT_TRUE(web_state_->GetWebController().webUsageEnabled); | 292 EXPECT_TRUE(web_state_->GetWebController().webUsageEnabled); |
| 293 | 293 |
| 294 web_state_->SetWebUsageEnabled(false); | 294 web_state_->SetWebUsageEnabled(false); |
| 295 EXPECT_FALSE(web_state_->IsWebUsageEnabled()); | 295 EXPECT_FALSE(web_state_->IsWebUsageEnabled()); |
| 296 EXPECT_FALSE(web_state_->GetWebController().webUsageEnabled); | 296 EXPECT_FALSE(web_state_->GetWebController().webUsageEnabled); |
| 297 } | 297 } |
| 298 | 298 |
| 299 TEST_F(WebStateTest, ShouldSuppressDialogs) { |
| 300 // Default is false. |
| 301 ASSERT_FALSE(web_state_->ShouldSuppressDialogs()); |
| 302 |
| 303 web_state_->SetShouldSuppressDialogs(true); |
| 304 EXPECT_TRUE(web_state_->ShouldSuppressDialogs()); |
| 305 EXPECT_TRUE(web_state_->GetWebController().shouldSuppressDialogs); |
| 306 |
| 307 web_state_->SetShouldSuppressDialogs(false); |
| 308 EXPECT_FALSE(web_state_->ShouldSuppressDialogs()); |
| 309 EXPECT_FALSE(web_state_->GetWebController().shouldSuppressDialogs); |
| 310 } |
| 311 |
| 299 TEST_F(WebStateTest, ResponseHeaders) { | 312 TEST_F(WebStateTest, ResponseHeaders) { |
| 300 GURL real_url("http://foo.com/bar"); | 313 GURL real_url("http://foo.com/bar"); |
| 301 GURL frame_url("http://frames-r-us.com/"); | 314 GURL frame_url("http://frames-r-us.com/"); |
| 302 scoped_refptr<net::HttpResponseHeaders> real_headers(HeadersFromString( | 315 scoped_refptr<net::HttpResponseHeaders> real_headers(HeadersFromString( |
| 303 "HTTP/1.1 200 OK\r\n" | 316 "HTTP/1.1 200 OK\r\n" |
| 304 "Content-Type: text/html\r\n" | 317 "Content-Type: text/html\r\n" |
| 305 "Content-Language: en\r\n" | 318 "Content-Language: en\r\n" |
| 306 "X-Should-Be-Here: yep\r\n" | 319 "X-Should-Be-Here: yep\r\n" |
| 307 "\r\n")); | 320 "\r\n")); |
| 308 scoped_refptr<net::HttpResponseHeaders> frame_headers(HeadersFromString( | 321 scoped_refptr<net::HttpResponseHeaders> frame_headers(HeadersFromString( |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 "</script>"); | 638 "</script>"); |
| 626 | 639 |
| 627 base::test::ios::WaitUntilCondition(^{ | 640 base::test::ios::WaitUntilCondition(^{ |
| 628 return message_received; | 641 return message_received; |
| 629 }); | 642 }); |
| 630 web_state_->RemoveScriptCommandCallback("test"); | 643 web_state_->RemoveScriptCommandCallback("test"); |
| 631 } | 644 } |
| 632 | 645 |
| 633 } // namespace | 646 } // namespace |
| 634 } // namespace web | 647 } // namespace web |
| OLD | NEW |