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

Side by Side Diff: media/blink/multibuffer_data_source_unittest.cc

Issue 2267963002: Add support for cancellation of demuxer reads. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix and add tests. Created 4 years, 3 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
« no previous file with comments | « media/blink/multibuffer_data_source.cc ('k') | media/filters/blocking_url_protocol.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 Stop(); 605 Stop();
606 } 606 }
607 607
608 TEST_F(MultibufferDataSourceTest, Http_AbortWhileReading) { 608 TEST_F(MultibufferDataSourceTest, Http_AbortWhileReading) {
609 InitializeWith206Response(); 609 InitializeWith206Response();
610 610
611 // Make sure there's a pending read -- we'll expect it to error. 611 // Make sure there's a pending read -- we'll expect it to error.
612 ReadAt(kFileSize); 612 ReadAt(kFileSize);
613 613
614 // Abort!!! 614 // Abort!!!
615 EXPECT_CALL(*this, ReadCallback(media::DataSource::kReadError)); 615 EXPECT_CALL(*this, ReadCallback(media::DataSource::kAborted));
616 data_source_->Abort(); 616 data_source_->Abort();
617 base::RunLoop().RunUntilIdle(); 617 base::RunLoop().RunUntilIdle();
618 618
619 EXPECT_FALSE(loading()); 619 EXPECT_TRUE(loading());
620 Stop(); 620 Stop();
621 } 621 }
622 622
623 TEST_F(MultibufferDataSourceTest, File_AbortWhileReading) { 623 TEST_F(MultibufferDataSourceTest, File_AbortWhileReading) {
624 InitializeWithFileResponse(); 624 InitializeWithFileResponse();
625 625
626 // Make sure there's a pending read -- we'll expect it to error. 626 // Make sure there's a pending read -- we'll expect it to error.
627 ReadAt(kFileSize); 627 ReadAt(kFileSize);
628 628
629 // Abort!!! 629 // Abort!!!
630 EXPECT_CALL(*this, ReadCallback(media::DataSource::kReadError)); 630 EXPECT_CALL(*this, ReadCallback(media::DataSource::kAborted));
631 data_source_->Abort(); 631 data_source_->Abort();
632 base::RunLoop().RunUntilIdle(); 632 base::RunLoop().RunUntilIdle();
633 633
634 EXPECT_FALSE(loading()); 634 EXPECT_TRUE(loading());
635 Stop(); 635 Stop();
636 } 636 }
637 637
638 TEST_F(MultibufferDataSourceTest, Http_Retry) { 638 TEST_F(MultibufferDataSourceTest, Http_Retry) {
639 InitializeWith206Response(); 639 InitializeWith206Response();
640 640
641 // Read to advance our position. 641 // Read to advance our position.
642 EXPECT_CALL(*this, ReadCallback(kDataSize)); 642 EXPECT_CALL(*this, ReadCallback(kDataSize));
643 ReadAt(0); 643 ReadAt(0);
644 644
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after
1472 FinishLoading(); 1472 FinishLoading();
1473 1473
1474 // Verify that if reader_ is null, DidPassCORSAccessCheck still returns true. 1474 // Verify that if reader_ is null, DidPassCORSAccessCheck still returns true.
1475 data_source_->Stop(); 1475 data_source_->Stop();
1476 base::RunLoop().RunUntilIdle(); 1476 base::RunLoop().RunUntilIdle();
1477 1477
1478 EXPECT_TRUE(data_source_->DidPassCORSAccessCheck()); 1478 EXPECT_TRUE(data_source_->DidPassCORSAccessCheck());
1479 } 1479 }
1480 1480
1481 } // namespace media 1481 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/multibuffer_data_source.cc ('k') | media/filters/blocking_url_protocol.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698