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.

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

mercurial