mobile/android/base/tests/testAdobeFlash.java

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     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