| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |