mobile/android/base/tests/testAdobeFlash.java

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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