Bug 958836 - Add robocop test for Flash on Android r=mfinkle,mcomella

This commit is contained in:
James Willcox 2014-01-10 19:51:54 -06:00
parent a3ecf74986
commit 06786fb8cf
6 changed files with 85 additions and 0 deletions

View File

@ -63,6 +63,7 @@ MOCHITEST_ROBOCOP_FILES := \
$(wildcard $(TESTPATH)/test*.js) \
$(wildcard $(TESTPATH)/robocop*.js) \
$(wildcard $(TESTPATH)/*.xml) \
$(wildcard $(TESTPATH)/*.swf) \
$(NULL)
GARBAGE += \

View File

@ -75,6 +75,7 @@ public class StringHelper {
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";

Binary file not shown.

View File

@ -4,6 +4,8 @@
# disabled on x86 only; bug 936216
skip-if = processor == "x86"
[testAddSearchEngine]
skip-if = processor == "x86"
[testAdobeFlash]
[testAwesomebar]
[testAxisLocking]
# disabled on x86 only; bug 927476

View File

@ -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>

View File

@ -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");
}
}