Bug 820831 - Mochitest changes for contentsScaleFactor on windows; r=jimm
authorKyle Machulis <kyle@nonpolynomial.com>
Mon, 13 Jul 2015 14:37:40 -0700
changeset 354690 59b665a08aabaa66c8c2c966c9194155a825752b
parent 354689 a569f8c9cf10c1749ee88d525c9e71a383bc60e7
child 354691 dbeaca20e104c0a13281896dcb6a1cda63b32ba9
push id6570
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:26:13 +0000
treeherdermozilla-beta@f455459b2ae5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm
bugs820831
milestone51.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 820831 - Mochitest changes for contentsScaleFactor on windows; r=jimm MozReview-Commit-ID: A9Q1rU5Z6WR
dom/plugins/test/mochitest/mochitest.ini
dom/plugins/test/mochitest/test_queryContentsScaleFactor.html
dom/plugins/test/mochitest/test_queryContentsScaleFactorWindowed.html
dom/plugins/test/testplugin/nptest.cpp
--- a/dom/plugins/test/mochitest/mochitest.ini
+++ b/dom/plugins/test/mochitest/mochitest.ini
@@ -119,17 +119,19 @@ support-files =
 [test_pluginstream_src.html]
 [test_pluginstream_src_dynamic.html]
 [test_pluginstream_src_referer.html]
 [test_positioning.html]
 skip-if = true # disabled due to oddness, perhaps scrolling of the mochitest window?
 [test_propertyAndMethod.html]
 [test_queryCSSZoomFactor.html]
 [test_queryContentsScaleFactor.html]
-skip-if = toolkit != "cocoa"
+skip-if = (toolkit != "cocoa") || (os != "win")
+[test_queryContentsScaleFactorWindowed.html]
+skip-if = (toolkit != "cocoa") || (os != "win")
 [test_redirect_handling.html]
 [test_secondPlugin.html]
 [test_src_url_change.html]
 [test_streamatclose.html]
 [test_streamNotify.html]
 [test_stringHandling.html]
 [test_twostreams.html]
 [test_visibility.html]
--- a/dom/plugins/test/mochitest/test_queryContentsScaleFactor.html
+++ b/dom/plugins/test/mochitest/test_queryContentsScaleFactor.html
@@ -16,15 +16,16 @@
       var exceptionThrown = false;
       try {
         contentsScaleFactor = pluginElement.queryContentsScaleFactor();
       } catch (e) {
         exceptionThrown = true;
       }
       is(exceptionThrown, false, "Exception thrown getting contents scale factor.");
       is(isNaN(contentsScaleFactor), false, "Invalid return getting contents scale factor");
+      ok(true, "Got Scale Factor of " + contentsScaleFactor);
       SimpleTest.finish();
     }
   </script>
 
   <embed id="plugin" type="application/x-test" width="400" height="400"></embed>
 </body>
 </html>
new file mode 100644
--- /dev/null
+++ b/dom/plugins/test/mochitest/test_queryContentsScaleFactorWindowed.html
@@ -0,0 +1,31 @@
+<html>
+<head>
+  <title>NPAPI NPNVcontentsScaleFactor Test</title>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="utils.js"></script>
+</head>
+
+<body onload="runTests()">
+  <script class="testbody" type="application/javascript">
+    SimpleTest.waitForExplicitFinish();
+    setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
+
+    function runTests() {
+      var pluginElement = document.getElementById("plugin");
+      var contentsScaleFactor;
+      var exceptionThrown = false;
+      try {
+        contentsScaleFactor = pluginElement.queryContentsScaleFactor();
+      } catch (e) {
+        exceptionThrown = true;
+      }
+      is(exceptionThrown, false, "Exception thrown getting contents scale factor.");
+      is(isNaN(contentsScaleFactor), false, "Invalid return getting contents scale factor");
+      ok(true, "Got Scale Factor of " + contentsScaleFactor);
+      SimpleTest.finish();
+    }
+  </script>
+
+  <embed id="plugin" type="application/x-test" width="400" height="400" wmode="window"></embed>
+</body>
+</html>
--- a/dom/plugins/test/testplugin/nptest.cpp
+++ b/dom/plugins/test/testplugin/nptest.cpp
@@ -3916,17 +3916,17 @@ bool getMouseUpEventCount(NPObject* npob
 }
 
 bool queryContentsScaleFactor(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result)
 {
   if (argCount != 0)
     return false;
 
   double scaleFactor = 1.0;
-#if defined(XP_MACOSX)
+#if defined(XP_MACOSX) || defined(XP_WIN)
   NPError err = NPN_GetValue(static_cast<TestNPObject*>(npobj)->npp,
                              NPNVcontentsScaleFactor, &scaleFactor);
   if (err != NPERR_NO_ERROR) {
     return false;
   }
 #endif
   DOUBLE_TO_NPVARIANT(scaleFactor, *result);
   return true;