Changeset 208004 in webkit


Ignore:
Timestamp:
Oct 27, 2016 2:14:50 PM (7 years ago)
Author:
Chris Dumez
Message:

Sync up all copies of testharnessreport.js
https://bugs.webkit.org/show_bug.cgi?id=164071

Reviewed by Youenn Fablet.

Sync up all copies of testharnessreport.js for consistency.

  • http/tests/media/media-source/mediasource-play-then-seek-back-with-remote-control-expected.txt:
  • http/tests/security/cross-origin-css-in-quirks-1-expected.txt:
  • http/tests/security/cross-origin-css-in-quirks-2-expected.txt:
  • http/tests/security/cross-origin-css-in-quirks-3-expected.txt:
  • http/tests/security/cross-origin-css-in-quirks-4-expected.txt:
  • http/tests/security/same-origin-css-1-expected.txt:
  • http/tests/security/same-origin-css-2-expected.txt:
  • http/tests/security/same-origin-css-3-expected.txt:
  • http/tests/security/same-origin-css-in-quirks-expected.txt:
  • http/tests/w3c/resources/testharnessreport.js:

(convertResult):
(self.testRunner.add_completion_callback.):
(self.testRunner.add_completion_callback):
(add_completion_callback.sanitize): Deleted.
(add_completion_callback): Deleted.

  • imported/blink/http/tests/resources/testharnessreport.js:

(convertResult):
(self.testRunner.add_completion_callback.):
(self.testRunner.add_completion_callback):
(isCSSWGTest): Deleted.
(isJSTest): Deleted.
(add_completion_callback.sanitize): Deleted.
(add_completion_callback.done): Deleted.
(add_completion_callback): Deleted.

  • resources/testharnessreport.js:

(self.testRunner.add_completion_callback.):
(self.testRunner.add_completion_callback):

Location:
trunk/LayoutTests
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r208003 r208004  
     12016-10-27  Chris Dumez  <cdumez@apple.com>
     2
     3        Sync up all copies of testharnessreport.js
     4        https://bugs.webkit.org/show_bug.cgi?id=164071
     5
     6        Reviewed by Youenn Fablet.
     7
     8        Sync up all copies of testharnessreport.js for consistency.
     9
     10        * http/tests/media/media-source/mediasource-play-then-seek-back-with-remote-control-expected.txt:
     11        * http/tests/security/cross-origin-css-in-quirks-1-expected.txt:
     12        * http/tests/security/cross-origin-css-in-quirks-2-expected.txt:
     13        * http/tests/security/cross-origin-css-in-quirks-3-expected.txt:
     14        * http/tests/security/cross-origin-css-in-quirks-4-expected.txt:
     15        * http/tests/security/same-origin-css-1-expected.txt:
     16        * http/tests/security/same-origin-css-2-expected.txt:
     17        * http/tests/security/same-origin-css-3-expected.txt:
     18        * http/tests/security/same-origin-css-in-quirks-expected.txt:
     19        * http/tests/w3c/resources/testharnessreport.js:
     20        (convertResult):
     21        (self.testRunner.add_completion_callback.):
     22        (self.testRunner.add_completion_callback):
     23        (add_completion_callback.sanitize): Deleted.
     24        (add_completion_callback): Deleted.
     25        * imported/blink/http/tests/resources/testharnessreport.js:
     26        (convertResult):
     27        (self.testRunner.add_completion_callback.):
     28        (self.testRunner.add_completion_callback):
     29        (isCSSWGTest): Deleted.
     30        (isJSTest): Deleted.
     31        (add_completion_callback.sanitize): Deleted.
     32        (add_completion_callback.done): Deleted.
     33        (add_completion_callback): Deleted.
     34        * resources/testharnessreport.js:
     35        (self.testRunner.add_completion_callback.):
     36        (self.testRunner.add_completion_callback):
     37
    1382016-10-25  Brent Fulgham  <bfulgham@apple.com>
    239
  • trunk/LayoutTests/http/tests/media/media-source/mediasource-play-then-seek-back-with-remote-control-expected.txt

    r203924 r208004  
    1  
     1
    22PASS Test playing then seeking back with remote control command.(PASS if no crash)
    33
  • trunk/LayoutTests/http/tests/security/cross-origin-css-1-expected.txt

    r187489 r208004  
    22
    33PASS Testing cross-origin and MIME behavior for CSS.
    4 PASS xorigincss1.html should not be loaded via <link>.
     4PASS xorigincss1.html should not be loaded via &lt;link&gt;.
    55
  • trunk/LayoutTests/http/tests/security/cross-origin-css-2-expected.txt

    r187489 r208004  
    22
    33PASS Testing cross-origin and MIME behavior for CSS.
    4 PASS xorigincss2.html should not be loaded either via <link> or @import.
     4PASS xorigincss2.html should not be loaded either via &lt;link&gt; or @import.
    55
  • trunk/LayoutTests/http/tests/security/cross-origin-css-3-expected.txt

    r182877 r208004  
    11
    22PASS Testing cross-origin and MIME behavior for CSS.
    3 PASS xorigincss1.css should be loaded via <link>
     3PASS xorigincss1.css should be loaded via &lt;link&gt;
    44
  • trunk/LayoutTests/http/tests/security/cross-origin-css-in-quirks-1-expected.txt

    r187489 r208004  
    22
    33PASS Testing cross-origin and MIME behavior for CSS.
    4 PASS xorigincss1.html should not be loaded via <link>.
     4PASS xorigincss1.html should not be loaded via &lt;link&gt;.
    55
  • trunk/LayoutTests/http/tests/security/cross-origin-css-in-quirks-2-expected.txt

    r187489 r208004  
    22
    33PASS Testing cross-origin and MIME behavior for CSS.
    4 PASS xorigincss2.html should not be loaded either via <link> or @import.
     4PASS xorigincss2.html should not be loaded either via &lt;link&gt; or @import.
    55
  • trunk/LayoutTests/http/tests/security/cross-origin-css-in-quirks-3-expected.txt

    r187489 r208004  
    11
    22PASS Testing cross-origin and MIME behavior for CSS.
    3 PASS xorigincss1.css should be loaded via <link>
     3PASS xorigincss1.css should be loaded via &lt;link&gt;
    44
  • trunk/LayoutTests/http/tests/security/cross-origin-css-in-quirks-4-expected.txt

    r187489 r208004  
    11
    22PASS Testing cross-origin and MIME behavior for CSS.
    3 PASS xorigincss3.html should be loaded via <link>
     3PASS xorigincss3.html should be loaded via &lt;link&gt;
    44
  • trunk/LayoutTests/http/tests/security/same-origin-css-1-expected.txt

    r187489 r208004  
    22
    33PASS Testing same-origin and MIME behavior for CSS.
    4 PASS xorigincss1.html should not be loaded via <link>.
     4PASS xorigincss1.html should not be loaded via &lt;link&gt;.
    55
  • trunk/LayoutTests/http/tests/security/same-origin-css-2-expected.txt

    r187489 r208004  
    22
    33PASS Testing same-origin and MIME behavior for CSS.
    4 PASS xorigincss2.html should not be loaded either via <link> or @import.
     4PASS xorigincss2.html should not be loaded either via &lt;link&gt; or @import.
    55
  • trunk/LayoutTests/http/tests/security/same-origin-css-3-expected.txt

    r187489 r208004  
    11
    22PASS Testing same-origin and MIME behavior for CSS.
    3 PASS xorigincss1.css should be loaded via <link>
     3PASS xorigincss1.css should be loaded via &lt;link&gt;
    44
  • trunk/LayoutTests/http/tests/security/same-origin-css-in-quirks-expected.txt

    r187489 r208004  
    22
    33PASS Testing same-origin and MIME behavior for CSS.
    4 PASS xorigincss1.html should be loaded via <link>.
    5 PASS xorigincss2.html should be loaded either via <link> or @import.
    6 PASS xorigincss1.css should be loaded via <link>
     4PASS xorigincss1.html should be loaded via &lt;link&gt;.
     5PASS xorigincss2.html should be loaded either via &lt;link&gt; or @import.
     6PASS xorigincss1.css should be loaded via &lt;link&gt;
    77PASS xorigincss3.html should be loaded
    88PASS xorigincss4.html should be loaded via @import.
  • trunk/LayoutTests/http/tests/w3c/resources/testharnessreport.js

    r207995 r208004  
    33 * code needed to integrate testharness.js tests with their own test systems.
    44 *
    5  * Typically test system integration will attach callbacks when each test has
    6  * run, using add_result_callback(callback(test)), or when the whole test file
    7  * has completed, using
    8  * add_completion_callback(callback(tests, harness_status)).
     5 * Typically such integration will attach callbacks when each test is
     6 * has run, using add_result_callback(callback(test)), or when the whole test file has
     7 * completed, using add_completion_callback(callback(tests, harness_status)).
    98 *
    109 * For more documentation about the callback functions and the
     
    1615    testRunner.dumpAsText();
    1716    testRunner.waitUntilDone();
     17    testRunner.setCanOpenWindows();
     18    // Let's restrict calling testharness timeout() to wptserve tests for the moment.
     19    // That will limit the impact to a small number of tests.
     20    // The risk is that testharness timeout() might be called to late on slow bots to finish properly.
     21    if (testRunner.timeout && location.port == 8800)
     22        setTimeout(timeout, testRunner.timeout * 0.9);
    1823}
    1924
    2025// Function used to convert the test status code into
    2126// the corresponding string
    22 function convertResult(resultStatus){
    23         if(resultStatus == 0)
    24                 return("PASS");
    25         else if(resultStatus == 1)
    26                 return("FAIL");
    27         else if(resultStatus == 2)
    28                 return("TIMEOUT");
    29         else
    30                 return("NOTRUN");
     27function convertResult(resultStatus)
     28{
     29    if(resultStatus == 0)
     30        return("PASS");
     31    else if(resultStatus == 1)
     32        return("FAIL");
     33    else if(resultStatus == 2)
     34        return("TIMEOUT");
     35    else
     36        return("NOTRUN");
    3137}
    3238
    33 /* Disable the default output of testharness.js.  The default output formats
    34 *  test results into an HTML table.  When that table is dumped as text, no
    35 *  spacing between cells is preserved, and it is therefore not readable. By
    36 *  setting output to false, the HTML table will not be created
    37 */
    38 setup({"output":false});
     39if (self.testRunner) {
     40    /* Disable the default output of testharness.js.  The default output formats
     41    *  test results into an HTML table.  When that table is dumped as text, no
     42    *  spacing between cells is preserved, and it is therefore not readable. By
     43    *  setting output to false, the HTML table will not be created
     44    */
     45    setup({"output": false, "explicit_timeout": true});
    3946
    40 /*  Using a callback function, test results will be added to the page in a
    41 *   manner that allows dumpAsText to produce readable test results
    42 */
    43 add_completion_callback(function (tests, harness_status){
    44        
    45         // Create element to hold results
    46         var results = document.createElement("pre");
    47        
    48         // Declare result string
    49         var resultStr = "\n";
     47    /*  Using a callback function, test results will be added to the page in a
     48    *   manner that allows dumpAsText to produce readable test results
     49    */
     50    add_completion_callback(function (tests, harness_status) {
     51        // Wait for any other completion callbacks
     52        setTimeout(function() {
     53            var results = document.createElement("pre");
     54            var resultStr = "\n";
    5055
    51         // Sanitizes the given text for display in test results.
    52         function sanitize(text) {
    53             if (!text) {
    54                 return "";
     56            // Sanitizes the given text for display in test results.
     57            function sanitize(text) {
     58                if (!text) {
     59                    return "";
     60                }
     61                text = text.replace(/\0/g, "\\0");
     62                return text.replace(/\r/g, "\\r");
    5563            }
    56             // Escape null characters, otherwise diff will think the file is binary.
    57             text = text.replace(/\0/g, "\\0");
    58             // Escape carriage returns as they break rietveld's difftools.
    59             return text.replace(/\r/g, "\\r");
    60         }
    6164
    62        
    63         // Check harness_status.  If it is not 0, tests did not
    64         // execute correctly, output the error code and message
    65         if(harness_status.status != 0){
    66                 resultStr += "Harness Error. harness_status.status = " +
    67                                          harness_status.status +
    68                                          " , harness_status.message = " +
    69                                          harness_status.message;
    70         }
    71         else {
    72                 // Iterate through tests array and build string that contains
    73                 // results for all tests
    74                 for(var i=0; i<tests.length; i++){                               
    75                         resultStr += convertResult(tests[i].status) + " " +
    76                                         sanitize(tests[i].name) + " " +
    77                                         sanitize(tests[i].message) + "\n";
    78                 }                       
    79         }
     65            if(harness_status.status != 0)
     66                resultStr += "Harness Error (" + convertResult(harness_status.status) + "), message = " + harness_status.message + "\n\n";
    8067
    81         // Set results element's innerHTML to the results string
    82         results.innerHTML = resultStr;
     68            for (var i = 0; i < tests.length; i++) {
     69                var message = sanitize(tests[i].message);
     70                if (tests[i].status == 1 && !tests[i].dumpStack) {
     71                    // Remove stack for failed tests for proper string comparison without file paths.
     72                    // For a test to dump the stack set its dumpStack attribute to true.
     73                    var stackIndex = message.indexOf("(stack:");
     74                    if (stackIndex > 0)
     75                        message = message.substr(0, stackIndex);
     76                }
     77                resultStr += convertResult(tests[i].status) + " " + sanitize(tests[i].name) + " " + message + "\n";
     78            }
    8379
    84         // Add results element to document
    85         document.body.appendChild(results);
     80            results.innerText = resultStr;
     81            var log = document.getElementById("log");
     82            if (log)
     83                log.appendChild(results);
     84            else
     85                document.body.appendChild(results);
    8686
    87         if (self.testRunner)
    88                 testRunner.notifyDone();
    89 });
     87            testRunner.notifyDone();
     88        }, 0);
     89    });
    9090
    91 // vim: set expandtab shiftwidth=4 tabstop=4:
     91    if (window.internals)
     92        window.internals.setResourceTimingSupport(true);
     93}
  • trunk/LayoutTests/imported/blink/http/tests/resources/testharnessreport.js

    r190629 r208004  
    11/*
    2  * THIS FILE INTENTIONALLY LEFT BLANK
    3  *
    4  * More specifically, this file is intended for vendors to implement
     2 * This file is intended for vendors to implement
    53 * code needed to integrate testharness.js tests with their own test systems.
    64 *
     
    1816    testRunner.waitUntilDone();
    1917    testRunner.setCanOpenWindows();
    20     testRunner.setCloseRemainingWindowsWhenComplete(true);
     18    // Let's restrict calling testharness timeout() to wptserve tests for the moment.
     19    // That will limit the impact to a small number of tests.
     20    // The risk is that testharness timeout() might be called to late on slow bots to finish properly.
     21    if (testRunner.timeout && location.port == 8800)
     22        setTimeout(timeout, testRunner.timeout * 0.9);
    2123}
    2224
    2325// Function used to convert the test status code into
    2426// the corresponding string
    25 function convertResult(resultStatus) {
     27function convertResult(resultStatus)
     28{
    2629    if(resultStatus == 0)
    2730        return("PASS");
     
    3437}
    3538
    36 /* Disable the default output of testharness.js.  The default output formats
    37 *  test results into an HTML table.  When that table is dumped as text, no
    38 *  spacing between cells is preserved, and it is therefore not readable. By
    39 *  setting output to false, the HTML table will not be created
    40 */
    41 setup({"output":false});
     39if (self.testRunner) {
     40    /* Disable the default output of testharness.js.  The default output formats
     41    *  test results into an HTML table.  When that table is dumped as text, no
     42    *  spacing between cells is preserved, and it is therefore not readable. By
     43    *  setting output to false, the HTML table will not be created
     44    */
     45    setup({"output": false, "explicit_timeout": true});
    4246
    43 /* If the test has a meta tag named flags and the content contains "dom", then it's a CSSWG test.
    44  */
    45 function isCSSWGTest() {
    46     var flags = document.querySelector('meta[name=flags]'),
    47         content = flags ? flags.getAttribute('content') : null;
     47    /*  Using a callback function, test results will be added to the page in a
     48    *   manner that allows dumpAsText to produce readable test results
     49    */
     50    add_completion_callback(function (tests, harness_status) {
     51        // Wait for any other completion callbacks
     52        setTimeout(function() {
     53            var results = document.createElement("pre");
     54            var resultStr = "\n";
    4855
    49     return content && content.match(/\bdom\b/);
     56            // Sanitizes the given text for display in test results.
     57            function sanitize(text) {
     58                if (!text) {
     59                    return "";
     60                }
     61                text = text.replace(/\0/g, "\\0");
     62                return text.replace(/\r/g, "\\r");
     63            }
     64
     65            if(harness_status.status != 0)
     66                resultStr += "Harness Error (" + convertResult(harness_status.status) + "), message = " + harness_status.message + "\n\n";
     67
     68            for (var i = 0; i < tests.length; i++) {
     69                var message = sanitize(tests[i].message);
     70                if (tests[i].status == 1 && !tests[i].dumpStack) {
     71                    // Remove stack for failed tests for proper string comparison without file paths.
     72                    // For a test to dump the stack set its dumpStack attribute to true.
     73                    var stackIndex = message.indexOf("(stack:");
     74                    if (stackIndex > 0)
     75                        message = message.substr(0, stackIndex);
     76                }
     77                resultStr += convertResult(tests[i].status) + " " + sanitize(tests[i].name) + " " + message + "\n";
     78            }
     79
     80            results.innerText = resultStr;
     81            var log = document.getElementById("log");
     82            if (log)
     83                log.appendChild(results);
     84            else
     85                document.body.appendChild(results);
     86
     87            testRunner.notifyDone();
     88        }, 0);
     89    });
     90
     91    if (window.internals)
     92        window.internals.setResourceTimingSupport(true);
    5093}
    51 
    52 function isJSTest() {
    53     return !!document.querySelector('script[src*="/resources/testharness"]');
    54 }
    55 
    56 /*  Using a callback function, test results will be added to the page in a
    57 *   manner that allows dumpAsText to produce readable test results
    58 */
    59 add_completion_callback(function (tests, harness_status) {
    60 
    61     // Create element to hold results
    62     var results = document.createElement("pre");
    63 
    64     // Declare result string
    65     var resultStr = "This is a testharness.js-based test.\n";
    66 
    67     // Sanitizes the given text for display in test results.
    68     function sanitize(text) {
    69         if (!text) {
    70             return "";
    71         }
    72         // Escape null characters, otherwise diff will think the file is binary.
    73         text = text.replace(/\0/g, "\\0");
    74         // Escape carriage returns as they break rietveld's difftools.
    75         return text.replace(/\r/g, "\\r");
    76     }
    77 
    78     // Check harness_status.  If it is not 0, tests did not
    79     // execute correctly, output the error code and message
    80     if (harness_status.status != 0) {
    81         resultStr += "Harness Error. harness_status.status = " +
    82                      harness_status.status +
    83                      " , harness_status.message = " +
    84                      harness_status.message +
    85                      "\n";
    86     } else {
    87         // Iterate through tests array and build string that contains
    88         // results for all tests
    89         for (var i = 0; i < tests.length; i++) {
    90             resultStr += convertResult(tests[i].status) + " " +
    91                          sanitize(tests[i].name) + " " +
    92                          sanitize(tests[i].message) + "\n";
    93         }
    94     }
    95     resultStr += "Harness: the test ran to completion.\n";
    96 
    97     // Set results element's textContent to the results string
    98     results.textContent = resultStr;
    99 
    100     function done() {
    101         if (self.testRunner) {
    102             var logDiv = document.getElementById('log');
    103             if ((isCSSWGTest() || isJSTest()) && logDiv) {
    104                 // Assume it's a CSSWG style test, and anything other than the log div isn't
    105                 // material to the testrunner output, so should be hidden from the text dump
    106                 var next = null;
    107                 for (var child = document.body.firstChild; child; child = next) {
    108                     next = child.nextSibling;
    109                     if (child.nodeType == Node.ELEMENT_NODE)
    110                         child.style.visibility = "hidden";
    111                     else if (child.nodeType == Node.TEXT_NODE)
    112                         document.body.removeChild(child);
    113                 }
    114             }
    115         }
    116 
    117         // Add results element to document.
    118         if (!document.body)
    119             document.documentElement.appendChild(document.createElement("body"));
    120         document.body.appendChild(results);
    121 
    122         if (self.testRunner)
    123             testRunner.notifyDone();
    124     }
    125 
    126     if (document.readyState === 'loading') {
    127         window.addEventListener('load', done);
    128     } else {
    129         setTimeout(done, 0);
    130     }
    131 });
  • trunk/LayoutTests/resources/testharnessreport.js

    r207995 r208004  
    11/*
    2  * THIS FILE INTENTIONALLY LEFT BLANK
    3  *
    4  * More specifically, this file is intended for vendors to implement
     2 * This file is intended for vendors to implement
    53 * code needed to integrate testharness.js tests with their own test systems.
    64 *
     
    6159                    return "";
    6260                }
    63                 // Escape null characters, otherwise diff will think the file is binary.
    6461                text = text.replace(/\0/g, "\\0");
    65                 // Escape carriage returns as they break rietveld's difftools.
    6662                return text.replace(/\r/g, "\\r");
    6763            }
Note: See TracChangeset for help on using the changeset viewer.