Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(224)

Side by Side Diff: webkit/glue/media/buffered_resource_loader_unittest.cc

Issue 6580014: Make playback fail if redirected to a different origin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698