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

Side by Side Diff: LayoutTests/platform/chromium/fast/storage/serialized-script-value.html

Issue 14120003: Move LayoutTests from platform/chromium/... to generic location (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 8 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
(Empty)
1 <html>
2 <head>
3 <script src="../../../../fast/js/resources/js-test-pre.js"></script>
4 <script src="../../../../fast/storage/resources/serialized-script-value. js"></script>
5 </head>
6 <body>
7 <script>
8
9 function testSerialization(obj, values, oldFormat, serializeExceptionValue) {
10 _testSerialization(2, obj, values, oldFormat, serializeExceptionValue);
11 }
12
13 // we only test a few cases of the "old" serialization format because
14 // that is all that was left around from previous tests. Those values
15 // are only persisted out in the world in IndexedDB stores that were
16 // written with implementations built before mid-2011.
17 testSerialization({foo: 'zoo', bar: {baz: 'myNewKey'}},
18 [ 0x02ff, 0x003f, 0x3f6f, 0x5301, 0x6603,
19 0x6f6f, 0x013f, 0x0353, 0x6f7a, 0x3f6f,
20 0x5301, 0x6203, 0x7261, 0x013f, 0x3f6f,
21 0x5302, 0x6203, 0x7a61, 0x023f, 0x0853,
22 0x796d, 0x654e, 0x4b77, 0x7965, 0x017b,
23 0x027b ]);
24
25 testSerialization({foo: 'zoo', bar: 'myNewKey'},
26 [0x02ff, 0x003f, 0x3f6f, 0x5301, 0x6603,
27 0x6f6f, 0x013f, 0x0353, 0x6f7a, 0x3f6f,
28 0x5301, 0x6203, 0x7261, 0x013f, 0x0853,
29 0x796d, 0x654e, 0x4b77, 0x7965, 0x027b]);
30
31 testSerialization([], [0x02ff, 0x003f, 0x0041, 0x0024, 0x0000 ]);
32 testSerialization({foo: "zoo"},
33 [0x02ff, 0x003f, 0x3f6f, 0x5301, 0x6603, 0x6f6f,
34 0x013f, 0x0353, 0x6f7a, 0x7b6f, 0x0001],
35 [0x0353, 0x6f66, 0x536f, 0x7a03, 0x6f6f, 0x017b]);
36 testSerialization({foo: null},
37 [0x02ff, 0x003f, 0x3f6f, 0x5301, 0x6603, 0x6f6f,
38 0x013f, 0x7b30, 0x0001],
39 [0x0353, 0x6f66, 0x306f, 0x017b]);
40 testSerialization({}, [0x02ff, 0x003f, 0x7b6f, 0x0000], [0x007b]);
41
42 testSerialization(undefined, [0x02ff, 0x003f, 0x005f]);
43 testSerialization(true, [0x02ff, 0x003f, 0x0054]);
44 testSerialization(false, [0x02ff, 0x003f, 0x0046]);
45 // Sparse array deserialization is broken.
46 // See: https://bugs.webkit.org/show_bug.cgi?id=96838
47 // testSerialization(new Array(100), [0x02ff, 0x003f, 0x6461, 0x0040, 0x0064]);
48 testSerialization(10, [0x02ff, 0x003f, 0x1449]);
49 testSerialization(-10, [0x02ff, 0x003f, 0x1349]);
50 testSerialization(Math.pow(2,30), [0x02ff, 0x003f, 0x8049, 0x8080, 0x0880]);
51 testSerialization(Math.pow(2,55), [0x02ff, 0x003f, 0x004e, 0x0000, 0x0000,
52 0x6000, 0x0043]);
53 testSerialization(1.23, [0x02ff, 0x003f, 0xae4e, 0xe147, 0x147a, 0xf3ae, 0x003f] );
54
55 // Exercise special cases for Int32/Uint32.
56 testSerialization( 0x7fffffff, [0x02ff, 0x003f, 0xfe49, 0xffff, 0x0fff]);
57 testSerialization(-0x80000000, [0x02ff, 0x003f, 0xff49, 0xffff, 0x0fff]);
58 testSerialization( 0x80000000, [0x02ff, 0x003f, 0x8055, 0x8080, 0x0880]);
59 testSerialization( 0xffffffff, [0x02ff, 0x003f, 0xff55, 0xffff, 0x0fff]);
60
61 testSerialization("", [0x02ff, 0x003f, 0x0053]);
62 testSerialization("abc", [0x02ff, 0x003f, 0x0353, 0x6261, 0x0063]);
63 testSerialization({integer: 123}, [0x02ff, 0x003f, 0x3f6f, 0x5301, 0x6907,
64 0x746e, 0x6765, 0x7265, 0x013f, 0xf649,
65 0x7b01, 0x0001]);
66 testSerialization({string: "str"}, [0x02ff, 0x003f, 0x3f6f, 0x5301, 0x7306,
67 0x7274, 0x6e69, 0x3f67, 0x5301, 0x7303,
68 0x7274, 0x017b]);
69 testSerialization({list: [1,2,3]}, [0x02ff, 0x003f, 0x3f6f, 0x5301, 0x6c04,
70 0x7369, 0x3f74, 0x4101, 0x3f03, 0x4902,
71 0x3f02, 0x4902, 0x3f04, 0x4902, 0x2406,
72 0x0300, 0x017b]);
73 testSerialization(null, [0x02ff, 0x003f, 0x0030]);
74 testSerialization(/abc/, [0x02ff, 0x003f, 0x0352, 0x6261, 0x0063]);
75
76 var innerObject = {hello: "there"};
77 var outerObject = {inner: innerObject};
78 outerObject['outer'] = innerObject;
79 testSerialization(outerObject, [0x02ff, 0x003f, 0x3f6f, 0x5301, 0x6905,
80 0x6e6e, 0x7265, 0x013f, 0x3f6f, 0x5302,
81 0x6805, 0x6c65, 0x6f6c, 0x023f, 0x0553,
82 0x6874, 0x7265, 0x7b65, 0x3f01, 0x5302,
83 0x6f05, 0x7475, 0x7265, 0x023f, 0x015e,
84 0x027b]);
85 testSerialization(innerObject, [0x02ff, 0x003f, 0x3f6f, 0x5301, 0x6805,
86 0x6c65, 0x6f6c, 0x013f, 0x0553, 0x6874,
87 0x7265, 0x7b65, 0x0001]);
88
89 var unicodeObject = {a: 'a', u: String.fromCharCode(0x03B1,0x03B2), d: 42};
90 testSerialization(unicodeObject,
91 [0x02ff, 0x003f, 0x3f6f, 0x5301, 0x6101,
92 0x013f, 0x0153, 0x3f61, 0x5301, 0x7501,
93 0x013f, 0x0463, 0x03b1, 0x03b2, 0x013f,
94 0x0153, 0x3f64, 0x4901, 0x7b54, 0x0003],
95 [0x01ff, 0x003f, 0x3f6f, 0x5301, 0x6101,
96 0x013f, 0x0153, 0x3f61, 0x5301, 0x7501,
97 0x013f, 0x0453, 0xb1ce, 0xb2ce, 0x013f,
98 0x0153, 0x3f64, 0x4901, 0x7b54, 0x0003]);
99 unicodeObject.a = 'ab';
100 testSerialization(unicodeObject,
101 [0x02ff, 0x003f, 0x3f6f, 0x5301, 0x6101,
102 0x013f, 0x0253, 0x6261, 0x013f, 0x0153,
103 0x3f75, 0x0001, 0x0463, 0x03b1, 0x03b2,
104 0x013f, 0x0153, 0x3f64, 0x4901, 0x7b54,
105 0x0003],
106 [0x01ff, 0x003f, 0x3f6f, 0x5301, 0x6101,
107 0x013f, 0x0253, 0x6261, 0x013f, 0x0153,
108 0x3f75, 0x5301, 0xce04, 0xceb1, 0x3fb2,
109 0x5301, 0x6401, 0x013f, 0x5449, 0x037b]);
110
111 var arrayObject = [];
112 arrayObject['a'] = true;
113 arrayObject['b'] = false;
114 arrayObject['foo'] = 123;
115 arrayObject['bar'] = 456;
116 arrayObject[''] = null;
117 testSerialization(arrayObject,
118 [0x02ff, 0x003f, 0x0041, 0x013f, 0x0153,
119 0x3f61, 0x5401, 0x013f, 0x0153, 0x3f62,
120 0x4601, 0x013f, 0x0353, 0x6f66, 0x3f6f,
121 0x4901, 0x01f6, 0x013f, 0x0353, 0x6162,
122 0x3f72, 0x4901, 0x0790, 0x013f, 0x0053,
123 0x013f, 0x2430, 0x0005],
124 [0x01ff, 0x003f, 0x0041, 0x013f, 0x0153,
125 0x3f61, 0x5401, 0x013f, 0x0153, 0x3f62,
126 0x4601, 0x013f, 0x0353, 0x6f66, 0x3f6f,
127 0x4901, 0x01f6, 0x013f, 0x0353, 0x6162,
128 0x3f72, 0x4901, 0x0790, 0x013f, 0x0053,
129 0x013f, 0x2430, 0x0005]);
130
131 arrayObject[0] = 'foo';
132 arrayObject[1] = 'bar';
133 testSerialization(arrayObject,
134 [0x02ff, 0x003f, 0x0241, 0x013f, 0x0353,
135 0x6f66, 0x3f6f, 0x5301, 0x6203, 0x7261,
136 0x013f, 0x0153, 0x3f61, 0x5401, 0x013f,
137 0x0153, 0x3f62, 0x4601, 0x013f, 0x0353,
138 0x6f66, 0x3f6f, 0x4901, 0x01f6, 0x013f,
139 0x0353, 0x6162, 0x3f72, 0x4901, 0x0790,
140 0x013f, 0x0053, 0x013f, 0x2430, 0x0205],
141 [0x01ff, 0x003f, 0x0241, 0x013f, 0x0353,
142 0x6f66, 0x3f6f, 0x5301, 0x6203, 0x7261,
143 0x013f, 0x0153, 0x3f61, 0x5401, 0x013f,
144 0x0153, 0x3f62, 0x4601, 0x013f, 0x0353,
145 0x6f66, 0x3f6f, 0x4901, 0x01f6, 0x013f,
146 0x0353, 0x6162, 0x3f72, 0x4901, 0x0790,
147 0x013f, 0x0053, 0x013f, 0x2430, 0x0205]);
148
149 testSerialization(function(){}, [], null, DOMException.DATA_CLONE_ERR);
150 </script>
151 <script src="../../../../fast/js/resources/js-test-post.js"></script>
152 </body>
153 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698