OLD | NEW |
---|---|
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 <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
150 return GenerateCluster(46, 66, 5); | 150 return GenerateCluster(46, 66, 5); |
151 } | 151 } |
152 | 152 |
153 ChunkDemuxerTest() { | 153 ChunkDemuxerTest() { |
154 CreateNewDemuxer(); | 154 CreateNewDemuxer(); |
155 } | 155 } |
156 | 156 |
157 void CreateNewDemuxer() { | 157 void CreateNewDemuxer() { |
158 base::Closure open_cb = | 158 base::Closure open_cb = |
159 base::Bind(&ChunkDemuxerTest::DemuxerOpened, base::Unretained(this)); | 159 base::Bind(&ChunkDemuxerTest::DemuxerOpened, base::Unretained(this)); |
160 ChunkDemuxer::NeedKeyCB need_key_cb = | 160 Demuxer::NeedKeyCB need_key_cb = |
161 base::Bind(&ChunkDemuxerTest::DemuxerNeedKey, base::Unretained(this)); | 161 base::Bind(&ChunkDemuxerTest::DemuxerNeedKey, base::Unretained(this)); |
162 AddTextTrackCB add_text_track_cb = | 162 AddTextTrackCB add_text_track_cb = |
163 base::Bind(&ChunkDemuxerTest::OnTextTrack, base::Unretained(this)); | 163 base::Bind(&ChunkDemuxerTest::OnTextTrack, base::Unretained(this)); |
164 demuxer_.reset(new ChunkDemuxer(open_cb, need_key_cb, | 164 demuxer_.reset(new ChunkDemuxer(open_cb, need_key_cb, |
165 add_text_track_cb, LogCB())); | 165 add_text_track_cb, LogCB())); |
166 } | 166 } |
167 | 167 |
168 virtual ~ChunkDemuxerTest() { | 168 virtual ~ChunkDemuxerTest() { |
169 ShutdownDemuxer(); | 169 ShutdownDemuxer(); |
170 } | 170 } |
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
849 } | 849 } |
850 | 850 |
851 MOCK_METHOD0(DemuxerOpened, void()); | 851 MOCK_METHOD0(DemuxerOpened, void()); |
852 // TODO(xhwang): This is a workaround of the issue that move-only parameters | 852 // TODO(xhwang): This is a workaround of the issue that move-only parameters |
853 // are not supported in mocked methods. Remove this when the issue is fixed | 853 // are not supported in mocked methods. Remove this when the issue is fixed |
854 // (http://code.google.com/p/googletest/issues/detail?id=395) or when we use | 854 // (http://code.google.com/p/googletest/issues/detail?id=395) or when we use |
855 // std::string instead of scoped_ptr<uint8[]> (http://crbug.com/130689). | 855 // std::string instead of scoped_ptr<uint8[]> (http://crbug.com/130689). |
856 MOCK_METHOD3(NeedKeyMock, void(const std::string& type, | 856 MOCK_METHOD3(NeedKeyMock, void(const std::string& type, |
857 const uint8* init_data, int init_data_size)); | 857 const uint8* init_data, int init_data_size)); |
858 void DemuxerNeedKey(const std::string& type, | 858 void DemuxerNeedKey(const std::string& type, |
859 scoped_ptr<uint8[]> init_data, int init_data_size) { | 859 const std::vector<uint8>& init_data) { |
860 NeedKeyMock(type, init_data.get(), init_data_size); | 860 NeedKeyMock(type, &init_data[0], init_data.size()); |
xhwang
2013/08/23 17:24:37
ditto
acolwell GONE FROM CHROMIUM
2013/08/23 19:55:28
Done.
| |
861 } | 861 } |
862 | 862 |
863 scoped_ptr<TextTrack> OnTextTrack(TextKind kind, | 863 scoped_ptr<TextTrack> OnTextTrack(TextKind kind, |
864 const std::string& label, | 864 const std::string& label, |
865 const std::string& language) { | 865 const std::string& language) { |
866 return scoped_ptr<TextTrack>(); | 866 return scoped_ptr<TextTrack>(); |
867 } | 867 } |
868 | 868 |
869 void Seek(base::TimeDelta seek_time) { | 869 void Seek(base::TimeDelta seek_time) { |
870 demuxer_->StartWaitingForSeek(seek_time); | 870 demuxer_->StartWaitingForSeek(seek_time); |
(...skipping 1735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2606 | 2606 |
2607 TEST_F(ChunkDemuxerTest, StartWaitingForSeekAfterParseError) { | 2607 TEST_F(ChunkDemuxerTest, StartWaitingForSeekAfterParseError) { |
2608 ASSERT_TRUE(InitDemuxer(true, true)); | 2608 ASSERT_TRUE(InitDemuxer(true, true)); |
2609 EXPECT_CALL(host_, OnDemuxerError(PIPELINE_ERROR_DECODE)); | 2609 EXPECT_CALL(host_, OnDemuxerError(PIPELINE_ERROR_DECODE)); |
2610 AppendGarbage(); | 2610 AppendGarbage(); |
2611 base::TimeDelta seek_time = base::TimeDelta::FromSeconds(50); | 2611 base::TimeDelta seek_time = base::TimeDelta::FromSeconds(50); |
2612 demuxer_->StartWaitingForSeek(seek_time); | 2612 demuxer_->StartWaitingForSeek(seek_time); |
2613 } | 2613 } |
2614 | 2614 |
2615 } // namespace media | 2615 } // namespace media |
OLD | NEW |