Bug 841996 - Fix permanent orange for test-plugin-crashing.js. r+a=mbanner.
--- a/calendar/test/mozmill/Makefile.in
+++ b/calendar/test/mozmill/Makefile.in
@@ -49,19 +49,21 @@ mozmill-stage: $(MOZMILL_SHARED)
$(INSTALL) $(wildcard $(srcdir)/shared-modules/*.js) $(MOZMILL_STAGE_SHARED)
mozmill: mozmill-stage
unset PYTHONHOME && cd $(MOZMILLDIR) && unset MACOSX_DEPLOYMENT_TARGET && \
$(MOZMILLPYTHON) runtestlist.py --list=$(srcdir)/mozmilltests.list \
--binary=$(MOZMILLPROGRAM) \
--dir=$(call core_abspath,$(MOZMILLDIR))/stage \
--symbols-path=$(call core_abspath,$(DIST)/crashreporter-symbols) \
+ --plugins-path=$(call core_abspath,$(DIST)/plugins) \
$(MOZMILL_EXTRA)
mozmill-one: solo-test = $(find-solo-test)
mozmill-one: mozmill-stage
unset PYTHONHOME && cd $(MOZMILLDIR) && unset MACOSX_DEPLOYMENT_TARGET && \
$(MOZMILLPYTHON) runtest.py \
--test=$(call core_abspath,$(MOZMILLDIR))/stage/$(solo-test) \
--binary=$(MOZMILLPROGRAM) \
--symbols-path=$(call core_abspath,$(DIST)/crashreporter-symbols) \
+ --plugins-path=$(call core_abspath,$(DIST)/plugins) \
$(MOZMILL_EXTRA)
--- a/mail/test/mozmill/content-tabs/html/plugin.html
+++ b/mail/test/mozmill/content-tabs/html/plugin.html
@@ -1,9 +1,9 @@
<html>
<head>
<title>Plugin Test</title>
</head>
<body bgcolor="#FFFFFF">
<h1>Plugin Test</h1>
- <embed id="test-plugin" type="application/x-test" width="200" height="200"></embed>
+ <embed id="test-plugin" type="application/x-test" width="500" height="500"></embed>
</body>
</html>
--- a/mail/test/mozmill/content-tabs/test-plugin-crashing.js
+++ b/mail/test/mozmill/content-tabs/test-plugin-crashing.js
@@ -15,16 +15,17 @@ var elib = {};
Components.utils.import('resource://mozmill/modules/elementslib.js', elib);
Components.utils.import('resource://gre/modules/Services.jsm');
var gContentWindow = null;
var gJSObject = null;
var gTabDoc = null;
var gOldStartPage = null;
+let gOldCrashReporterEnabled = null;
const kPluginId = "test-plugin";
const kStartPagePref = "mailnews.start_page.override_url";
const kPluginCrashDocPref = "plugins.crash.supportUrl";
// RELATIVE_ROOT messes with the collector, so we have to bring the path back
// so we get the right path for the resources.
const kUrl = collector.addHttpResource('../content-tabs/html', '');
const kPluginUrl = kUrl + "plugin.html";
@@ -45,16 +46,23 @@ function setupModule(module) {
Services.prefs.setCharPref(kPluginCrashDocPref, kPluginCrashDocUrl);
let Cc = Components.classes;
let Ci = Components.interfaces;
let crashReporter = Cc["@mozilla.org/toolkit/crash-reporter;1"]
.getService(Ci.nsICrashReporter);
+ // Force the crash reporter to be enabled, but record its old setting.
+ gOldCrashReporterEnabled = crashReporter.enabled;
+
+ if (!crashReporter.enabled) {
+ crashReporter.enabled = true;
+ }
+
/* Bug 689580 - these crash tests fail randomly on 64-bit OSX. We'll
* disable them for now, until we can figure out what's going on.
*/
Components.utils.import("resource://gre/modules/Services.jsm");
let is64BitOSX = (mc.mozmillModule.isMac &&
Services.appinfo.XPCOMABI.contains("x86_64-"));
// These tests are no good if the crash reporter is disabled, or if
@@ -68,16 +76,21 @@ function setupModule(module) {
funcsToSkip.forEach(function(func) {
func.__force_skip__ = true;
});
}
};
function teardownModule(module) {
+ let crashReporter = Cc["@mozilla.org/toolkit/crash-reporter;1"]
+ .getService(Ci.nsICrashReporter);
+
+ crashReporter.enabled = gOldCrashReporterEnabled;
+
Services.prefs.setCharPref(kStartPagePref, gOldStartPage);
Services.prefs.setCharPref(kPluginCrashDocPref, gOldPluginCrashDocPage);
}
function setupTest() {
let tab = open_content_tab_with_click(mc.menus.helpMenu.whatsNew, kPluginUrl);
assert_tab_has_title(tab, "Plugin Test");
@@ -194,18 +207,19 @@ function test_crashed_plugin_notificatio
}
/* Test that if a plugin crashes, and the plugin's <object>
* is large enough to display a message, it'll display the
* appropriate crash message.
*/
function test_crashed_plugin_notification_inline() {
let plugin = gTabDoc.getElementById(kPluginId);
- plugin.style.width = '200px';
- plugin.style.height = '200px';
+
+ plugin.style.width = '500px';
+ plugin.style.height = '500px';
assert_true(crash_plugin());
/* This function attempts to return the status div on the
* crashed plugin widget. Returns null on failure.
*/
function getStatusDiv() {
let submitDiv = gContentWindow.document
@@ -222,18 +236,20 @@ function test_crashed_plugin_notificatio
mc.waitFor(function() (getStatusDiv() != null),
"Timed out waiting for plugin status div to appear");
let submitDiv = getStatusDiv();
// Depending on the environment we're running this test on,
// the status attribute might be "noReport" or "please".
let statusString = submitDiv.getAttribute("status");
+
assert_true(statusString == "noReport" || statusString == "please",
- "Expected the status to be \"noReport\" or \"please\"");
+ "Expected the status to be \"noReport\" or \"please\". " +
+ "Instead, it was " + statusString);
// Make sure that the help link in the inline notification works.
let helpIcon = gContentWindow.document
.getAnonymousElementByAttribute(plugin,
"class",
"helpIcon");
assert_not_equals(null, helpIcon, "Help Icon should have been available");
--- a/mail/test/mozmill/runtest.py
+++ b/mail/test/mozmill/runtest.py
@@ -29,16 +29,17 @@ from automation import Automation
automation = Automation()
from automationutils import checkForCrashes
from time import sleep
import imp
PROFILE_DIR = os.path.join(SCRIPT_DIRECTORY, 'mozmillprofile')
SYMBOLS_PATH = None
+PLUGINS_PATH = None
# XXX This breaks any semblance of test runner modularity, and only works
# because we know that we run MozMill only once per process. This needs to be
# fixed if that ever changes.
TEST_NAME = None
# The name of the (optional) module that tests can define as a wrapper (e.g. to
# run before Thunderbird is started)
WRAPPER_MODULE_NAME = "wrapper"
@@ -187,16 +188,23 @@ class ThunderTestProfile(mozrunner.Thund
# create a clean directory
if os.path.exists(PROFILE_DIR):
shutil.rmtree(PROFILE_DIR, onerror=rmtree_onerror)
os.makedirs(PROFILE_DIR)
print 'Using profile dir:', PROFILE_DIR
if not os.path.exists(PROFILE_DIR):
raise Exception('somehow failed to create profile dir!')
+ if PLUGINS_PATH:
+ if not os.path.exists(PLUGINS_PATH):
+ raise Exception('Plugins path "%s" does not exist.' % PLUGINS_PATH)
+
+ dest = os.path.join(PROFILE_DIR, "plugins")
+ shutil.copytree(PLUGINS_PATH, dest)
+
if wrapper is not None and hasattr(wrapper, "on_profile_created"):
# It's a little dangerous to allow on_profile_created access to the
# profile object, because it isn't fully initalized yet
wrapper.on_profile_created(PROFILE_DIR)
if (wrapper is not None and hasattr(wrapper, "NO_ACCOUNTS")
and wrapper.NO_ACCOUNTS):
pass
@@ -310,32 +318,35 @@ if hasattr(mozmill.MozMill, 'find_tests'
class ThunderTestCLI(mozmill.CLI):
profile_class = ThunderTestProfile
runner_class = ThunderTestRunner
parser_options = copy.copy(mozmill.CLI.parser_options)
parser_options[('--symbols-path',)] = {"default": None, "dest": "symbols",
"help": "The path to the symbol files from build_symbols"}
+ parser_options[('--plugins-path',)] = {"default": None, "dest": "plugins",
+ "help": "The path to the plugins directory for the created profile"}
def __init__(self, *args, **kwargs):
- global SYMBOLS_PATH, TEST_NAME
+ global SYMBOLS_PATH, PLUGINS_PATH, TEST_NAME
# mozmill 1.5.4 still explicitly hardcodes references to Firefox; in
# order to avoid missing out on initializer logic or needing to copy
# it, we monkeypatch mozmill's view of mozrunner. (Keep in mind that
# the python module import process shallow copies dictionaries...)
mozmill.mozrunner.FirefoxRunner = self.runner_class
mozmill.mozrunner.FirefoxProfile = self.profile_class
# note: we previously hardcoded a JS bridge timeout of 300 seconds,
# but the default is now 60 seconds...
mozmill.CLI.__init__(self, *args, **kwargs)
SYMBOLS_PATH = self.options.symbols
+ PLUGINS_PATH = self.options.plugins
if isinstance(self.options.test, basestring):
test_paths = [self.options.test]
else:
test_paths = self.options.test
TEST_NAME = ', '.join([os.path.basename(t) for t in test_paths])
test_dirs = self.test_dirs = []
for test_file in test_paths:
--- a/mail/test/mozmill/runtestlist.py
+++ b/mail/test/mozmill/runtestlist.py
@@ -33,16 +33,20 @@ class RunTestListOptions(optparse.Option
help = "Directory of the tests, leave blank for current directory")
defaults["dir"] = ""
self.add_option("--symbols-path",
action = "store", type = "string", dest = "symbols",
help = "The path to the symbol files from build_symbols")
defaults["symbols"] = ""
+ self.add_option("--plugins-path",
+ action = "store", type = "string", dest = "plugins",
+ help = "The path to the plugins folder for the test profiles")
+
self.set_defaults(**defaults);
usage = """\
Usage instructions for runtestlist.py
"""
self.set_usage(usage)
log = logging.getLogger()
@@ -66,16 +70,21 @@ for directory in f:
log.info("INFO | (runtestlist.py) | Running directory: %s",
directory.rstrip())
if options.dir != "":
testDirectory = os.path.join(options.dir, directory.rstrip())
else:
testDirectory = directory.rstrip()
args = [sys.executable, "runtest.py", "-t", testDirectory,
"--binary", options.binary, "--symbols-path", options.symbols]
+
+ if options.plugins:
+ args.append("--plugins-path")
+ args.append(options.plugins)
+
print args
outputPipe = subprocess.PIPE
proc = subprocess.Popen(args, cwd=SCRIPT_DIRECTORY, stdout = subprocess.PIPE, stderr = subprocess.STDOUT)
testErrors = 0
testPasses = 0
--- a/mail/testsuite-targets.mk
+++ b/mail/testsuite-targets.mk
@@ -33,25 +33,27 @@ find-solo-test = $(if $(and $(SOLO_TEST)
# PYTHONHOME messes very badly with virtualenv setups, so unset it.
mozmill:
$(call check-no-solo,SOLOVAR is specified. Perhaps you meant mozmill-one.)
unset PYTHONHOME && cd $(MOZMILLDIR) && MACOSX_DEPLOYMENT_TARGET= \
$(MOZMILLPYTHON) runtestlist.py --list=mozmilltests.list \
--binary=$(PROGRAM) \
--dir=$(call core_abspath,$(topsrcdir))/mail/test/mozmill \
--symbols-path=$(call core_abspath,$(DIST)/crashreporter-symbols) \
+ --plugins-path=$(call core_abspath,$(DIST)/plugins) \
$(MOZMILL_EXTRA)
mozmill-one: solo-test = $(find-solo-test)
mozmill-one:
unset PYTHONHOME && cd $(MOZMILLDIR) && MACOSX_DEPLOYMENT_TARGET= \
$(MOZMILLPYTHON) runtest.py \
--test=$(call core_abspath,$(topsrcdir))/mail/test/mozmill/$(solo-test) \
--binary=$(PROGRAM) \
--symbols-path=$(call core_abspath,$(DIST)/crashreporter-symbols) \
+ --plugins-path=$(call core_abspath,$(DIST)/plugins) \
$(MOZMILL_EXTRA)
# XXX The mozilla/testing/testsuite-targets.mk doesn't really allow for hooks
# outside of itself. Therefore we replicate the functionality we need here,
# calling into the relevant mozilla dirs when necessary for the core tests.
ifndef UNIVERSAL_BINARY
PKG_STAGE = $(DIST)/test-package-stage
package-tests:: stage-mozilla-tests stage-mozmill stage-modules