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

Side by Side Diff: third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-getCompletions.html

Issue 1942073002: [DevTools] Move getCompletions to native (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
OLDNEW
(Empty)
1 <html>
2 <head>
3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto r-protocol-test.js"></script>
4 <script>
5
6 function test()
7 {
8 var expressions = [
9 "({ foo: 42, boo: 239})",
10 "var a = []; for (var i = 0; i < 10; ++i) { a[i] = i; } a",
11 "var a = []; for (var i = 0; i < 100000; ++i) { a[i] = i; } a.foo = 42; a",
12 "var p = new Proxy({ foo: 42 }, { get: function(target, name) { target.a ccessed = true; return target[name]; } }); p",
13 // check that previous getCompletions call doesn't call get trap.
14 "p",
15 "new Uint8Array(new ArrayBuffer(Math.pow(2, 29)))"
16 ];
17 var primitiveTypes = [
18 "string",
19 "boolean",
20 "number",
21 "symbol"
22 ];
23 var filters = [
24 new Set(["foo", "boo"]),
25 new Set(["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "length", "fi lter", "map"]),
26 new Set(["0"]),
27 new Set(["accessed", "foo"]),
28 new Set(["accessed", "foo"]),
29 new Set(["copyWithin", "sort", "subarray"]),
30 new Set(["length", "substr"]),
31 new Set(["valueOf", "toString"]),
32 new Set(["toExponential", "toFixed"]),
33 new Set(["valueOf", "toString"])
34 ];
35
36 completionsForExpression();
37
38 function completionsForExpression()
39 {
40 var expression = expressions.shift();
41 if (!expression) {
42 completionsForPrimitiveTypes();
43 return;
44 }
45 InspectorTest.log("Completions for expression: " + expression);
46 InspectorTest.sendCommandOrDie("Runtime.evaluate", { "expression": expre ssion }, completionsForObject);
47 }
48
49 function completionsForObject(result)
50 {
51 InspectorTest.sendCommandOrDie("Runtime.getCompletions", { "objectId": r esult.result.objectId }, dumpCompletions.bind(null, completionsForExpression));
52 }
53
54 function completionsForPrimitiveTypes()
55 {
56 var primitiveType = primitiveTypes.shift();
57 if (!primitiveType) {
58 InspectorTest.completeTest();
59 return;
60 }
61 InspectorTest.log("Completions for primitive type: " + primitiveType);
62 InspectorTest.sendCommandOrDie("Runtime.getCompletions", { "primitiveTyp e": primitiveType }, dumpCompletions.bind(null, completionsForPrimitiveTypes));
63 }
64
65 function dumpCompletions(next, completions)
66 {
67 var filter = filters.shift();
68 completions.completions = completions.completions.sort().filter((v) => f ilter.has(v) || !filter.size);
69 InspectorTest.logObject(completions);
70 next();
71 }
72 }
73 </script>
74 </head>
75 <body onLoad="runTest();">
76 Runtime.getCompletions test.
77 </body>
78 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698