OLD | NEW |
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 22 matching lines...) Expand all Loading... |
33 "US-ASCII", | 33 "US-ASCII", |
34 "" }, | 34 "" }, |
35 | 35 |
36 { "data:;base64,", | 36 { "data:;base64,", |
37 true, | 37 true, |
38 "text/plain", | 38 "text/plain", |
39 "US-ASCII", | 39 "US-ASCII", |
40 "" }, | 40 "" }, |
41 | 41 |
42 { "data:;charset=,test", | 42 { "data:;charset=,test", |
43 true, | 43 false, |
44 "text/plain", | 44 "", |
45 "US-ASCII", | 45 "", |
46 "test" }, | 46 "" }, |
47 | 47 |
48 { "data:TeXt/HtMl,<b>x</b>", | 48 { "data:TeXt/HtMl,<b>x</b>", |
49 true, | 49 true, |
50 "text/html", | 50 "text/html", |
51 "US-ASCII", | 51 "US-ASCII", |
52 "<b>x</b>" }, | 52 "<b>x</b>" }, |
53 | 53 |
54 { "data:,foo", | 54 { "data:,foo", |
55 true, | 55 true, |
56 "text/plain", | 56 "text/plain", |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 bool ok = | 179 bool ok = |
180 net::DataURL::Parse(GURL(tests[i].url), &mime_type, &charset, &data); | 180 net::DataURL::Parse(GURL(tests[i].url), &mime_type, &charset, &data); |
181 EXPECT_EQ(ok, tests[i].is_valid); | 181 EXPECT_EQ(ok, tests[i].is_valid); |
182 if (tests[i].is_valid) { | 182 if (tests[i].is_valid) { |
183 EXPECT_EQ(tests[i].mime_type, mime_type); | 183 EXPECT_EQ(tests[i].mime_type, mime_type); |
184 EXPECT_EQ(tests[i].charset, charset); | 184 EXPECT_EQ(tests[i].charset, charset); |
185 EXPECT_EQ(tests[i].data, data); | 185 EXPECT_EQ(tests[i].data, data); |
186 } | 186 } |
187 } | 187 } |
188 } | 188 } |
OLD | NEW |