OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/strings/string_split.h" | 6 #include "base/strings/string_split.h" |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 #include "media/base/mime_util.h" | 8 #include "media/base/mime_util.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 } tests[] = { | 113 } tests[] = { |
114 { "\"bogus\"", 1, { "bogus" } }, | 114 { "\"bogus\"", 1, { "bogus" } }, |
115 { "0", 1, { "0" } }, | 115 { "0", 1, { "0" } }, |
116 { "avc1.42E01E, mp4a.40.2", 2, { "avc1", "mp4a" } }, | 116 { "avc1.42E01E, mp4a.40.2", 2, { "avc1", "mp4a" } }, |
117 { "\"mp4v.20.240, mp4a.40.2\"", 2, { "mp4v", "mp4a" } }, | 117 { "\"mp4v.20.240, mp4a.40.2\"", 2, { "mp4v", "mp4a" } }, |
118 { "mp4v.20.8, samr", 2, { "mp4v", "samr" } }, | 118 { "mp4v.20.8, samr", 2, { "mp4v", "samr" } }, |
119 { "\"theora, vorbis\"", 2, { "theora", "vorbis" } }, | 119 { "\"theora, vorbis\"", 2, { "theora", "vorbis" } }, |
120 { "", 0, { } }, | 120 { "", 0, { } }, |
121 { "\"\"", 0, { } }, | 121 { "\"\"", 0, { } }, |
122 { "\" \"", 0, { } }, | 122 { "\" \"", 0, { } }, |
123 { ",", 2, { "", "" } }, | 123 { ",", 0, { } }, |
124 }; | 124 }; |
125 | 125 |
126 for (size_t i = 0; i < arraysize(tests); ++i) { | 126 for (size_t i = 0; i < arraysize(tests); ++i) { |
127 std::vector<std::string> codecs_out; | 127 std::vector<std::string> codecs_out; |
128 ParseCodecString(tests[i].original, &codecs_out, true); | 128 ParseCodecString(tests[i].original, &codecs_out, true); |
129 ASSERT_EQ(tests[i].expected_size, codecs_out.size()); | 129 ASSERT_EQ(tests[i].expected_size, codecs_out.size()); |
130 for (size_t j = 0; j < tests[i].expected_size; ++j) | 130 for (size_t j = 0; j < tests[i].expected_size; ++j) |
131 EXPECT_EQ(tests[i].results[j], codecs_out[j]); | 131 EXPECT_EQ(tests[i].results[j], codecs_out[j]); |
132 } | 132 } |
133 | 133 |
134 // Test without stripping the codec type. | 134 // Test without stripping the codec type. |
135 std::vector<std::string> codecs_out; | 135 std::vector<std::string> codecs_out; |
136 ParseCodecString("avc1.42E01E, mp4a.40.2", &codecs_out, false); | 136 ParseCodecString("avc1.42E01E, mp4a.40.2", &codecs_out, false); |
137 ASSERT_EQ(2u, codecs_out.size()); | 137 ASSERT_EQ(2u, codecs_out.size()); |
138 EXPECT_EQ("avc1.42E01E", codecs_out[0]); | 138 EXPECT_EQ("avc1.42E01E", codecs_out[0]); |
139 EXPECT_EQ("mp4a.40.2", codecs_out[1]); | 139 EXPECT_EQ("mp4a.40.2", codecs_out[1]); |
140 } | 140 } |
141 | 141 |
142 } // namespace media | 142 } // namespace media |
OLD | NEW |