summaryrefslogtreecommitdiffstats
path: root/chrome/test
diff options
context:
space:
mode:
authorpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-09 14:22:58 +0000
committerpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-09 14:22:58 +0000
commitbd0b780ba75bff665e19ee779f0d6920bb6602c2 (patch)
treea39b68d7865b7db136d7ae7c23757b4a998ab98a /chrome/test
parente46318ec4c9a1409396fd4f9df2bb114ffad0ce3 (diff)
downloadchromium_src-bd0b780ba75bff665e19ee779f0d6920bb6602c2.zip
chromium_src-bd0b780ba75bff665e19ee779f0d6920bb6602c2.tar.gz
chromium_src-bd0b780ba75bff665e19ee779f0d6920bb6602c2.tar.bz2
DevTools: Nuke unused debugger test.
Review URL: http://codereview.chromium.org/150214 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20259 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rwxr-xr-xchrome/test/debugger/debugger_unittests.py56
-rwxr-xr-xchrome/test/debugger/debugger_unittests.sh9
-rw-r--r--chrome/test/debugger/mjsunit.js92
-rw-r--r--chrome/test/debugger/test_protocol.js295
4 files changed, 0 insertions, 452 deletions
diff --git a/chrome/test/debugger/debugger_unittests.py b/chrome/test/debugger/debugger_unittests.py
deleted file mode 100755
index d42a1f3..0000000
--- a/chrome/test/debugger/debugger_unittests.py
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/usr/bin/python
-# debugger_unittests.py
-#
-# Run chrome debugger front-end tests.
-# see also chrome/test/debugger/test_protocol.js
-
-import optparse
-import os.path
-import subprocess
-import sys
-import time
-
-import google.path_utils
-import google.process_utils
-
-def RunTests(build_dir=None):
- '''This is just a simple wrapper for running the test through v8_shell.
- Since v8_shell always returns 0 whether the test passes or fails,
- buildbot looks at stdout to test for failure.
- '''
- script_dir = google.path_utils.ScriptDir()
- chrome_dir = google.path_utils.FindUpward(script_dir, "chrome")
- v8_dir = google.path_utils.FindUpward(script_dir, "v8")
- if build_dir:
- v8_shell = os.path.join(build_dir, "v8_shell.exe")
- else:
- v8_shell = os.path.join(chrome_dir, "Debug", "v8_shell.exe")
- # look for Debug version first
- if not os.path.isfile(v8_shell):
- v8_shell = os.path.join(chrome_dir, "Release", "v8_shell.exe")
- cmd = [v8_shell,
- "--allow-natives-syntax",
- "--expose-debug-as", "debugContext",
- os.path.join(chrome_dir, "browser", "debugger", "resources",
- "debugger_shell.js"),
- # TODO Change the location of mjsunit.js from the copy in this
- # directory to the copy in V8 when switching to use V8 from
- # code.google.com.
- # os.path.join(v8_dir, "test", "mjsunit", "mjsunit.js"),
- os.path.join(chrome_dir, "test", "debugger", "mjsunit.js"),
- os.path.join(chrome_dir, "test", "debugger", "test_protocol.js")
- ]
- #(retcode, output) = google.process_utils.RunCommandFull(cmd,
- # collect_output=True)
- #if "Success" in output:
- return 0
- #else:
- # return 1
-
-if __name__ == "__main__":
- parser = optparse.OptionParser("usage: %prog [--build_dir=dir]")
- parser.add_option("", "--build_dir",
- help="directory where v8_shell.exe was built")
- (options, args) = parser.parse_args()
- ret = RunTests(options.build_dir)
- sys.exit(ret)
diff --git a/chrome/test/debugger/debugger_unittests.sh b/chrome/test/debugger/debugger_unittests.sh
deleted file mode 100755
index 443488d..0000000
--- a/chrome/test/debugger/debugger_unittests.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-
-system_root=`cygpath "$SYSTEMROOT"`
-export PATH="/usr/bin:$system_root/system32:$system_root:$system_root/system32/WBEM"
-
-exec_dir=$(dirname $0)
-
-"$exec_dir/../../../third_party/python_24/python.exe" \
- "$exec_dir/debugger_unittests.py" "$@"
diff --git a/chrome/test/debugger/mjsunit.js b/chrome/test/debugger/mjsunit.js
deleted file mode 100644
index 7f247e0..0000000
--- a/chrome/test/debugger/mjsunit.js
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * This file is included in all mini jsunit test cases. The test
- * framework expects lines that signal failed tests to start with
- * the f-word and ignore all other lines.
- */
-
-// Avoid writing the f-word, since some tests output parts of this code.
-var the_f_word = "Fai" + "lure";
-
-function fail(expected, found, name_opt) {
- var start;
- if (name_opt) {
- start = the_f_word + " (" + name_opt + "): ";
- } else {
- start = the_f_word + ":";
- }
- print(start + " expected <" + expected + "> found <" + found + ">");
-}
-
-
-function assertEquals(expected, found, name_opt) {
- if (expected != found) {
- fail(expected, found, name_opt);
- }
-}
-
-
-function assertArrayEquals(expected, found, name_opt) {
- var start = "";
- if (name_opt) {
- start = name_opt + " - ";
- }
- assertEquals(expected.length, found.length, start + "array length");
- if (expected.length == found.length) {
- for (var i = 0; i < expected.length; ++i) {
- assertEquals(expected[i], found[i], start + "array element at index " + i);
- }
- }
-}
-
-
-function assertTrue(value, name_opt) {
- assertEquals(true, value, name_opt);
-}
-
-
-function assertFalse(value, name_opt) {
- assertEquals(false, value, name_opt);
-}
-
-
-function assertNaN(value, name_opt) {
- if (!isNaN(value)) {
- fail("NaN", value, name_opt);
- }
-}
-
-
-function assertThrows(code) {
- try {
- eval(code);
- assertTrue(false, "did not throw exception");
- } catch (e) {
- // Do nothing.
- }
-}
-
-
-function assertInstanceof(obj, type) {
- if (!(obj instanceof type)) {
- assertTrue(false, "Object <" + obj + "> is not an instance of <" + type + ">");
- }
-}
-
-
-function assertDoesNotThrow(code) {
- try {
- eval(code);
- } catch (e) {
- assertTrue(false, "threw an exception");
- }
-}
-
-
-function assertUnreachable(name_opt) {
- var message = the_f_word + ": unreachable"
- if (name_opt) {
- message += " - " + name_opt;
- }
- print(message);
-}
-
diff --git a/chrome/test/debugger/test_protocol.js b/chrome/test/debugger/test_protocol.js
deleted file mode 100644
index 9ed7ba6..0000000
--- a/chrome/test/debugger/test_protocol.js
+++ /dev/null
@@ -1,295 +0,0 @@
-// Copyright 2008 Google Inc. All Rights Reserved.
-// test_protocol.js
-
-/**
- * @fileoverview Unit tests for testing debugger protocol betweeen front-end JS
- * and back-end.
- * Run with the following command line:
- * v8_shell.exe --allow-natives-syntax --expose-debug-as debugContext
- * chrome/browser/resources/shell.js
- * v8/tests/mjsunit.js
- * chrome/test/debugger/test_protocol.js
- */
-
-// This test is currently disabled. Please see:
-// http://code.google.com/p/v8/issues/detail?id=230
-print("Success");
-quit();
-
-/**
- * shell() is normally a native function exposed to shell.js in Chrome that
- * sets the global DebugShell (shell_) object used for the debugger front-end.
- */
-function shell(sh) {
- shell_ = sh;
-};
-
-
-/**
- * @class The global chrome object has some functions to control some status UI
- * in the debugger window. Stub them out here.
- */
-function chrome() {
-};
-chrome.setDebuggerReady = function(ready) {};
-chrome.setDebuggerBreak = function(brk) {};
-
-
-/**
- * @constructor a pseudo namespace to wrap the various functions and data for
- * the test
- */
-function DebuggerTest() {
-};
-
-/**
- * initialize the member
- */
-DebuggerTest.initialize = function() {
- DebuggerTest.pendingCommand = null;
- DebuggerTest.output = [];
-
- // swap out the built-in print with our own so that we can verify output
- DebuggerTest.realPrint = print;
- print = DebuggerTest.print;
- // uncomment this to see more verbose information
- //dprint = DebuggerTest.realPrint;
-
- debugContext.Debug.addListener(DebuggerTest.listener);
-};
-
-/**
- * Collects calls to print() in an array for test verification.
- */
-DebuggerTest.print = function(str) {
- DebuggerTest.output.push(str);
- // uncomment this if you need to trace what's happening while it's happening
- // rather than waiting for the end
- //DebuggerTest.realPrint(str);
-};
-
-/**
- * Processes pendingCommand and sends response to shell_. Since that may in
- * turn generate a new pendingCommand, repeat this until there is no
- * pendingCommand.
- */
-DebuggerTest.processCommands = function(dcp) {
- while (DebuggerTest.pendingCommand) {
- var json = DebuggerTest.pendingCommand;
- DebuggerTest.pendingCommand = null;
- var result = dcp.processDebugJSONRequest(json);
- shell_.response(result);
- }
-};
-
-/**
- * Handles DebugEvents from the Debug object. Hooked in via addListener above.
- */
-DebuggerTest.listener = function(event, exec_state, event_data, data) {
- try {
- if (event == debugContext.Debug.DebugEvent.Break) {
- var dcp = exec_state.debugCommandProcessor();
- // process any pending commands prior to handling the breakpoint
- DebuggerTest.processCommands(dcp);
- var json = event_data.toJSONProtocol();
- shell_.response(json);
- // response() may have added another command to process
- DebuggerTest.processCommands(dcp);
- }
- } catch(e) {
- print(e);
- }
-};
-
-/**
- * Send the next command from the command-list.
- */
-DebuggerTest.sendNextCommand = function() {
- var cmd = DebuggerTest.commandList.shift();
- print("$ " + cmd);
- shell_.command(cmd);
-};
-
-/**
- * Verify that the actual output matches the expected output
- * depends on mjsunit
- */
-DebuggerTest.verifyOutput = function() {
- // restore print since mjsunit depends on it
- print = DebuggerTest.realPrint;
-
- var out = DebuggerTest.output;
- var expected = DebuggerTest.expectedOutput;
- if (out.length != expected.length) {
- assertTrue(out.length == expected.length,
- "length mismatch: " + out.length + " == " + expected.length);
- } else {
- var succeeded = true;
- for (var i in out) {
- // match the front of the string so we can avoid testing changes in frames
- // that are in the test harness
- if (out[i].indexOf(expected[i]) != 0) {
- assertTrue(out[i] == expected[i],
- "actual '" + out[i] + "' == " + "expected '" + expected[i] + "'");
- succeeded = false;
- break;
- }
- }
- if (succeeded)
- print("Success");
- }
-
- // useful for generating a new version of DebuggerTest.expectedOutput
- for (var i in DebuggerTest.output) {
- //print(" \"" + DebuggerTest.output[i] + "\",");
- }
-};
-
-
-
-/**
- * @class DebugShell is passed a "Tab" object that it uses to communicate with
- * the debugger. This mock simulates that.
- * @param {string} title
- */
-DebuggerTest.TabMock = function(title) {
- this.title = title;
- this.attach = function() {};
- this.debugBreak = function() {
- // TODO(erikkay)
- };
- this.sendToDebugger = function(str) {
- DebuggerTest.pendingCommand = str;
- };
-};
-
-
-/**
- * @class Uses prototype chaining to allow DebugShell methods to be overridden
- * selectively.
- */
-function DebugShellOverrides() {
- this._origPrototype = DebugShell.prototype;
-};
-DebugShellOverrides.prototype = DebugShell.prototype;
-DebugShell.prototype = new DebugShellOverrides;
-
-/**
- * Overrides DebugShell.prototype.response so that we can log the responses
- * and trigger the next command to be processed.
- */
-DebugShell.prototype.response = function(str) {
- var msg = eval('(' + str + ')');
- print("< " + msg.type + ":" + (msg.command || msg.event));
- var sendAnother = (msg.type == "event");
- if (!sendAnother && shell_.current_command) {
- sendAnother = (shell_.current_command.from_user &&
- msg.type == "response" && msg.command != "continue")
- }
- this._origPrototype.response.call(this, str)
-
- // Send the next command, but only if the program is paused (a continue
- // command response means that we're about to be running again) and the
- // command we just processed isn't a continue
- if (!this.running && sendAnother)
- DebuggerTest.sendNextCommand();
-};
-
-
-// The list of commands to be processed
-// TODO(erikkay): this doesn't test the full set of debugger commands yet,
-// but it should be enough to verify that the protocol is still working.
-DebuggerTest.commandList = [
-"next", "step", "backtrace", "source", "print x", "args", "locals", "frame 1",
-"stepout", "continue"
-];
-
-DebuggerTest.expectedOutput = [
- "< event:break",
- "g(), foo.html",
- "60: debugger;",
- "$ next",
- "< response:continue",
- "< event:break",
- "61: f(1);",
- "$ step",
- "< response:continue",
- "< event:break",
- "f(x=1, y=undefined), foo.html",
- "29: return a;",
- "$ backtrace",
- "< response:backtrace",
- "Frames #0 to #3 of 4:",
- "#00 f(x=1, y=undefined) foo.html line 29 column 3 (position 62)",
- "#01 g() foo.html line 61 column 3 (position 30)",
- "#02 function DebuggerTest()", // prefix
- "#03 [anonymous]()", // prefix
- "$ source",
- "< response:source",
- "24: function f(x, y) {",
- "25: var a=1;",
- "26: if (x == 1) {",
- "27: a++;",
- "28: }",
- ">>>> return a;",
- "30: };",
- "$ print x",
- "< response:evaluate",
- "1",
- "$ args",
- "< response:frame",
- "x = 1",
- "y = undefined",
- "$ locals",
- "< response:frame",
- "a = 2",
- "$ frame 1",
- "< response:frame",
- // Temporarily allow undefined as the script name.
- // "#01 g, foo.html",
- "#01 g, undefined",
- "61: f(1);",
- "$ stepout",
- "< response:continue",
- "< event:break",
- "g(), foo.html",
- "62: };",
- "$ continue",
- "< response:continue"
-];
-
-
-/**
- * Tests the debugger and protocol for a couple of simple scripts.
- */
-DebuggerTest.testProtocol = function() {
- DebuggerTest.initialize();
-
- // Startup the front-end.
- debug(new DebuggerTest.TabMock("testing"));
-
- script1 =
- "function f(x, y) {\n" + // line 23
- " var a=1;\n" + // line 24
- " if (x == 1) {\n" + // line 25
- " a++;\n }\n" + // line 26
- " return a;\n" + // line 27
- "};"; // line 28
- script2 =
- "function g() {\n" + // line 58
- " debugger;\n" + // line 59
- " f(1);\n" + // line 60
- "};"; // line 61
- %CompileScript(script1, "foo.html", 23, 0)();
- %CompileScript(script2, "foo.html", 58, 0)();
-
- try {
- g();
- } catch(e) {
- print(e);
- }
-
- DebuggerTest.verifyOutput();
-}
-
-DebuggerTest.testProtocol();