1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/mobile/android/base/tests/testAdobeFlash.java Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,43 @@ 1.4 +package org.mozilla.gecko.tests; 1.5 + 1.6 +import org.json.JSONObject; 1.7 +import org.mozilla.gecko.PaintedSurface; 1.8 + 1.9 +import android.os.Build; 1.10 + 1.11 +/** 1.12 + * Tests that Flash is working 1.13 + * - loads a page containing a Flash plugin 1.14 + * - verifies it rendered properly 1.15 + */ 1.16 +public class testAdobeFlash extends PixelTest { 1.17 + public void testLoad() { 1.18 + // This test only works on ICS and higher 1.19 + if (Build.VERSION.SDK_INT < 15) { 1.20 + blockForGeckoReady(); 1.21 + return; 1.22 + } 1.23 + 1.24 + // Enable plugins 1.25 + JSONObject jsonPref = new JSONObject(); 1.26 + try { 1.27 + jsonPref.put("name", "plugin.enable"); 1.28 + jsonPref.put("type", "string"); 1.29 + jsonPref.put("value", "1"); 1.30 + setPreferenceAndWaitForChange(jsonPref); 1.31 + } catch (Exception ex) { 1.32 + mAsserter.ok(false, "exception in testAdobeFlash", ex.toString()); 1.33 + } 1.34 + 1.35 + blockForGeckoReady(); 1.36 + 1.37 + String url = getAbsoluteUrl(StringHelper.ROBOCOP_ADOBE_FLASH_URL); 1.38 + PaintedSurface painted = loadAndGetPainted(url); 1.39 + 1.40 + mAsserter.ispixel(painted.getPixelAt(0, 0), 0, 0xff, 0, "Pixel at 0, 0"); 1.41 + mAsserter.ispixel(painted.getPixelAt(50, 50), 0, 0xff, 0, "Pixel at 50, 50"); 1.42 + mAsserter.ispixel(painted.getPixelAt(101, 0), 0xff, 0xff, 0xff, "Pixel at 101, 0"); 1.43 + mAsserter.ispixel(painted.getPixelAt(0, 101), 0xff, 0xff, 0xff, "Pixel at 0, 101"); 1.44 + 1.45 + } 1.46 +}