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

Side by Side Diff: media/filters/chunk_demuxer_unittest.cc

Issue 10534096: Generalize AesDecryptor to make it more spec compliant. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "media/base/audio_decoder_config.h" 6 #include "media/base/audio_decoder_config.h"
7 #include "media/base/decoder_buffer.h" 7 #include "media/base/decoder_buffer.h"
8 #include "media/base/mock_callback.h" 8 #include "media/base/mock_callback.h"
9 #include "media/base/mock_demuxer_host.h" 9 #include "media/base/mock_demuxer_host.h"
10 #include "media/base/test_data_util.h" 10 #include "media/base/test_data_util.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 public: 80 public:
81 MockChunkDemuxerClient() {} 81 MockChunkDemuxerClient() {}
82 virtual ~MockChunkDemuxerClient() {} 82 virtual ~MockChunkDemuxerClient() {}
83 83
84 MOCK_METHOD1(DemuxerOpened, void(ChunkDemuxer* demuxer)); 84 MOCK_METHOD1(DemuxerOpened, void(ChunkDemuxer* demuxer));
85 MOCK_METHOD0(DemuxerClosed, void()); 85 MOCK_METHOD0(DemuxerClosed, void());
86 // TODO(xhwang): This is a workaround of the issue that move-only parameters 86 // TODO(xhwang): This is a workaround of the issue that move-only parameters
87 // are not supported in mocked methods. Remove this when the issue is fixed. 87 // are not supported in mocked methods. Remove this when the issue is fixed.
88 // See http://code.google.com/p/googletest/issues/detail?id=395 88 // See http://code.google.com/p/googletest/issues/detail?id=395
89 MOCK_METHOD2(KeyNeededMock, void(const uint8* init_data, int init_data_size)); 89 MOCK_METHOD2(KeyNeededMock, void(const uint8* init_data, int init_data_size));
90 void KeyNeeded(scoped_array<uint8> init_data, int init_data_size) { 90 void DemuxerKeyNeeded(scoped_array<uint8> init_data, int init_data_size) {
91 KeyNeededMock(init_data.get(), init_data_size); 91 KeyNeededMock(init_data.get(), init_data_size);
92 } 92 }
93 93
94 private: 94 private:
95 DISALLOW_COPY_AND_ASSIGN(MockChunkDemuxerClient); 95 DISALLOW_COPY_AND_ASSIGN(MockChunkDemuxerClient);
96 }; 96 };
97 97
98 class ChunkDemuxerTest : public testing::Test { 98 class ChunkDemuxerTest : public testing::Test {
99 protected: 99 protected:
100 enum CodecsIndex { 100 enum CodecsIndex {
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 ASSERT_TRUE(AppendData(cluster->data(), cluster->size())); 737 ASSERT_TRUE(AppendData(cluster->data(), cluster->size()));
738 738
739 EXPECT_CALL(host_, OnDemuxerError(PIPELINE_ERROR_NETWORK)); 739 EXPECT_CALL(host_, OnDemuxerError(PIPELINE_ERROR_NETWORK));
740 demuxer_->EndOfStream(PIPELINE_ERROR_NETWORK); 740 demuxer_->EndOfStream(PIPELINE_ERROR_NETWORK);
741 } 741 }
742 742
743 // Helper class to reduce duplicate code when testing end of stream 743 // Helper class to reduce duplicate code when testing end of stream
744 // Read() behavior. 744 // Read() behavior.
745 class EndOfStreamHelper { 745 class EndOfStreamHelper {
746 public: 746 public:
747 EndOfStreamHelper(const scoped_refptr<Demuxer> demuxer) 747 explicit EndOfStreamHelper(const scoped_refptr<Demuxer> demuxer)
748 : demuxer_(demuxer), 748 : demuxer_(demuxer),
749 audio_read_done_(false), 749 audio_read_done_(false),
750 video_read_done_(false) { 750 video_read_done_(false) {
751 } 751 }
752 752
753 // Request a read on the audio and video streams. 753 // Request a read on the audio and video streams.
754 void RequestReads() { 754 void RequestReads() {
755 EXPECT_FALSE(audio_read_done_); 755 EXPECT_FALSE(audio_read_done_);
756 EXPECT_FALSE(video_read_done_); 756 EXPECT_FALSE(video_read_done_);
757 757
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 1090
1091 std::vector<std::string> codecs(1); 1091 std::vector<std::string> codecs(1);
1092 codecs[0] = "vp8"; 1092 codecs[0] = "vp8";
1093 ASSERT_EQ(demuxer_->AddId(kSourceId, "video/webm", codecs), 1093 ASSERT_EQ(demuxer_->AddId(kSourceId, "video/webm", codecs),
1094 ChunkDemuxer::kOk); 1094 ChunkDemuxer::kOk);
1095 1095
1096 ASSERT_TRUE(AppendInfoTracks(true, true, false)); 1096 ASSERT_TRUE(AppendInfoTracks(true, true, false));
1097 } 1097 }
1098 1098
1099 } // namespace media 1099 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698