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

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

Issue 10914278: Fix for non-sticky defaults bug. Added a bunch of tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to head Created 8 years, 3 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
« no previous file with comments | « chrome/browser/webdata/web_intents_table_unittest.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 "base/utf_string_conversions.h" 6 #include "base/utf_string_conversions.h"
7 #include "net/base/mime_util.h" 7 #include "net/base/mime_util.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace net { 10 namespace net {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 EXPECT_FALSE(IsSupportedMimeType("image/lolcat")); 74 EXPECT_FALSE(IsSupportedMimeType("image/lolcat"));
75 EXPECT_TRUE(IsSupportedMimeType("text/html")); 75 EXPECT_TRUE(IsSupportedMimeType("text/html"));
76 EXPECT_TRUE(IsSupportedMimeType("text/banana")); 76 EXPECT_TRUE(IsSupportedMimeType("text/banana"));
77 EXPECT_FALSE(IsSupportedMimeType("text/vcard")); 77 EXPECT_FALSE(IsSupportedMimeType("text/vcard"));
78 EXPECT_FALSE(IsSupportedMimeType("application/virus")); 78 EXPECT_FALSE(IsSupportedMimeType("application/virus"));
79 } 79 }
80 80
81 TEST(MimeUtilTest, MatchesMimeType) { 81 TEST(MimeUtilTest, MatchesMimeType) {
82 EXPECT_TRUE(MatchesMimeType("*", "video/x-mpeg")); 82 EXPECT_TRUE(MatchesMimeType("*", "video/x-mpeg"));
83 EXPECT_TRUE(MatchesMimeType("video/*", "video/x-mpeg")); 83 EXPECT_TRUE(MatchesMimeType("video/*", "video/x-mpeg"));
84 EXPECT_TRUE(MatchesMimeType("video/*", "video/*"));
84 EXPECT_TRUE(MatchesMimeType("video/x-mpeg", "video/x-mpeg")); 85 EXPECT_TRUE(MatchesMimeType("video/x-mpeg", "video/x-mpeg"));
85 EXPECT_TRUE(MatchesMimeType("application/*+xml", 86 EXPECT_TRUE(MatchesMimeType("application/*+xml",
86 "application/html+xml")); 87 "application/html+xml"));
87 EXPECT_TRUE(MatchesMimeType("application/*+xml", "application/+xml")); 88 EXPECT_TRUE(MatchesMimeType("application/*+xml", "application/+xml"));
88 EXPECT_TRUE(MatchesMimeType("aaa*aaa", "aaaaaa")); 89 EXPECT_TRUE(MatchesMimeType("aaa*aaa", "aaaaaa"));
89 EXPECT_TRUE(MatchesMimeType("*", "")); 90 EXPECT_TRUE(MatchesMimeType("*", ""));
90 EXPECT_FALSE(MatchesMimeType("video/", "video/x-mpeg")); 91 EXPECT_FALSE(MatchesMimeType("video/", "video/x-mpeg"));
91 EXPECT_FALSE(MatchesMimeType("", "video/x-mpeg")); 92 EXPECT_FALSE(MatchesMimeType("", "video/x-mpeg"));
92 EXPECT_FALSE(MatchesMimeType("", "")); 93 EXPECT_FALSE(MatchesMimeType("", ""));
93 EXPECT_FALSE(MatchesMimeType("video/x-mpeg", "")); 94 EXPECT_FALSE(MatchesMimeType("video/x-mpeg", ""));
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 if (extensions[j] == tests[i].contained_result) 220 if (extensions[j] == tests[i].contained_result)
220 found = true; 221 found = true;
221 #endif 222 #endif
222 } 223 }
223 ASSERT_TRUE(found) << "Must find at least the contained result within " 224 ASSERT_TRUE(found) << "Must find at least the contained result within "
224 << tests[i].mime_type; 225 << tests[i].mime_type;
225 } 226 }
226 } 227 }
227 228
228 } // namespace net 229 } // namespace net
OLDNEW
« no previous file with comments | « chrome/browser/webdata/web_intents_table_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698