Bug 720144 - Add a simple pixel test to testLoad to ensure the page loaded and was visible. r=jmaher
authorKartikaya Gupta <kgupta@mozilla.com>
Mon, 30 Jan 2012 22:46:34 -0500
changeset 87024 43550ac61001c4a4857e88f4eb93c194273b6ba5
parent 87023 2934da670f6247a91c99c2b764131b68a2431434
child 87025 a3358c5fa80af764d9f961a5a82885d73abaa103
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs720144
milestone12.0a1
Bug 720144 - Add a simple pixel test to testLoad to ensure the page loaded and was visible. r=jmaher
build/mobile/robocop/Makefile.in
mobile/android/base/tests/robocop_boxes.html
mobile/android/base/tests/testLoad.java.in
--- a/build/mobile/robocop/Makefile.in
+++ b/build/mobile/robocop/Makefile.in
@@ -63,16 +63,17 @@ JAVAFILES = \
   $(NULL)
 
 _JAVA_TESTS = $(patsubst $(TESTPATH)/%.in,%,$(wildcard $(TESTPATH)/*.java.in))
 
 _TEST_FILES = \
   $(TESTPATH)/robocop_blank_01.html \
   $(TESTPATH)/robocop_blank_02.html \
   $(TESTPATH)/robocop_blank_03.html \
+  $(TESTPATH)/robocop_boxes.html \
   $(NULL)
 
 _ROBOCOP_TOOLS = \
   $(TESTPATH)/robocop.ini \
   parse_ids.py \
   $(NULL)
 
 GARBAGE += \
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/tests/robocop_boxes.html
@@ -0,0 +1,17 @@
+<html style="margin: 0; padding: 0">
+<title>Browser Box test</title>
+<body style="margin: 0; padding: 0">
+<script type="text/javascript">
+for (var y = 0; y < 2000; y += 100) {
+    document.write("<div style='width: 2000px; height: 100px; margin: 0; padding: 0; border: none'>\n");
+    for (var x = 0; x < 2000; x += 100) {
+        var r = (y + x) % 255;
+        var g = 255 - (y / 10);
+        var b = 255 - (x / 10);
+        document.write("<div style='float: left; width: 100px; height: 100px; margin: 0; padding: 0; border: none; background-color: rgb(" + r + "," + g + "," + b + ")'> </div>\n");
+    }
+    document.write("</div>\n");
+}
+</script>
+</body>
+</html>
--- a/mobile/android/base/tests/testLoad.java.in
+++ b/mobile/android/base/tests/testLoad.java.in
@@ -1,13 +1,23 @@
 #filter substitution
 package @ANDROID_PACKAGE_NAME@.tests;
 
 import @ANDROID_PACKAGE_NAME@.*;
 
 public class testLoad extends BaseTest {
-    private static final String URL = "http://mochi.test:8888/tests/robocop/robocop_blank_03.html";
+    private static final String URL = "http://mochi.test:8888/tests/robocop/robocop_boxes.html";
 
     public void testLoad() {
         loadUrl(URL);
+
+        mActions.expectPaint().blockForEvent();
+        getInstrumentation().waitForIdleSync();
+
+        int[][] painted = mDriver.getPaintedSurface();
+        mAsserter.ispixel(painted[0][0], 0, 255, 255, "Pixel at 0, 0");
+        mAsserter.ispixel(painted[0][100], 100, 255, 245, "Pixel at 100, 0");
+        mAsserter.ispixel(painted[100][0], 100, 245, 255, "Pixel at 0, 100");
+        mAsserter.ispixel(painted[100][100], 200, 245, 245, "Pixel at 100, 100");
+
         verifyUrl(URL);
     }
 }