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

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

Issue 54233002: Make net::DataURL's MIME string check stricter (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Split web_url_loader_impl change Created 6 years, 7 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 | « net/base/data_url.cc ('k') | net/base/mime_util.h » ('j') | 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/data_url.h" 6 #include "net/base/data_url.h"
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "url/gurl.h" 8 #include "url/gurl.h"
9 9
10 namespace { 10 namespace {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 "text/html", 81 "text/html",
82 "US-ASCII", 82 "US-ASCII",
83 "<html><body><b>hello world</b></body></html>" }, 83 "<html><body><b>hello world</b></body></html>" },
84 84
85 { "data:text/html,<html><body><b>hello world</b></body></html>", 85 { "data:text/html,<html><body><b>hello world</b></body></html>",
86 true, 86 true,
87 "text/html", 87 "text/html",
88 "US-ASCII", 88 "US-ASCII",
89 "<html><body><b>hello world</b></body></html>" }, 89 "<html><body><b>hello world</b></body></html>" },
90 90
91 // Bad mime type
92 { "data:f(oo/bar;baz=1;charset=kk,boo",
93 false,
94 "",
95 "",
96 "" },
97
91 // the comma cannot be url-escaped! 98 // the comma cannot be url-escaped!
92 { "data:%2Cblah", 99 { "data:%2Cblah",
93 false, 100 false,
94 "", 101 "",
95 "", 102 "",
96 "" }, 103 "" },
97 104
98 // invalid base64 content 105 // invalid base64 content
99 { "data:;base64,aGVs_-_-", 106 { "data:;base64,aGVs_-_-",
100 false, 107 false,
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 bool ok = 179 bool ok =
173 net::DataURL::Parse(GURL(tests[i].url), &mime_type, &charset, &data); 180 net::DataURL::Parse(GURL(tests[i].url), &mime_type, &charset, &data);
174 EXPECT_EQ(ok, tests[i].is_valid); 181 EXPECT_EQ(ok, tests[i].is_valid);
175 if (tests[i].is_valid) { 182 if (tests[i].is_valid) {
176 EXPECT_EQ(tests[i].mime_type, mime_type); 183 EXPECT_EQ(tests[i].mime_type, mime_type);
177 EXPECT_EQ(tests[i].charset, charset); 184 EXPECT_EQ(tests[i].charset, charset);
178 EXPECT_EQ(tests[i].data, data); 185 EXPECT_EQ(tests[i].data, data);
179 } 186 }
180 } 187 }
181 } 188 }
OLDNEW
« no previous file with comments | « net/base/data_url.cc ('k') | net/base/mime_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698