Bug 958836 - Add robocop test for Flash on Android r=mfinkle,mcomella
authorJames Willcox <snorp@snorp.net>
Fri, 10 Jan 2014 19:51:54 -0600
changeset 166285 2dc16f5371bdf5d0fb2f2494fa197eac8b6811d4
parent 166284 5bb542c69d75facbfdb5cbbdcd61aa541c05aeef
child 166286 7b8784894c965955f26304905496e2360535684f
push id39159
push userjwillcox@mozilla.com
push dateFri, 31 Jan 2014 18:21:19 +0000
treeherdermozilla-inbound@2dc16f5371bd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle, mcomella
bugs958836
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 958836 - Add robocop test for Flash on Android r=mfinkle,mcomella
build/mobile/robocop/Makefile.in
mobile/android/base/tests/StringHelper.java
mobile/android/base/tests/green.swf
mobile/android/base/tests/robocop.ini
mobile/android/base/tests/robocop_adobe_flash.html
mobile/android/base/tests/testAdobeFlash.java
--- a/build/mobile/robocop/Makefile.in
+++ b/build/mobile/robocop/Makefile.in
@@ -58,16 +58,17 @@ robocop-deps := $(notdir $(robocop_FILES
 
 MOCHITEST_ROBOCOP_FILES := \
   $(wildcard $(TESTPATH)/*.html) \
   $(wildcard $(TESTPATH)/*.jpg) \
   $(wildcard $(TESTPATH)/*.sjs) \
   $(wildcard $(TESTPATH)/test*.js) \
   $(wildcard $(TESTPATH)/robocop*.js) \
   $(wildcard $(TESTPATH)/*.xml) \
+  $(wildcard $(TESTPATH)/*.swf) \
   $(NULL)
 
 GARBAGE += \
   AndroidManifest.xml \
   $(robocop-deps) \
   $(testconstants-dep) \
   $(NULL)
 
--- a/mobile/android/base/tests/StringHelper.java
+++ b/mobile/android/base/tests/StringHelper.java
@@ -70,16 +70,17 @@ public class StringHelper {
     public static final String ROBOCOP_BLANK_PAGE_03_URL = "/robocop/robocop_blank_03.html";
     public static final String ROBOCOP_BOXES_URL = "/robocop/robocop_boxes.html";
     public static final String ROBOCOP_GEOLOCATION_URL = "/robocop/robocop_geolocation.html";
     public static final String ROBOCOP_LOGIN_URL = "/robocop/robocop_login.html";
     public static final String ROBOCOP_OFFLINE_STORAGE_URL = "/robocop/robocop_offline_storage.html";
     public static final String ROBOCOP_PICTURE_LINK_URL = "/robocop/robocop_picture_link.html";
     public static final String ROBOCOP_SEARCH_URL = "/robocop/robocop_search.html";
     public static final String ROBOCOP_TEXT_PAGE_URL = "/robocop/robocop_text_page.html";
+    public static final String ROBOCOP_ADOBE_FLASH_URL = "/robocop/robocop_adobe_flash.html";
 
     // Robocop page titles
     public static final String ROBOCOP_BIG_LINK_TITLE = "Big Link";
     public static final String ROBOCOP_BIG_MAILTO_TITLE = "Big Mailto";
     public static final String ROBOCOP_BLANK_PAGE_01_TITLE = "Browser Blank Page 01";
     public static final String ROBOCOP_BLANK_PAGE_02_TITLE = "Browser Blank Page 02";
     public static final String ROBOCOP_BLANK_PAGE_03_TITLE = "Browser Blank Page 03";
     public static final String ROBOCOP_BOXES_TITLE = "Browser Box test";
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..e6f6aed148ccc2e26a600b646284119d5fa2ed2a
GIT binary patch
literal 112
zc$@)n0FVDeS5pX=0001Z+Dl-tYXBieMh0gl1_lOuR#za&$iSMykit+g=j|awULc=I
z;rH}w$0c}Xfs_yd%<VQ_OHt-vVn~1(&*;d=aMOW-6(lFXBiDZ6Wi4Na!OLc#$?Qf9
St!zw23``6TKuG{bq87XqKQC(l
--- a/mobile/android/base/tests/robocop.ini
+++ b/mobile/android/base/tests/robocop.ini
@@ -1,14 +1,16 @@
 # [test_bug720538] # disabled on fig - bug 897072
 [testAboutPage]
 [testAddonManager]
 # disabled on x86 only; bug 936216
 skip-if = processor == "x86"
 [testAddSearchEngine]
+skip-if = processor == "x86"
+[testAdobeFlash]
 [testAwesomebar]
 [testAxisLocking]
 # disabled on x86 only; bug 927476
 skip-if = processor == "x86"
 # [testBookmark] # see bug 915350
 [testBookmarksPanel]
 [testBookmarkFolders]
 # [testBookmarklets] # see bug 915350
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/tests/robocop_adobe_flash.html
@@ -0,0 +1,17 @@
+<html style="margin: 0; padding: 0">
+<head>
+ <title>Adobe Flash Test</title>
+ <meta name="viewport" content="width=device-width,initial-scale=1.0"/>
+ <meta charset="utf-8">
+</head>
+<body style="margin: 0; padding: 0">
+	<object width="100" height="100"
+	classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
+	codebase="http://fpdownload.macromedia.com/
+	pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0">
+		<param name="SRC" value="green.swf">
+		<embed src="green.swf" width="100" height="100">
+		</embed>
+	</object>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/tests/testAdobeFlash.java
@@ -0,0 +1,64 @@
+package org.mozilla.gecko.tests;
+
+import android.os.Build;
+
+import org.json.JSONArray;
+import org.json.JSONObject;
+
+import org.mozilla.gecko.*;
+
+/**
+ * Tests that Flash is working
+ * - loads a page containing a Flash plugin
+ * - verifies it rendered properly
+ */
+public class testAdobeFlash extends PixelTest {
+    @Override
+    protected int getTestType() {
+        return TEST_MOCHITEST;
+    }
+
+    public void testLoad() {
+        // This test only works on ICS and higher
+        if (Build.VERSION.SDK_INT < 15)
+            return;
+
+        // Enable plugins
+        JSONObject jsonPref = new JSONObject();
+        try {
+            jsonPref.put("name", "plugin.enable");
+            jsonPref.put("type", "string");
+            jsonPref.put("value", "1");
+            mActions.sendGeckoEvent("Preferences:Set", jsonPref.toString());
+
+            // Wait for confirmation of the pref change before proceeding with the test.
+            final String[] prefNames = { "plugin.default.state" };
+            final int ourRequestId = 0x7358;
+            Actions.RepeatedEventExpecter eventExpecter = mActions.expectGeckoEvent("Preferences:Data");
+            mActions.sendPreferencesGetEvent(ourRequestId, prefNames);
+
+            JSONObject data = null;
+            int requestId = -1;
+
+            // Wait until we get the correct "Preferences:Data" event
+            while (requestId != ourRequestId) {
+                data = new JSONObject(eventExpecter.blockForEventData());
+                requestId = data.getInt("requestId");
+            }
+            eventExpecter.unregisterListener();
+        } catch (Exception ex) {
+            mAsserter.ok(false, "exception in testAdobeFlash", ex.toString());
+        }
+
+        blockForGeckoReady();
+
+        String url = getAbsoluteUrl(StringHelper.ROBOCOP_ADOBE_FLASH_URL);
+        PaintedSurface painted = loadAndGetPainted(url);
+
+        mAsserter.ispixel(painted.getPixelAt(0, 0), 0, 0xff, 0, "Pixel at 0, 0");
+        mAsserter.ispixel(painted.getPixelAt(50, 50), 0, 0xff, 0, "Pixel at 50, 50");
+        mAsserter.ispixel(painted.getPixelAt(101, 0), 0xff, 0xff, 0xff, "Pixel at 101, 0");
+        mAsserter.ispixel(painted.getPixelAt(0, 101), 0xff, 0xff, 0xff, "Pixel at 0, 101");
+
+    }
+}