| 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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 EXPECT_TRUE(web_state_->IsLoading()); | 275 EXPECT_TRUE(web_state_->IsLoading()); |
| 276 base::test::ios::WaitUntilCondition(^bool() { | 276 base::test::ios::WaitUntilCondition(^bool() { |
| 277 return !web_state_->IsLoading(); | 277 return !web_state_->IsLoading(); |
| 278 }); | 278 }); |
| 279 } | 279 } |
| 280 | 280 |
| 281 web::TestBrowserState browser_state_; | 281 web::TestBrowserState browser_state_; |
| 282 std::unique_ptr<WebStateImpl> web_state_; | 282 std::unique_ptr<WebStateImpl> web_state_; |
| 283 }; | 283 }; |
| 284 | 284 |
| 285 TEST_F(WebStateTest, WebUsageEnabled) { |
| 286 // Default is false. |
| 287 ASSERT_FALSE(web_state_->IsWebUsageEnabled()); |
| 288 |
| 289 web_state_->SetWebUsageEnabled(true); |
| 290 EXPECT_TRUE(web_state_->IsWebUsageEnabled()); |
| 291 EXPECT_TRUE(web_state_->GetWebController().webUsageEnabled); |
| 292 |
| 293 web_state_->SetWebUsageEnabled(false); |
| 294 EXPECT_FALSE(web_state_->IsWebUsageEnabled()); |
| 295 EXPECT_FALSE(web_state_->GetWebController().webUsageEnabled); |
| 296 } |
| 297 |
| 285 TEST_F(WebStateTest, ResponseHeaders) { | 298 TEST_F(WebStateTest, ResponseHeaders) { |
| 286 GURL real_url("http://foo.com/bar"); | 299 GURL real_url("http://foo.com/bar"); |
| 287 GURL frame_url("http://frames-r-us.com/"); | 300 GURL frame_url("http://frames-r-us.com/"); |
| 288 scoped_refptr<net::HttpResponseHeaders> real_headers(HeadersFromString( | 301 scoped_refptr<net::HttpResponseHeaders> real_headers(HeadersFromString( |
| 289 "HTTP/1.1 200 OK\r\n" | 302 "HTTP/1.1 200 OK\r\n" |
| 290 "Content-Type: text/html\r\n" | 303 "Content-Type: text/html\r\n" |
| 291 "Content-Language: en\r\n" | 304 "Content-Language: en\r\n" |
| 292 "X-Should-Be-Here: yep\r\n" | 305 "X-Should-Be-Here: yep\r\n" |
| 293 "\r\n")); | 306 "\r\n")); |
| 294 scoped_refptr<net::HttpResponseHeaders> frame_headers(HeadersFromString( | 307 scoped_refptr<net::HttpResponseHeaders> frame_headers(HeadersFromString( |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 return execution_result.get(); | 589 return execution_result.get(); |
| 577 }); | 590 }); |
| 578 | 591 |
| 579 std::string string_result; | 592 std::string string_result; |
| 580 execution_result->GetAsString(&string_result); | 593 execution_result->GetAsString(&string_result); |
| 581 EXPECT_EQ("bar", string_result); | 594 EXPECT_EQ("bar", string_result); |
| 582 } | 595 } |
| 583 | 596 |
| 584 } // namespace | 597 } // namespace |
| 585 } // namespace web | 598 } // namespace web |
| OLD | NEW |