mobile/android/base/tests/testAdobeFlash.java

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:a14c012e87be
1 package org.mozilla.gecko.tests;
2
3 import org.json.JSONObject;
4 import org.mozilla.gecko.PaintedSurface;
5
6 import android.os.Build;
7
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 }
20
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 }
31
32 blockForGeckoReady();
33
34 String url = getAbsoluteUrl(StringHelper.ROBOCOP_ADOBE_FLASH_URL);
35 PaintedSurface painted = loadAndGetPainted(url);
36
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");
41
42 }
43 }

mercurial