Bug 1422697 - Changed crash reporter detection in unit test r=whimboo draft crash_reporter
authorVedant Chakravadhanula <vedantc98@gmail.com>
Tue, 05 Dec 2017 20:01:55 +0530
branchcrash_reporter
changeset 708191 eb49d7ca7c457ae1afaafdd9e6364333aebd03bf
parent 707503 b4cef8d1dff06a1ec2b9bb17211c0c3c7f5b76fa
child 743126 9cb51b4a7d925620815c064a313e417d6e7bca95
push id92316
push userbmo:vedantc98@gmail.com
push dateWed, 06 Dec 2017 10:31:15 +0000
reviewerswhimboo
bugs1422697
milestone59.0a1
Bug 1422697 - Changed crash reporter detection in unit test r=whimboo Since the crash reporter interface was made available all the time, the check for the enabled state of the crash reporter had to be made via AppConstants.jsm MozReview-Commit-ID: LPkBVEjBB5o
testing/marionette/harness/marionette_harness/tests/unit/test_crash.py
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_crash.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_crash.py
@@ -21,23 +21,18 @@ from mozrunner.base import runner
 class MockMozCrash(object):
     """Mock object to replace original mozcrash methods."""
 
     def __init__(self, marionette):
         self.marionette = marionette
 
         with self.marionette.using_context('chrome'):
             self.crash_reporter_enabled = self.marionette.execute_script("""
-                try {
-                  Components.classes["@mozilla.org/toolkit/crash-reporter;1"].
-                    getService(Components.interfaces.nsICrashReporter);
-                  return true;
-                } catch (exc) {
-                  return false;
-                }
+                Cu.import("resource://gre/modules/AppConstants.jsm");
+                return AppConstants.MOZ_CRASHREPORTER;
             """)
 
     def check_for_crashes(self, dump_directory, *args, **kwargs):
         if self.crash_reporter_enabled:
             # Workaround until bug 1376795 has been fixed
             # Wait at maximum 5s for the minidump files being created
             # minidump_files = glob.glob('{}/*.dmp'.format(dump_directory))
             try: