Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/inspector/console/console-link-to-snippet.html |
| diff --git a/third_party/WebKit/LayoutTests/inspector/console/console-link-to-snippet.html b/third_party/WebKit/LayoutTests/inspector/console/console-link-to-snippet.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7e0609c31fb45f5156850cb3c07e54a5eb8f7dbd |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/inspector/console/console-link-to-snippet.html |
| @@ -0,0 +1,100 @@ |
| +<html> |
| +<head> |
| +<script src="../../http/tests/inspector/inspector-test.js"></script> |
| +<script src="../../http/tests/inspector/sources-test.js"></script> |
| +<script src="../../http/tests/inspector/console-test.js"></script> |
| +<script> |
| + |
| +function test() |
| +{ |
| + InspectorTest.runTestSuite([ |
| + function testConsoleLogAndReturnMessageLocation(next) |
| + { |
| + InspectorTest.waitUntilNthMessageReceivedPromise(2) |
| + .then(() => InspectorTest.dumpConsoleMessages()) |
| + .then(() => WebInspector.ConsoleView.clearConsole()) |
| + .then(() => next()); |
| + |
| + createSnippetPromise() |
| + .then((uiSourceCode) => selectSourceCode(uiSourceCode)) |
|
lushnikov
2016/07/26 01:05:29
let's remove ()
kozy
2016/07/26 01:34:15
Done.
|
| + .then((uiSourceCode) => renameSourceCodePromise("name1", uiSourceCode)) |
| + .then((uiSourceCode) => addLineMessageSniffer(uiSourceCode)) |
| + .then((uiSourceCode) => uiSourceCode.setWorkingCopy("console.log(239);42")) |
| + .then(() => runSelectedSnippet()); |
| + }, |
| + |
| + function testSnippetSyntaxError(next) |
| + { |
| + InspectorTest.waitUntilNthMessageReceivedPromise(1) |
| + .then(() => InspectorTest.dumpConsoleMessages()) |
| + .then(() => WebInspector.ConsoleView.clearConsole()) |
| + .then(() => next()); |
| + |
| + createSnippetPromise() |
| + .then((uiSourceCode) => selectSourceCode(uiSourceCode)) |
| + .then((uiSourceCode) => renameSourceCodePromise("name2", uiSourceCode)) |
| + .then((uiSourceCode) => addLineMessageSniffer(uiSourceCode)) |
| + .then((uiSourceCode) => uiSourceCode.setWorkingCopy("\n }")) |
| + .then(() => runSelectedSnippet()); |
| + }, |
| + |
| + function testConsoleErrorHighlight(next) |
| + { |
| + InspectorTest.waitUntilNthMessageReceivedPromise(1) |
| + .then(() => InspectorTest.dumpConsoleMessages()) |
| + .then(() => WebInspector.ConsoleView.clearConsole()) |
| + .then(() => next()); |
| + |
| + createSnippetPromise() |
| + .then((uiSourceCode) => selectSourceCode(uiSourceCode)) |
| + .then((uiSourceCode) => renameSourceCodePromise("name3", uiSourceCode)) |
| + .then((uiSourceCode) => addLineMessageSniffer(uiSourceCode)) |
| + .then((uiSourceCode) => uiSourceCode.setWorkingCopy("\n console.error(42);")) |
| + .then(() => runSelectedSnippet()); |
| + } |
| + ]); |
| + |
| + function createSnippetPromise(content) |
|
lushnikov
2016/07/26 01:05:29
let's use this content
kozy
2016/07/26 01:34:15
Done.
|
| + { |
| + var cb; |
|
lushnikov
2016/07/26 01:05:29
we don't use abbreviations in blink
kozy
2016/07/26 01:34:15
Done.
|
| + var p = new Promise(f => cb = f); |
| + WebInspector.scriptSnippetModel._project.createFile("", null, content, cb); |
| + return p; |
| + } |
| + |
| + function renameSourceCodePromise(newName, uiSourceCode) |
| + { |
| + var cb; |
| + var p = new Promise(f => cb = f); |
| + uiSourceCode.rename(newName, () => cb(uiSourceCode)); |
| + return p; |
| + } |
| + |
| + function selectSourceCode(uiSourceCode) |
| + { |
| + WebInspector.SourcesPanel.instance()._sourceSelected({ data: { uiSourceCode: uiSourceCode }}); |
| + return uiSourceCode; |
| + } |
| + |
| + function addLineMessageSniffer(uiSourceCode) |
| + { |
| + var orig = uiSourceCode.addLineMessage; |
| + uiSourceCode.addLineMessage = function(level, text, lineNumber, columnNumber) |
|
lushnikov
2016/07/26 01:05:29
let's make a sniffer and dump uiSourceCode URL
lushnikov
2016/07/26 01:05:29
let's make named function
kozy
2016/07/26 01:34:15
Acknowledged.
kozy
2016/07/26 01:34:15
Done.
|
| + { |
| + InspectorTest.addResult(`Line Message was added: ${level} '${text}':${lineNumber}:${columnNumber}`); |
| + orig.call(uiSourceCode, level, text, lineNumber, columnNumber); |
| + } |
| + return uiSourceCode; |
| + } |
| + |
| + function runSelectedSnippet() |
| + { |
| + WebInspector.SourcesPanel.instance()._runSnippet(); |
| + } |
| +} |
| +</script> |
| +</head> |
| +<body onload="runTest()"> |
| +<p>Test that link to snippet works.</p> |
| +</body> |
| +</html> |