mobile/android/base/tests/testAdobeFlash.java

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 package org.mozilla.gecko.tests;
michael@0 2
michael@0 3 import org.json.JSONObject;
michael@0 4 import org.mozilla.gecko.PaintedSurface;
michael@0 5
michael@0 6 import android.os.Build;
michael@0 7
michael@0 8 /**
michael@0 9 * Tests that Flash is working
michael@0 10 * - loads a page containing a Flash plugin
michael@0 11 * - verifies it rendered properly
michael@0 12 */
michael@0 13 public class testAdobeFlash extends PixelTest {
michael@0 14 public void testLoad() {
michael@0 15 // This test only works on ICS and higher
michael@0 16 if (Build.VERSION.SDK_INT < 15) {
michael@0 17 blockForGeckoReady();
michael@0 18 return;
michael@0 19 }
michael@0 20
michael@0 21 // Enable plugins
michael@0 22 JSONObject jsonPref = new JSONObject();
michael@0 23 try {
michael@0 24 jsonPref.put("name", "plugin.enable");
michael@0 25 jsonPref.put("type", "string");
michael@0 26 jsonPref.put("value", "1");
michael@0 27 setPreferenceAndWaitForChange(jsonPref);
michael@0 28 } catch (Exception ex) {
michael@0 29 mAsserter.ok(false, "exception in testAdobeFlash", ex.toString());
michael@0 30 }
michael@0 31
michael@0 32 blockForGeckoReady();
michael@0 33
michael@0 34 String url = getAbsoluteUrl(StringHelper.ROBOCOP_ADOBE_FLASH_URL);
michael@0 35 PaintedSurface painted = loadAndGetPainted(url);
michael@0 36
michael@0 37 mAsserter.ispixel(painted.getPixelAt(0, 0), 0, 0xff, 0, "Pixel at 0, 0");
michael@0 38 mAsserter.ispixel(painted.getPixelAt(50, 50), 0, 0xff, 0, "Pixel at 50, 50");
michael@0 39 mAsserter.ispixel(painted.getPixelAt(101, 0), 0xff, 0xff, 0xff, "Pixel at 101, 0");
michael@0 40 mAsserter.ispixel(painted.getPixelAt(0, 101), 0xff, 0xff, 0xff, "Pixel at 0, 101");
michael@0 41
michael@0 42 }
michael@0 43 }

mercurial