Bug 967694 - Fix tests that expect old behavior. r=bsmedberg

This commit is contained in:
John Schoenick 2014-02-06 15:36:17 -08:00
parent a9d7a9fe8b
commit 99e1d7de24
3 changed files with 29 additions and 22 deletions

View File

@ -729,21 +729,23 @@ function test22() {
is(objLoadingContent.displayedType, Ci.nsIObjectLoadingContent.TYPE_PLUGIN, "Test 22, plugin should have started");
ok(pluginNode.activated, "Test 22, plugin should be activated");
// Reload plugin
var oldVal = pluginNode.getObjectValue();
pluginNode.src = pluginNode.src;
is(objLoadingContent.displayedType, Ci.nsIObjectLoadingContent.TYPE_PLUGIN, "Test 22, Plugin should have retained activated state");
ok(pluginNode.activated, "Test 22, plugin should have remained activated");
// Sanity, ensure that we actually reloaded the instance, since this behavior might change in the future.
var pluginsDiffer;
try {
pluginNode.checkObjectValue(oldVal);
} catch (e) {
pluginsDiffer = true;
}
ok(pluginsDiffer, "Test 22, plugin should have reloaded");
// Spin event loop for plugin to finish spawning
executeSoon(function() {
var oldVal = pluginNode.getObjectValue();
pluginNode.src = pluginNode.src;
is(objLoadingContent.displayedType, Ci.nsIObjectLoadingContent.TYPE_PLUGIN, "Test 22, Plugin should have retained activated state");
ok(pluginNode.activated, "Test 22, plugin should have remained activated");
// Sanity, ensure that we actually reloaded the instance, since this behavior might change in the future.
var pluginsDiffer;
try {
pluginNode.checkObjectValue(oldVal);
} catch (e) {
pluginsDiffer = true;
}
ok(pluginsDiffer, "Test 22, plugin should have reloaded");
prepareTest(runAfterPluginBindingAttached(test23), gTestRoot + "plugin_test.html");
prepareTest(runAfterPluginBindingAttached(test23), gTestRoot + "plugin_test.html");
});
}
// Tests that a click-to-play plugin resets its activated state when changing types

View File

@ -21,12 +21,17 @@
const FLAG_CLEAR_ALL = pluginHostIface.FLAG_CLEAR_ALL;
const FLAG_CLEAR_CACHE = pluginHostIface.FLAG_CLEAR_CACHE;
// Make sure clearing by timerange is supported.
var p = document.getElementById("plugin1");
p.setSitesWithDataCapabilities(true);
ok(PluginUtils.withTestPlugin(runTest), "Test plugin found");
SimpleTest.finish();
// Since we're running with chrome permissions, accessing the plugin wont
// synchronously spawn it -- wait for the async spawning to finish.
SimpleTest.executeSoon(function() {
// Make sure clearing by timerange is supported.
p.setSitesWithDataCapabilities(true);
ok(PluginUtils.withTestPlugin(runTest), "Test plugin found");
SimpleTest.finish();
});
function stored(needles) {
var something = pluginHost.siteHasData(this.pluginTag, null);

View File

@ -25,7 +25,7 @@ for (var tag of pluginTags) {
</div>
</p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
@ -40,10 +40,10 @@ function consistencyCheck(state) {
ok(s == "", "Consistency check: " + state + ": " + s);
}
consistencyCheck("Initial state");
function runTests()
{
consistencyCheck("Initial state");
var scroll = document.getElementById("scroll");
scroll.scrollTop = 10;
consistencyCheck("Scrolled down a bit");
@ -52,7 +52,7 @@ function runTests()
consistencyCheck("Before scrolling back to top");
scroll.scrollTop = 0;
consistencyCheck("Scrolled to top");
setTimeout(function() {
consistencyCheck("After scrolling to top");