diff -r 000000000000 -r 6474c204b198 mobile/android/base/tests/testAdobeFlash.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mobile/android/base/tests/testAdobeFlash.java Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,43 @@ +package org.mozilla.gecko.tests; + +import org.json.JSONObject; +import org.mozilla.gecko.PaintedSurface; + +import android.os.Build; + +/** + * Tests that Flash is working + * - loads a page containing a Flash plugin + * - verifies it rendered properly + */ +public class testAdobeFlash extends PixelTest { + public void testLoad() { + // This test only works on ICS and higher + if (Build.VERSION.SDK_INT < 15) { + blockForGeckoReady(); + return; + } + + // Enable plugins + JSONObject jsonPref = new JSONObject(); + try { + jsonPref.put("name", "plugin.enable"); + jsonPref.put("type", "string"); + jsonPref.put("value", "1"); + setPreferenceAndWaitForChange(jsonPref); + } catch (Exception ex) { + mAsserter.ok(false, "exception in testAdobeFlash", ex.toString()); + } + + blockForGeckoReady(); + + String url = getAbsoluteUrl(StringHelper.ROBOCOP_ADOBE_FLASH_URL); + PaintedSurface painted = loadAndGetPainted(url); + + mAsserter.ispixel(painted.getPixelAt(0, 0), 0, 0xff, 0, "Pixel at 0, 0"); + mAsserter.ispixel(painted.getPixelAt(50, 50), 0, 0xff, 0, "Pixel at 50, 50"); + mAsserter.ispixel(painted.getPixelAt(101, 0), 0xff, 0xff, 0xff, "Pixel at 101, 0"); + mAsserter.ispixel(painted.getPixelAt(0, 101), 0xff, 0xff, 0xff, "Pixel at 0, 101"); + + } +}