Unreviewed, fix test failures after r242992.
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 May 2019 06:27:07 +0000 (06:27 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 May 2019 06:27:07 +0000 (06:27 +0000)
<rdar://problem/50383600>

* inspector/console/console-screenshot.html:
* inspector/console/console-screenshot-expected.txt:
Don't print the dataURL in the expectation file.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244868 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/inspector/console/console-screenshot-expected.txt
LayoutTests/inspector/console/console-screenshot.html

index 9e711b6..d10e657 100644 (file)
@@ -1,3 +1,12 @@
+2019-05-01  Devin Rousso  <drousso@apple.com>
+
+        Unreviewed, fix test failures after r242992.
+        <rdar://problem/50383600>
+
+        * inspector/console/console-screenshot.html:
+        * inspector/console/console-screenshot-expected.txt:
+        Don't print the dataURL in the expectation file.
+
 2019-05-01  Jiewen Tan  <jiewen_tan@apple.com>
 
         [WebAuthN] Adopt SecurityOrigin::isMatchingRegistrableDomainSuffix()
index ac66198..0e9e380 100644 (file)
@@ -7,17 +7,18 @@ Tests for the console.screenshot API.
 == Running test suite: console.screenshot
 -- Running test case: console.screenshot.SingleNode
 PASS: The added message should be an image.
-PASS: The image should be a 2x2 red square.
+PASS: The image should not be empty.
 
 -- Running test case: console.screenshot.MultipleNodes
 PASS: The added message should be an image.
-PASS: The image should be a 2x2 blue square.
+PASS: The image should not be empty.
 
 -- Running test case: console.screenshot.DetachedNode
 PASS: Could not capture screenshot
 
 -- Running test case: console.screenshot.NoArguments
 PASS: The added message should be an image.
+PASS: The image should not be empty.
 PASS: The image width should be greater than 2px.
 PASS: The image height should be greater than 2px.
 
index 867694a..c3e9ef3 100644 (file)
@@ -15,15 +15,6 @@ function test()
 {
     InspectorTest.debug();
 
-    // 2x2 red square
-    const redSquareDataURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAAXNSR0IArs4c6QAAABNJREFUCB1j/M/AAEQMDEwgAgQAHxcCAmtAm/sAAAAASUVORK5CYII=";
-
-    // 2x2 blue square
-    const blueSquareDataURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAAXNSR0IArs4c6QAAABRJREFUCB1jZGD4/58BCJhABAgAAB0ZAgJSPDJ6AAAAAElFTkSuQmCC";
-
-    // 2x2 green square
-    const greenSquareDataURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAAXNSR0IArs4c6QAAABNJREFUCB1jZGhg+M8ABEwgAgQAFigBgxp1H6oAAAAASUVORK5CYII=";
-
     let suite = InspectorTest.createAsyncSuite("console.screenshot");
 
     function addTest({name, expression, imageMessageAddedCallback, shouldError}) {
@@ -59,16 +50,24 @@ function test()
     addTest({
         name: "console.screenshot.SingleNode",
         expression: `console.screenshot(document.querySelector("#test1"))`,
-        imageMessageAddedCallback(message) {
-            InspectorTest.expectEqual(message.messageText, redSquareDataURL, "The image should be a 2x2 red square.");
+        async imageMessageAddedCallback(message) {
+            InspectorTest.expectNotEqual(message.messageText, "data:", "The image should not be empty.");
+
+            let img = await WI.ImageUtilities.promisifyLoad(message.messageText);
+            InspectorTest.assert(img.width === 2, "The image width should be 2px.");
+            InspectorTest.assert(img.height === 2, "The image height should be 2px.");
         },
     });
 
     addTest({
         name: "console.screenshot.MultipleNodes", 
         expression: `console.screenshot(document.querySelector("#test2"), document.querySelector("#test1"))`,
-        imageMessageAddedCallback(message) {
-            InspectorTest.expectEqual(message.messageText, blueSquareDataURL, "The image should be a 2x2 blue square.");
+        async imageMessageAddedCallback(message) {
+            InspectorTest.expectNotEqual(message.messageText, "data:", "The image should not be empty.");
+
+            let img = await WI.ImageUtilities.promisifyLoad(message.messageText);
+            InspectorTest.assert(img.width === 2, "The image width should be 2px.");
+            InspectorTest.assert(img.height === 2, "The image height should be 2px.");
         },
     });
 
@@ -82,9 +81,7 @@ function test()
         name: "console.screenshot.NoArguments", 
         expression: `console.screenshot()`,
         async imageMessageAddedCallback(message) {
-            InspectorTest.assert(message.messageText !== redSquareDataURL, "The imag should not be a 2x2 red square.");
-            InspectorTest.assert(message.messageText !== blueSquareDataURL, "The imag should not be a 2x2 blue square.");
-            InspectorTest.assert(message.messageText !== greenSquareDataURL, "The imag should not be a 2x2 green square.");
+            InspectorTest.expectNotEqual(message.messageText, "data:", "The image should not be empty.");
 
             let img = await WI.ImageUtilities.promisifyLoad(message.messageText);
             InspectorTest.expectGreaterThan(img.width, 2, "The image width should be greater than 2px.");