LCOV - code coverage report
Current view: top level - test/wpt/xhr - send-sync-response-event-order.js (source / functions) Hit Total Coverage
Test: lcov.info Lines: 62 62 100.0 %
Date: 2024-12-07 00:20:21 Functions: 1 1 100.0 %
Branches: 2 2 100.0 %

           Branch data     Line data    Source code
       1            [ + ]:          2 : import assert from 'node:assert/strict';
       2                 :          2 : import { XMLHttpRequest } from '../../../lib/whatwg-xhr.js';
       3                 :          2 : 
       4                 :          2 : import { prepare_xhr_for_event_order_test } from './xmlhttprequest-event-order.js?q6';
       5                 :          2 : import { assert_xhr_event_order_matches } from './xmlhttprequest-event-order.js?q6';
       6                 :          2 : 
       7            [ + ]:          2 : export default (activeURL) => {
       8                 :          1 : 
       9                 :          1 :         let xhr = new XMLHttpRequest();
      10                 :          1 : 
      11                 :          1 :         prepare_xhr_for_event_order_test(xhr);
      12                 :          1 : 
      13                 :          1 :         xhr.open('POST', `${activeURL}/content.py`, false);
      14                 :          1 :         xhr.send('Test Message');
      15                 :          1 : 
      16                 :          1 :         assert.strictEqual(xhr.response, 'Test Message');
      17                 :          1 :         assert_xhr_event_order_matches([1, 4, 'load(12,12,true)', 'loadend(12,12,true)']);
      18                 :          1 : }
      19                 :          2 : 
      20                 :          2 : /*
      21                 :          2 :  * send-sync-response-event-order.htm
      22                 :          2 :  *
      23                 :          2 : 
      24                 :          2 : <!DOCTYPE html>
      25                 :          2 : <html>
      26                 :          2 : <head>
      27                 :          2 :     <script src="/resources/testharness.js"></script>
      28                 :          2 :     <script src="/resources/testharnessreport.js"></script>
      29                 :          2 :     <script src="resources/xmlhttprequest-event-order.js"></script>
      30                 :          2 :     <title>XMLHttpRequest: The send() method: event order when synchronous flag is set</title>
      31                 :          2 :     <link rel="help" href="https://xhr.spec.whatwg.org/#handler-xhr-onloadstart" data-tested-assertations="../.." />
      32                 :          2 :     <link rel="help" href="https://xhr.spec.whatwg.org/#handler-xhr-onloadend" data-tested-assertations="../.." />
      33                 :          2 :     <link rel="help" href="https://xhr.spec.whatwg.org/#event-xhr-loadstart" data-tested-assertations="../.." />
      34                 :          2 :     <link rel="help" href="https://xhr.spec.whatwg.org/#event-xhr-loadend" data-tested-assertations="../.." />
      35                 :          2 :     <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following-sibling::ol/li[9]" />
      36                 :          2 :     <link rel="help" href="https://xhr.spec.whatwg.org/#same-origin-request-steps" data-tested-assertations="following::DL[1]/DT[1]"/>
      37                 :          2 :     <link rel="help" href="https://xhr.spec.whatwg.org/#infrastructure-for-the-send()-method" data-tested-assertations="following::dt[11] following::a[contains(@href,'#switch-done')]/.." />
      38                 :          2 :     <link rel="help" href="https://xhr.spec.whatwg.org/#switch-done" data-tested-assertations="following::ol[1]/li[1] following::ol[1]/li[3] following::ol[1]/li[4] following::ol[1]/li[6] following::ol[1]/li[7]" />
      39                 :          2 :     <link rel="help" href="https://xhr.spec.whatwg.org/#the-response-attribute" data-tested-assertations="following::ol/li[3]" />
      40                 :          2 : </head>
      41                 :          2 : 
      42                 :          2 : <body>
      43                 :          2 :     <div id="log"></div>
      44                 :          2 : 
      45                 :          2 :     <script type="text/javascript">
      46                 :          2 :         test(function () {
      47                 :          2 :             var xhr = new XMLHttpRequest();
      48                 :          2 :             prepare_xhr_for_event_order_test(xhr);
      49                 :          2 : 
      50                 :          2 :             xhr.open("POST", "./resources/content.py", false);
      51                 :          2 :             xhr.send("Test Message");
      52                 :          2 : 
      53                 :          2 :             assert_equals(xhr.response, "Test Message");
      54                 :          2 :             assert_xhr_event_order_matches([1, 4, "load(12,12,true)", "loadend(12,12,true)"]);
      55                 :          2 :         });
      56                 :          2 :     </script>
      57                 :          2 : </body>
      58                 :          2 : </html>
      59                 :          2 : 
      60                 :          2 :  *
      61                 :          2 :  * send-sync-response-event-order.htm
      62                 :          2 :  */

Generated by: LCOV version 1.14