Bug 1422697 - Changed crash reporter detection in unit test r=whimboo
authorVedant Chakravadhanula <vedantc98@gmail.com>
Tue, 05 Dec 2017 20:01:55 +0530
changeset 708671 240069ba65d7d460c4443110bb38112ff34fbc69
parent 708670 6ae2074a9f48bc654e1eaeac1d0835b86440f35d
child 708672 b0c952f7d225181a76d4dafbe144dcd72e10b08b
push id92403
push userVYV03354@nifty.ne.jp
push dateWed, 06 Dec 2017 22:18:41 +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: