| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
| 8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
| 9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
| 10 #include "net/http/http_util.h" | 10 #include "net/http/http_util.h" |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 Start(); | 519 Start(); |
| 520 Redirect(kHttpRedirectToSameDomainUrl1); | 520 Redirect(kHttpRedirectToSameDomainUrl1); |
| 521 Redirect(kHttpRedirectToSameDomainUrl2); | 521 Redirect(kHttpRedirectToSameDomainUrl2); |
| 522 FullResponse(1024); | 522 FullResponse(1024); |
| 523 EXPECT_TRUE(loader_->HasSingleOrigin()); | 523 EXPECT_TRUE(loader_->HasSingleOrigin()); |
| 524 StopWhenLoad(); | 524 StopWhenLoad(); |
| 525 | 525 |
| 526 // Test redirect to a different domain. | 526 // Test redirect to a different domain. |
| 527 Initialize(kHttpUrl, -1, -1); | 527 Initialize(kHttpUrl, -1, -1); |
| 528 Start(); | 528 Start(); |
| 529 EXPECT_CALL(*this, StartCallback(net::ERR_ADDRESS_INVALID)); |
| 529 Redirect(kHttpRedirectToDifferentDomainUrl1); | 530 Redirect(kHttpRedirectToDifferentDomainUrl1); |
| 530 FullResponse(1024); | |
| 531 EXPECT_FALSE(loader_->HasSingleOrigin()); | 531 EXPECT_FALSE(loader_->HasSingleOrigin()); |
| 532 StopWhenLoad(); | 532 StopWhenLoad(); |
| 533 | 533 |
| 534 // Test redirect twice to a different domain. | 534 // Test redirect to the same domain and then to a different domain. |
| 535 Initialize(kHttpUrl, -1, -1); | 535 Initialize(kHttpUrl, -1, -1); |
| 536 Start(); | 536 Start(); |
| 537 Redirect(kHttpRedirectToSameDomainUrl1); |
| 538 EXPECT_CALL(*this, StartCallback(net::ERR_ADDRESS_INVALID)); |
| 537 Redirect(kHttpRedirectToDifferentDomainUrl1); | 539 Redirect(kHttpRedirectToDifferentDomainUrl1); |
| 538 Redirect(kHttpRedirectToDifferentDomainUrl2); | |
| 539 FullResponse(1024); | |
| 540 EXPECT_FALSE(loader_->HasSingleOrigin()); | |
| 541 StopWhenLoad(); | |
| 542 | |
| 543 // Test to a different domain and then back to the same domain. | |
| 544 // NOTE: A different origin was encountered at least once so that | |
| 545 // makes HasSingleOrigin() become false. | |
| 546 Initialize(kHttpUrl, -1, -1); | |
| 547 Start(); | |
| 548 Redirect(kHttpRedirectToDifferentDomainUrl1); | |
| 549 Redirect(kHttpRedirectToSameDomainUrl1); | |
| 550 FullResponse(1024); | |
| 551 EXPECT_FALSE(loader_->HasSingleOrigin()); | 540 EXPECT_FALSE(loader_->HasSingleOrigin()); |
| 552 StopWhenLoad(); | 541 StopWhenLoad(); |
| 553 } | 542 } |
| 554 | 543 |
| 555 // TODO(hclam): add unit test for defer loading. | 544 // TODO(hclam): add unit test for defer loading. |
| 556 | 545 |
| 557 } // namespace webkit_glue | 546 } // namespace webkit_glue |
| OLD | NEW |