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

Unified Diff: webkit/glue/devtools/js/tests.js

Issue 211012: DevTools: don't duplicate eval scripts on each panel switch. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/glue/devtools/js/debugger_agent.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/devtools/js/tests.js
===================================================================
--- webkit/glue/devtools/js/tests.js (revision 26554)
+++ webkit/glue/devtools/js/tests.js (working copy)
@@ -394,6 +394,60 @@
/**
+ * Tests that scripts are not duplicaed on Scripts tab switch.
+ */
+TestSuite.prototype.testNoScriptDuplicatesOnPanelSwitch = function() {
+ var test = this;
+
+ // There should be two scripts: one for the main page and another
+ // one which is source of console API(see
+ // InjectedScript._ensureCommandLineAPIInstalled).
+ var expectedScriptsCount = 2;
+ var parsedScripts = [];
+
+
+ function switchToElementsTab() {
+ test.showPanel('elements');
+ setTimeout(switchToScriptsTab, 0);
+ }
+
+ function switchToScriptsTab() {
+ test.showPanel('scripts');
+ setTimeout(checkScriptsPanel, 0);
+ }
+
+ function checkScriptsPanel() {
+ test.assertTrue(!!WebInspector.panels.scripts.visibleView,
+ 'No visible script view.');
+ var select = WebInspector.panels.scripts.filesSelectElement;
+ test.assertEquals(expectedScriptsCount, select.options.length,
+ 'Unexpected options count');
+ test.releaseControl();
+ }
+
+ this.addSniffer(WebInspector, 'parsedScriptSource',
+ function(sourceID, sourceURL, source, startingLine) {
+ test.assertTrue(
+ parsedScripts.indexOf(sourceURL) == -1,
+ 'Duplicated script: ' + sourceURL);
+ test.assertTrue(
+ parsedScripts.length < expectedScriptsCount,
+ 'Too many scripts: ' + sourceURL);
+ parsedScripts.push(sourceURL);
+
+ if (parsedScripts.length == expectedScriptsCount) {
+ setTimeout(switchToElementsTab, 0);
+ }
+ }, true /* sticky */);
+
+ this.showPanel('scripts');
+
+ // Wait until all scripts are added to the debugger.
+ this.takeControl();
+};
+
+
+/**
* Tests that a breakpoint can be set.
*/
TestSuite.prototype.testSetBreakpoint = function() {
« no previous file with comments | « webkit/glue/devtools/js/debugger_agent.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698