summaryrefslogtreecommitdiffstats
path: root/toolkit/crashreporter/test/unit_ipc
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /toolkit/crashreporter/test/unit_ipc
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'toolkit/crashreporter/test/unit_ipc')
-rw-r--r--toolkit/crashreporter/test/unit_ipc/.eslintrc.js7
-rw-r--r--toolkit/crashreporter/test/unit_ipc/test_content_annotation.js22
-rw-r--r--toolkit/crashreporter/test/unit_ipc/test_content_exception_time_annotation.js17
-rw-r--r--toolkit/crashreporter/test/unit_ipc/test_content_memory_list.js23
-rw-r--r--toolkit/crashreporter/test/unit_ipc/test_content_oom_annotation_windows.js23
-rw-r--r--toolkit/crashreporter/test/unit_ipc/xpcshell.ini15
6 files changed, 107 insertions, 0 deletions
diff --git a/toolkit/crashreporter/test/unit_ipc/.eslintrc.js b/toolkit/crashreporter/test/unit_ipc/.eslintrc.js
new file mode 100644
index 000000000..fee088c17
--- /dev/null
+++ b/toolkit/crashreporter/test/unit_ipc/.eslintrc.js
@@ -0,0 +1,7 @@
+"use strict";
+
+module.exports = {
+ "extends": [
+ "../../../../testing/xpcshell/xpcshell.eslintrc.js"
+ ]
+};
diff --git a/toolkit/crashreporter/test/unit_ipc/test_content_annotation.js b/toolkit/crashreporter/test/unit_ipc/test_content_annotation.js
new file mode 100644
index 000000000..8a5c962e3
--- /dev/null
+++ b/toolkit/crashreporter/test/unit_ipc/test_content_annotation.js
@@ -0,0 +1,22 @@
+load("../unit/head_crashreporter.js");
+
+function run_test()
+{
+ if (!("@mozilla.org/toolkit/crash-reporter;1" in Components.classes)) {
+ dump("INFO | test_content_annotation.js | Can't test crashreporter in a non-libxul build.\n");
+ return;
+ }
+
+ // Try crashing with a runtime abort
+ do_content_crash(function() {
+ crashType = CrashTestUtils.CRASH_RUNTIMEABORT;
+ crashReporter.annotateCrashReport("TestKey", "TestValue");
+ crashReporter.appendAppNotesToCrashReport("!!!foo!!!");
+ },
+ function(mdump, extra) {
+ do_check_eq(extra.TestKey, "TestValue");
+ do_check_true('StartupTime' in extra);
+ do_check_true('ProcessType' in extra);
+ do_check_neq(extra.Notes.indexOf("!!!foo!!!"), -1);
+ });
+}
diff --git a/toolkit/crashreporter/test/unit_ipc/test_content_exception_time_annotation.js b/toolkit/crashreporter/test/unit_ipc/test_content_exception_time_annotation.js
new file mode 100644
index 000000000..810f683b2
--- /dev/null
+++ b/toolkit/crashreporter/test/unit_ipc/test_content_exception_time_annotation.js
@@ -0,0 +1,17 @@
+load("../unit/head_crashreporter.js");
+
+function run_test()
+{
+ if (!("@mozilla.org/toolkit/crash-reporter;1" in Components.classes)) {
+ dump("INFO | test_content_annotation.js | Can't test crashreporter in a non-libxul build.\n");
+ return;
+ }
+
+ // Try crashing with an OOM
+ do_content_crash(function() {
+ crashType = CrashTestUtils.CRASH_OOM;
+ },
+ function(mdump, extra) {
+ do_check_true('OOMAllocationSize' in extra);
+ });
+}
diff --git a/toolkit/crashreporter/test/unit_ipc/test_content_memory_list.js b/toolkit/crashreporter/test/unit_ipc/test_content_memory_list.js
new file mode 100644
index 000000000..906f57e83
--- /dev/null
+++ b/toolkit/crashreporter/test/unit_ipc/test_content_memory_list.js
@@ -0,0 +1,23 @@
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/publicdomain/zero/1.0/
+
+load("../unit/head_crashreporter.js");
+
+function run_test()
+{
+ var is_win7_or_newer = false;
+ var ph = Components.classes["@mozilla.org/network/protocol;1?name=http"]
+ .getService(Components.interfaces.nsIHttpProtocolHandler);
+ var match = ph.userAgent.match(/Windows NT (\d+).(\d+)/);
+ if (match && (parseInt(match[1]) > 6 ||
+ parseInt(match[1]) == 6 && parseInt(match[2]) >= 1)) {
+ is_win7_or_newer = true;
+ }
+
+ do_content_crash(null, function(mdump, extra) {
+ do_check_true(mdump.exists());
+ do_check_true(mdump.fileSize > 0);
+ if (is_win7_or_newer)
+ do_check_true(CrashTestUtils.dumpHasStream(mdump.path, CrashTestUtils.MD_MEMORY_INFO_LIST_STREAM));
+ });
+}
diff --git a/toolkit/crashreporter/test/unit_ipc/test_content_oom_annotation_windows.js b/toolkit/crashreporter/test/unit_ipc/test_content_oom_annotation_windows.js
new file mode 100644
index 000000000..9853696da
--- /dev/null
+++ b/toolkit/crashreporter/test/unit_ipc/test_content_oom_annotation_windows.js
@@ -0,0 +1,23 @@
+load("../unit/head_crashreporter.js");
+
+function run_test()
+{
+ if (!("@mozilla.org/toolkit/crash-reporter;1" in Components.classes)) {
+ dump("INFO | test_content_annotation.js | Can't test crashreporter in a non-libxul build.\n");
+ return;
+ }
+
+ // Try crashing with an OOM
+ do_content_crash(function() {
+ crashType = CrashTestUtils.CRASH_OOM;
+ },
+ function(mdump, extra) {
+ do_check_true("SystemMemoryUsePercentage" in extra);
+ do_check_true("TotalVirtualMemory" in extra);
+ do_check_true("AvailableVirtualMemory" in extra);
+ do_check_true("TotalPageFile" in extra);
+ do_check_true("AvailablePageFile" in extra);
+ do_check_true("TotalPhysicalMemory" in extra);
+ do_check_true("AvailablePhysicalMemory" in extra);
+ });
+}
diff --git a/toolkit/crashreporter/test/unit_ipc/xpcshell.ini b/toolkit/crashreporter/test/unit_ipc/xpcshell.ini
new file mode 100644
index 000000000..33fcc1a4c
--- /dev/null
+++ b/toolkit/crashreporter/test/unit_ipc/xpcshell.ini
@@ -0,0 +1,15 @@
+[DEFAULT]
+head =
+tail =
+skip-if = toolkit == 'android'
+support-files =
+ !/toolkit/crashreporter/test/unit/crasher_subprocess_head.js
+ !/toolkit/crashreporter/test/unit/crasher_subprocess_tail.js
+ !/toolkit/crashreporter/test/unit/head_crashreporter.js
+
+[test_content_annotation.js]
+[test_content_exception_time_annotation.js]
+[test_content_oom_annotation_windows.js]
+skip-if = os != 'win'
+[test_content_memory_list.js]
+skip-if = os != 'win'