Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / sources / debugger-ui / show-generator-location.html
blob6c41f6c7807b1f0892b69009d78b0ad80418e395
1 <html>
2 <head>
3 <script src="../../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../../http/tests/inspector/console-test.js"></script>
5 <script>
7 function forward(iter, step)
9 while (step-- > 0)
10 iter.next();
11 return iter;
14 function* gen()
16 yield 1;
17 yield 2;
18 yield 3;
21 var iterNotStarted = gen();
22 var iterSuspended1 = forward(gen(), 1);
23 var iterSuspended2 = forward(gen(), 2);
24 var iterSuspended3 = forward(gen(), 3);
25 var iterClosed = forward(gen(), 4);
27 function test()
29 var panel = WebInspector.panels.sources;
31 function performStandardTestCase(pageExpression, next)
33 InspectorTest.addSniffer(panel, "showUISourceCode", showUISourceCodeHook);
34 InspectorTest.evaluateInPage(pageExpression, didEvaluate);
36 function didEvaluate(remote)
38 panel._showGeneratorLocation(remote);
41 function showUISourceCodeHook(uiSourceCode, lineNumber, columnNumber, forceShowInPanel)
43 // lineNumber and columnNumber are 0-based
44 ++lineNumber;
45 ++columnNumber;
46 InspectorTest.addResult("Generator location revealed: [" + lineNumber + ":" + columnNumber + "]");
47 next();
51 var expressions = [
52 "iterNotStarted",
53 "iterSuspended1",
54 "iterSuspended2",
55 "iterSuspended3",
56 "iterClosed",
59 function createTestSuiteFunction(expression)
61 var functionName = "test" + expression.toTitleCase();
62 return eval("function " + functionName + "(next)\n" +
63 "{\n" +
64 " performStandardTestCase('" + expression + "', next);\n" +
65 "}; " + functionName);
68 InspectorTest.runTestSuite(expressions.map(createTestSuiteFunction));
71 </script>
72 </head>
74 <body onload="runTest()">
75 <p>
76 Tests that "Show Generator Location" jumps to the correct location.
77 </p>
78 </body>
79 </html>