Bug 132230 - LayoutTests/editing/execCommand/12244.html passes, but is actually failing
Summary: LayoutTests/editing/execCommand/12244.html passes, but is actually failing
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-27 08:15 PDT by David Kilzer (:ddkilzer)
Modified: 2014-04-28 04:33 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Kilzer (:ddkilzer) 2014-04-27 08:15:38 PDT
LayoutTests/editing/execCommand/12244.html was added by Bug 12244 in r20071.

However, it calls setTimeout() without calling waitUntilDone()/notifyDone(), so it doesn't actually test window.find() because the test ends before the runTest() method is called.

Adding waitUntilDone()/notifyDone():

diff --git a/LayoutTests/editing/execCommand/12244.html b/LayoutTests/editing/execCommand/12244.html
index 73660c3..af4800e 100644
--- a/LayoutTests/editing/execCommand/12244.html
+++ b/LayoutTests/editing/execCommand/12244.html
@@ -1,3 +1,5 @@
+<html>
+<body>
 This is a test for window.find().
 <br><br>
 Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and ded
@@ -19,12 +21,18 @@ function assert(expected, actual, error)
 }
 
 function runTest() {
-    assert(window.find("now we are"), true, "'now we are' wasn't found");
-        assert(window.find(), true, "'now we are' wasn't found");
+    assert(window.find("now we are", false), true, "'now we are' wasn't found");
+    assert(window.find(), true, "'now we are' wasn't found");
+    if (window.testRunner) {
+        window.testRunner.notifyDone();
+    }
 }
 if (window.testRunner) {
     window.testRunner.dumpEditingCallbacks();
     window.testRunner.dumpAsText();
+    window.testRunner.waitUntilDone();
 }
 window.setTimeout(runTest, 100);
 </script>
+</body>
+</html>

Causes the test to fail:

--- /tmp/layout-test-results-X/editing/execCommand/12244-expected.txt
+++ /tmp/layout-test-results-X/editing/execCommand/12244-actual.txt
@@ -1,6 +1,7 @@
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 This is a test for window.find(). 
 
 Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal. 
 
 Now we are engaged in a great civil war, testing whether that nation, or any nation so conceived and so dedicated, can long endure. We are met on a great battle-field of that war. We have come to dedicate a portion of that field, as a final resting place for those who here gave their lives that that nation might live. It is altogether fitting and proper that we should do this.
-
+Error: 'now we are' wasn't found
Comment 1 Aryeh Gregor 2014-04-28 04:33:11 PDT
FWIW, at Mozilla we changed mochitests to fail if they run no asserts, and caught a number of cases like this where nothing was actually being tested due to a test bug:

https://bugzilla.mozilla.org/show_bug.cgi?id=735805