OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "base/logging.h" | 5 #include "base/logging.h" |
6 #include "media/webm/tracks_builder.h" | 6 #include "media/webm/tracks_builder.h" |
7 #include "media/webm/webm_constants.h" | 7 #include "media/webm/webm_constants.h" |
8 #include "media/webm/webm_tracks_parser.h" | 8 #include "media/webm/webm_tracks_parser.h" |
9 #include "testing/gmock/include/gmock/gmock.h" | 9 #include "testing/gmock/include/gmock/gmock.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 int result = parser->Parse(buffer, buffer_size); | 30 int result = parser->Parse(buffer, buffer_size); |
31 EXPECT_GT(result, 0); | 31 EXPECT_GT(result, 0); |
32 EXPECT_EQ(result, buffer_size); | 32 EXPECT_EQ(result, buffer_size); |
33 | 33 |
34 const WebMTracksParser::TextTracks& text_tracks = parser->text_tracks(); | 34 const WebMTracksParser::TextTracks& text_tracks = parser->text_tracks(); |
35 EXPECT_EQ(text_tracks.size(), WebMTracksParser::TextTracks::size_type(1)); | 35 EXPECT_EQ(text_tracks.size(), WebMTracksParser::TextTracks::size_type(1)); |
36 | 36 |
37 const WebMTracksParser::TextTracks::const_iterator itr = text_tracks.begin(); | 37 const WebMTracksParser::TextTracks::const_iterator itr = text_tracks.begin(); |
38 EXPECT_EQ(itr->first, 1); // track num | 38 EXPECT_EQ(itr->first, 1); // track num |
39 | 39 |
40 const WebMTracksParser::TextTrackInfo& info = itr->second; | 40 const TextTrackConfig& config = itr->second; |
41 EXPECT_EQ(info.kind, text_kind); | 41 EXPECT_EQ(config.kind(), text_kind); |
42 EXPECT_TRUE(info.name == name); | 42 EXPECT_TRUE(config.label() == name); |
43 EXPECT_TRUE(info.language == language); | 43 EXPECT_TRUE(config.language() == language); |
44 } | 44 } |
45 | 45 |
46 TEST_F(WebMTracksParserTest, SubtitleNoNameNoLang) { | 46 TEST_F(WebMTracksParserTest, SubtitleNoNameNoLang) { |
47 InSequence s; | 47 InSequence s; |
48 | 48 |
49 TracksBuilder tb; | 49 TracksBuilder tb; |
50 tb.AddTrack(1, kWebMTrackTypeSubtitlesOrCaptions, | 50 tb.AddTrack(1, kWebMTrackTypeSubtitlesOrCaptions, |
51 kWebMCodecSubtitles, "", ""); | 51 kWebMCodecSubtitles, "", ""); |
52 | 52 |
53 const std::vector<uint8> buf = tb.Finish(); | 53 const std::vector<uint8> buf = tb.Finish(); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 parser.reset(new WebMTracksParser(LogCB(), false)); | 113 parser.reset(new WebMTracksParser(LogCB(), false)); |
114 | 114 |
115 result = parser->Parse(&buf[0], buf.size()); | 115 result = parser->Parse(&buf[0], buf.size()); |
116 EXPECT_GT(result, 0); | 116 EXPECT_GT(result, 0); |
117 | 117 |
118 EXPECT_EQ(parser->ignored_tracks().size(), 0u); | 118 EXPECT_EQ(parser->ignored_tracks().size(), 0u); |
119 EXPECT_EQ(parser->text_tracks().size(), 2u); | 119 EXPECT_EQ(parser->text_tracks().size(), 2u); |
120 } | 120 } |
121 | 121 |
122 } // namespace media | 122 } // namespace media |
OLD | NEW |