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

Side by Side Diff: tests/standalone/io/url_encoding_test.dart

Issue 10382148: Revert "Fix URL decoding in HTTP library" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #import("dart:utf");
6 #source("../../../runtime/bin/input_stream.dart");
7 #source("../../../runtime/bin/output_stream.dart");
8 #source("../../../runtime/bin/chunked_stream.dart");
9 #source("../../../runtime/bin/string_stream.dart");
10 #source("../../../runtime/bin/stream_util.dart");
11 #source("../../../runtime/bin/http.dart");
12 #source("../../../runtime/bin/http_impl.dart");
13 #source("../../../runtime/bin/http_parser.dart");
14 #source("../../../runtime/bin/http_utils.dart"); 5 #source("../../../runtime/bin/http_utils.dart");
15 6
16 void testParseEncodedString() { 7 void testParseEncodedString() {
17 String encodedString = 'foo+bar%20foobar%25%26'; 8 String encodedString = 'foo+bar%20foobar%25%26';
18 Expect.equals(_HttpUtils.decodeUrlEncodedString(encodedString), 9 Expect.equals(_HttpUtils.decodeUrlEncodedString(encodedString),
19 'foo bar foobar%&'); 10 'foo bar foobar%&');
20 } 11 }
21 12
22 void testParseQueryString() { 13 void testParseQueryString() {
23 // The query string includes escaped "?"s, "&"s, "%"s and "="s. 14 // The query string includes escaped "?"s, "&"s, "%"s and "="s.
24 // These should not affect the splitting of the string. 15 // These should not affect the splitting of the string.
25 String queryString = 16 String queryString = '%3F=%3D&foo=bar&%26=%25';
26 '%3F=%3D&foo=bar&%26=%25&sqrt2=%E2%88%9A2&name=Franti%C5%A1ek';
27 Map<String, String> map = _HttpUtils.splitQueryString(queryString); 17 Map<String, String> map = _HttpUtils.splitQueryString(queryString);
28 for (String key in map.getKeys()) { 18 for (String key in map.getKeys()) {
29 Expect.equals(map[key], { '&' : '%', 19 Expect.equals(map[key], { '&' : '%',
30 'foo' : 'bar', 20 'foo' : 'bar',
31 '?' : '=', 21 '?' : '='}[key]);
32 'sqrt2' : '\u221A2',
33 'name' : 'Franti\u0161ek'}[key]);
34 } 22 }
35 Expect.setEquals(map.getKeys(), ['&', '?', 'foo', 'sqrt2', 'name']); 23 Expect.setEquals(map.getKeys(), ['&', '?', 'foo']);
36 } 24 }
37 25
38 void main() { 26 void main() {
39 testParseEncodedString(); 27 testParseEncodedString();
40 testParseQueryString(); 28 testParseQueryString();
41 } 29 }
OLDNEW
« runtime/bin/http_utils.dart ('K') | « tests/standalone/io/http_date_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698