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

Side by Side Diff: net/base/mime_util_unittest.cc

Issue 10448109: Move function for classifying a string as a mime type into MimeUtil (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
« net/base/mime_util.cc ('K') | « net/base/mime_util.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 net { 9 namespace net {
10 10
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } 119 }
120 120
121 // Test without stripping the codec type. 121 // Test without stripping the codec type.
122 std::vector<std::string> codecs_out; 122 std::vector<std::string> codecs_out;
123 ParseCodecString("avc1.42E01E, mp4a.40.2", &codecs_out, false); 123 ParseCodecString("avc1.42E01E, mp4a.40.2", &codecs_out, false);
124 ASSERT_EQ(2u, codecs_out.size()); 124 ASSERT_EQ(2u, codecs_out.size());
125 EXPECT_EQ("avc1.42E01E", codecs_out[0]); 125 EXPECT_EQ("avc1.42E01E", codecs_out[0]);
126 EXPECT_EQ("mp4a.40.2", codecs_out[1]); 126 EXPECT_EQ("mp4a.40.2", codecs_out[1]);
127 } 127 }
128 128
129 TEST(MimeUtilTest, TestIsStringMimeType) {
130 std::string nonAscii("application/nonutf8");
131 EXPECT_TRUE(IsStringMimeType(nonAscii));
132 nonAscii.append("\u2603"); // unicode snowman
133 EXPECT_FALSE(IsStringMimeType(nonAscii));
134
135 EXPECT_TRUE(IsStringMimeType("application/mime"));
136 EXPECT_TRUE(IsStringMimeType("audio/mime"));
137 EXPECT_TRUE(IsStringMimeType("example/mime"));
138 EXPECT_TRUE(IsStringMimeType("image/mime"));
139 EXPECT_TRUE(IsStringMimeType("message/mime"));
140 EXPECT_TRUE(IsStringMimeType("model/mime"));
141 EXPECT_TRUE(IsStringMimeType("multipart/mime"));
142 EXPECT_TRUE(IsStringMimeType("text/mime"));
143 EXPECT_TRUE(IsStringMimeType("video/mime"));
144 EXPECT_TRUE(IsStringMimeType("video/mime;parameter"));
145 EXPECT_TRUE(IsStringMimeType("*/*"));
146 EXPECT_TRUE(IsStringMimeType("*"));
147
148 EXPECT_TRUE(IsStringMimeType("x-video/mime"));
149 EXPECT_FALSE(IsStringMimeType("x-/mime"));
150 EXPECT_FALSE(IsStringMimeType("mime/looking"));
151 }
152
129 } // namespace net 153 } // namespace net
OLDNEW
« net/base/mime_util.cc ('K') | « net/base/mime_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698