From 5f8de423f190bbb79a62f804151bc24824fa32d8 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 2 Feb 2018 04:16:08 -0500 Subject: Add m-esr52 at 52.6.0 --- .../test/mochitest/browser_dbg_sources-large.js | 80 ++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 devtools/client/debugger/test/mochitest/browser_dbg_sources-large.js (limited to 'devtools/client/debugger/test/mochitest/browser_dbg_sources-large.js') diff --git a/devtools/client/debugger/test/mochitest/browser_dbg_sources-large.js b/devtools/client/debugger/test/mochitest/browser_dbg_sources-large.js new file mode 100644 index 000000000..31b64c2fd --- /dev/null +++ b/devtools/client/debugger/test/mochitest/browser_dbg_sources-large.js @@ -0,0 +1,80 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +/** + * Tests that large files are treated differently in the debugger: + * 1) No parsing to determine current symbol is attempted when + * starting a search + */ + +const TAB_URL = EXAMPLE_URL + "doc_function-search.html"; + +function test() { + let options = { + source: EXAMPLE_URL + "code_function-search-01.js", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab, aDebuggee, aPanel]) => { + const gTab = aTab; + const gDebuggee = aDebuggee; + const gPanel = aPanel; + const gDebugger = gPanel.panelWin; + + const gEditor = gDebugger.DebuggerView.editor; + const gSources = gDebugger.DebuggerView.Sources; + const Filtering = gDebugger.DebuggerView.Filtering; + + // Setting max size so that code_function-search-01.js will be + // considered a large file on first load + gDebugger.DebuggerView.LARGE_FILE_SIZE = 1; + + function testLargeFile() { + ok(gEditor.getText().length > gDebugger.DebuggerView.LARGE_FILE_SIZE, + "First source is considered a large file."); + is(gEditor.getMode().name, "javascript", + "Editor is syntax highlighting."); + ok(gEditor.getText().includes("First source!"), + "Editor text contents appears to be correct."); + + // Press ctrl+f with the cursor in a token + gEditor.focus(); + gEditor.setCursor({ line: 3, ch: 10}); + synthesizeKeyFromKeyTag(gDebugger.document.getElementById("tokenSearchKey")); + is(Filtering._searchbox.value, "#", + "Search box is NOT prefilled with current token"); + } + + function testSmallFile() { + ok(gEditor.getText().length < gDebugger.DebuggerView.LARGE_FILE_SIZE, + "Second source is considered a small file."); + is(gEditor.getMode().name, "javascript", + "Editor is syntax highlighting."); + ok(gEditor.getText().includes("First source!"), + "Editor text contents appears to be correct."); + + // Press ctrl+f with the cursor in a token + gEditor.focus(); + gEditor.setCursor({ line: 3, ch: 10}); + synthesizeKeyFromKeyTag(gDebugger.document.getElementById("tokenSearchKey")); + is(Filtering._searchbox.value, "#test", + "Search box is prefilled with current token"); + } + + Task.spawn(function* () { + yield testLargeFile(); + + info("Making it appear as a small file and then reselecting 01.js"); + gDebugger.DebuggerView.LARGE_FILE_SIZE = 1000; + gSources.selectedIndex = 1; + yield waitForSourceShown(gPanel, "-02.js"); + gSources.selectedIndex = 0; + yield waitForSourceShown(gPanel, "-01.js"); + + yield testSmallFile(); + + closeDebuggerAndFinish(gPanel); + }); + }); +} -- cgit v1.2.3