Bug 967694 - Fix tests that expect old behavior. r=bsmedberg
authorJohn Schoenick <jschoenick@mozilla.com>
Thu, 06 Feb 2014 15:36:17 -0800
changeset 168195 5d4ffa16f845b48132decdaaed14bf0acfc4ac93
parent 168194 301611f83b2bf3229b157d140b1049086ee6001d
child 168196 2812fd3a32130fd256c78da62f63e198a9d4ef4f
push id39659
push userjschoenick@mozilla.com
push dateTue, 11 Feb 2014 20:15:21 +0000
treeherdermozilla-inbound@5d4ffa16f845 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs967694
milestone30.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 967694 - Fix tests that expect old behavior. r=bsmedberg
browser/base/content/test/general/browser_pluginnotification.js
dom/plugins/test/mochitest/test_clear_site_data.html
widget/tests/test_plugin_scroll_consistency.html
--- a/browser/base/content/test/general/browser_pluginnotification.js
+++ b/browser/base/content/test/general/browser_pluginnotification.js
@@ -724,31 +724,33 @@ function test22() {
   var objLoadingContent = pluginNode.QueryInterface(Ci.nsIObjectLoadingContent);
   is(objLoadingContent.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY, "Test 22, plugin fallback type should be PLUGIN_CLICK_TO_PLAY");
 
   // Activate
   objLoadingContent.playPlugin();
   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
 function test23() {
   ok(PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser), "Test 23, Should have a click-to-play notification");
 
   // Plugin should start as CTP
   var pluginNode = gTestBrowser.contentDocument.getElementById("test");
--- a/dom/plugins/test/mochitest/test_clear_site_data.html
+++ b/dom/plugins/test/mochitest/test_clear_site_data.html
@@ -16,22 +16,27 @@
     SimpleTest.waitForExplicitFinish();
 
     const pluginHostIface = Components.interfaces.nsIPluginHost;
     var pluginHost = Components.classes["@mozilla.org/plugin/host;1"].
                      getService(pluginHostIface);
     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);
       if (!needles)
         return something;
 
       if (!something)
         return false;
--- a/widget/tests/test_plugin_scroll_consistency.html
+++ b/widget/tests/test_plugin_scroll_consistency.html
@@ -20,44 +20,44 @@ for (var tag of pluginTags) {
 
 <p id="display">
   <div style="overflow:hidden; height:100px;" id="scroll">
     <embed type="application/x-test" wmode="window" width="100" height="800" id="plugin"></object>
     <div style="height:1000px;"></div>
   </div>
 </p>
 <div id="content" style="display: none">
-  
+
 </div>
 <pre id="test">
 </pre>
 
 <script class="testbody" type="application/javascript">
 SimpleTest.waitForExplicitFinish();
 
 var plugin = document.getElementById("plugin");
 
 function consistencyCheck(state) {
   var s = plugin.doInternalConsistencyCheck();
   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");
 
   setTimeout(function() {
     consistencyCheck("Before scrolling back to top");
     scroll.scrollTop = 0;
     consistencyCheck("Scrolled to top");
-  
+
     setTimeout(function() {
       consistencyCheck("After scrolling to top");
 
       SimpleTest.finish();
     }, 0);
   }, 0);
 }