OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "net/base/mime_util.h" | 6 #include "net/base/mime_util.h" |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 | 8 |
9 namespace { | 9 namespace { |
10 class MimeUtilTest : public testing::Test { | 10 class MimeUtilTest : public testing::Test { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 { "\"mp4v.20.240, mp4a.40.2\"", 2, { "mp4v", "mp4a" } }, | 111 { "\"mp4v.20.240, mp4a.40.2\"", 2, { "mp4v", "mp4a" } }, |
112 { "mp4v.20.8, samr", 2, { "mp4v", "samr" } }, | 112 { "mp4v.20.8, samr", 2, { "mp4v", "samr" } }, |
113 { "\"theora, vorbis\"", 2, { "theora", "vorbis" } }, | 113 { "\"theora, vorbis\"", 2, { "theora", "vorbis" } }, |
114 { "", 1, { "" } }, | 114 { "", 1, { "" } }, |
115 { "\"\"", 1, { "" } }, | 115 { "\"\"", 1, { "" } }, |
116 { ",", 2, { "", "" } }, | 116 { ",", 2, { "", "" } }, |
117 }; | 117 }; |
118 | 118 |
119 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { | 119 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { |
120 std::vector<std::string> codecs_out; | 120 std::vector<std::string> codecs_out; |
121 net::ParseCodecString(tests[i].original, &codecs_out); | 121 net::ParseCodecString(tests[i].original, &codecs_out, true); |
122 EXPECT_EQ(tests[i].expected_size, codecs_out.size()); | 122 EXPECT_EQ(tests[i].expected_size, codecs_out.size()); |
123 for (size_t j = 0; j < tests[i].expected_size; ++j) { | 123 for (size_t j = 0; j < tests[i].expected_size; ++j) { |
124 EXPECT_EQ(tests[i].results[j], codecs_out[j]); | 124 EXPECT_EQ(tests[i].results[j], codecs_out[j]); |
125 } | 125 } |
126 } | 126 } |
| 127 |
| 128 // Test without stripping the codec type. |
| 129 std::vector<std::string> codecs_out; |
| 130 net::ParseCodecString("avc1.42E01E, mp4a.40.2", &codecs_out, false); |
| 131 EXPECT_EQ(2u, codecs_out.size()); |
| 132 EXPECT_STREQ("avc1.42E01E", codecs_out[0].c_str()); |
| 133 EXPECT_STREQ("mp4a.40.2", codecs_out[1].c_str()); |
127 } | 134 } |
OLD | NEW |