summaryrefslogtreecommitdiffstats
path: root/chrome/test/debugger
diff options
context:
space:
mode:
authorsgjesse@google.com <sgjesse@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-14 13:35:35 +0000
committersgjesse@google.com <sgjesse@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-14 13:35:35 +0000
commit073baf53d8385f72f57210691a70080d79fa3103 (patch)
tree05ed75423d20dd3816300ae8a8ba2af61ecb2339 /chrome/test/debugger
parent3291e41a5704755fca214f4a8c85161bcb723d7d (diff)
downloadchromium_src-073baf53d8385f72f57210691a70080d79fa3103.zip
chromium_src-073baf53d8385f72f57210691a70080d79fa3103.tar.gz
chromium_src-073baf53d8385f72f57210691a70080d79fa3103.tar.bz2
Temporaly added local copy of mjsunit.js to debugger tests.
The Chrome debugger tests use mjsunit.js from the V8 test framework. In the transition to a new structure for V8 on code.google.com the location of this file will change. A local copy is added temporaly to the debugger tests directory which can be removed when Chrome starts to use V8 from code.google.com. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@867 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/debugger')
-rw-r--r--chrome/test/debugger/debugger_unittests.py6
-rw-r--r--chrome/test/debugger/mjsunit.js92
2 files changed, 97 insertions, 1 deletions
diff --git a/chrome/test/debugger/debugger_unittests.py b/chrome/test/debugger/debugger_unittests.py
index ae962a0..8fca6a1 100644
--- a/chrome/test/debugger/debugger_unittests.py
+++ b/chrome/test/debugger/debugger_unittests.py
@@ -31,7 +31,11 @@ def RunTests(build_dir=None):
cmd = [v8_shell_sample,
"--runtime-flags", runtime_flags,
os.path.join(chrome_dir, "browser", "debugger", "resources", "debugger_shell.js"),
- os.path.join(v8_dir, "tests", "mjsunit.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,
diff --git a/chrome/test/debugger/mjsunit.js b/chrome/test/debugger/mjsunit.js
new file mode 100644
index 0000000..7f247e0
--- /dev/null
+++ b/chrome/test/debugger/mjsunit.js
@@ -0,0 +1,92 @@
+/*
+ * 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);
+}
+