Web Inspector: Canvas: send a call stack with each action instead of an array of...
[WebKit-https.git] / LayoutTests / inspector / model / recording.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../http/tests/inspector/resources/inspector-test.js"></script>
5 <script>
6 function test()
7 {
8     let suite = InspectorTest.createSyncSuite("Recording");
9
10     function addTest({name, payload}) {
11         suite.addTestCase({
12             name,
13             test() {
14                 let recording = WI.Recording.fromPayload(payload);
15                 InspectorTest.log(recording ? JSON.stringify(recording.toJSON(), null, 2) : recording);
16                 return true;
17             }
18         });
19     }
20
21     let tests = [
22         {
23             name: "Recording.fromPayload.nullObject",
24             payload: null,
25         },
26         {
27             name: "Recording.fromPayload.nonObject",
28             payload: "INVALID",
29         },
30         {
31             name: "Recording.fromPayload.emptyObject",
32             payload: {},
33         },
34         {
35             name: "Recording.fromPayload.invalidTopLevelMembers",
36             payload: {
37                 version: null,
38                 type: null,
39                 initialState: null,
40                 frames: null,
41                 data: null,
42             },
43         },
44         {
45             name: "Recording.fromPayload.invalidSubMembers",
46             payload: {
47                 version: 1,
48                 type: "test",
49                 initialState: {
50                     attributes: null,
51                     states: null,
52                     parameters: null,
53                     content: null,
54                 },
55                 frames: [null],
56                 data: ["test"],
57             },
58         },
59         {
60             name: "Recording.fromPayload.invalidFrame",
61             payload: {
62                 version: 1,
63                 type: "test",
64                 initialState: {
65                     attributes: {
66                         test: "test",
67                     },
68                     states: [
69                         {
70                             test: "test",
71                         },
72                     ],
73                     parameters: ["test"],
74                     content: "test",
75                 },
76                 frames: [
77                     {
78                         actions: null,
79                         duration: null,
80                         incomplete: null,
81                     },
82                 ],
83                 data: ["test"],
84             },
85         },
86         {
87             name: "Recording.fromPayload.invalidAction",
88             payload: {
89                 version: 1,
90                 type: "test",
91                 initialState: {
92                     attributes: {
93                         test: "test",
94                     },
95                     states: [
96                         {
97                             test: "test",
98                         },
99                     ],
100                     parameters: ["test"],
101                     content: "test",
102                 },
103                 frames: [
104                     {
105                         actions: [null],
106                         duration: 1,
107                         incomplete: true,
108                     },
109                 ],
110                 data: ["test"],
111             },
112         },
113         {
114             name: "Recording.fromPayload.invalidActionMembers",
115             payload: {
116                 version: 1,
117                 type: "test",
118                 initialState: {
119                     attributes: {
120                         test: "test",
121                     },
122                     states: [
123                         {
124                             test: "test",
125                         },
126                     ],
127                     parameters: ["test"],
128                     content: "test",
129                 },
130                 frames: [
131                     {
132                         actions: [
133                             [
134                                 null,
135                                 null,
136                                 null,
137                                 null,
138                             ],
139                         ],
140                         duration: 1,
141                         incomplete: true,
142                     },
143                 ],
144                 data: ["test"],
145             },
146         },
147         {
148             name: "Recording.fromPayload.valid",
149             payload: {
150                 version: 1,
151                 type: "test",
152                 initialState: {
153                     attributes: {
154                         test: "test",
155                     },
156                     states: [
157                         {
158                             test: "test",
159                         },
160                     ],
161                     parameters: ["test"],
162                     content: "test",
163                 },
164                 frames: [
165                     {
166                         actions: [
167                             [
168                                 0,
169                                 [0],
170                                 [0],
171                                 0,
172                             ],
173                         ],
174                         duration: 1,
175                         incomplete: true,
176                     },
177                 ],
178                 data: ["test"],
179             },
180         },
181     ];
182     tests.forEach(addTest);
183
184     suite.runTestCasesAndFinish();
185 }
186 </script>
187 </head>
188 <body onload="runTest()">
189     <p>Testing the fault-tolerance of WI.Recording.</p>
190 </body>
191 </html>