| Index: third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-getCompletions.html
|
| diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-getCompletions.html b/third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-getCompletions.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..fdb49fa59178a446cded2b91a057990c8172b8c6
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-getCompletions.html
|
| @@ -0,0 +1,78 @@
|
| +<html>
|
| +<head>
|
| +<script type="text/javascript" src="../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
|
| +<script>
|
| +
|
| +function test()
|
| +{
|
| + var expressions = [
|
| + "({ foo: 42, boo: 239})",
|
| + "var a = []; for (var i = 0; i < 10; ++i) { a[i] = i; } a",
|
| + "var a = []; for (var i = 0; i < 100000; ++i) { a[i] = i; } a.foo = 42; a",
|
| + "var p = new Proxy({ foo: 42 }, { get: function(target, name) { target.accessed = true; return target[name]; } }); p",
|
| + // check that previous getCompletions call doesn't call get trap.
|
| + "p",
|
| + "new Uint8Array(new ArrayBuffer(Math.pow(2, 29)))"
|
| + ];
|
| + var primitiveTypes = [
|
| + "string",
|
| + "boolean",
|
| + "number",
|
| + "symbol"
|
| + ];
|
| + var filters = [
|
| + new Set(["foo", "boo"]),
|
| + new Set(["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "length", "filter", "map"]),
|
| + new Set(["0"]),
|
| + new Set(["accessed", "foo"]),
|
| + new Set(["accessed", "foo"]),
|
| + new Set(["copyWithin", "sort", "subarray"]),
|
| + new Set(["length", "substr"]),
|
| + new Set(["valueOf", "toString"]),
|
| + new Set(["toExponential", "toFixed"]),
|
| + new Set(["valueOf", "toString"])
|
| + ];
|
| +
|
| + completionsForExpression();
|
| +
|
| + function completionsForExpression()
|
| + {
|
| + var expression = expressions.shift();
|
| + if (!expression) {
|
| + completionsForPrimitiveTypes();
|
| + return;
|
| + }
|
| + InspectorTest.log("Completions for expression: " + expression);
|
| + InspectorTest.sendCommandOrDie("Runtime.evaluate", { "expression": expression }, completionsForObject);
|
| + }
|
| +
|
| + function completionsForObject(result)
|
| + {
|
| + InspectorTest.sendCommandOrDie("Runtime.getCompletions", { "objectId": result.result.objectId }, dumpCompletions.bind(null, completionsForExpression));
|
| + }
|
| +
|
| + function completionsForPrimitiveTypes()
|
| + {
|
| + var primitiveType = primitiveTypes.shift();
|
| + if (!primitiveType) {
|
| + InspectorTest.completeTest();
|
| + return;
|
| + }
|
| + InspectorTest.log("Completions for primitive type: " + primitiveType);
|
| + InspectorTest.sendCommandOrDie("Runtime.getCompletions", { "primitiveType": primitiveType }, dumpCompletions.bind(null, completionsForPrimitiveTypes));
|
| + }
|
| +
|
| + function dumpCompletions(next, completions)
|
| + {
|
| + var filter = filters.shift();
|
| + completions.completions = completions.completions.sort().filter((v) => filter.has(v) || !filter.size);
|
| + InspectorTest.logObject(completions);
|
| + next();
|
| + }
|
| +}
|
| +</script>
|
| +</head>
|
| +<body onLoad="runTest();">
|
| +Runtime.getCompletions test.
|
| +</body>
|
| +</html>
|
|
|