LCOV - code coverage report
Current view: top level - test/wpt/xhr - send-response-event-order.js (source / functions) Hit Total Coverage
Test: lcov.info Lines: 83 83 100.0 %
Date: 2024-12-07 00:20:21 Functions: 3 3 100.0 %
Branches: 4 4 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?q2';
       5                 :          2 : import { assert_xhr_event_order_matches } from './xmlhttprequest-event-order.js?q2';
       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.addEventListener('loadend', () => {
      14                 :          1 :                         assert_xhr_event_order_matches([
      15                 :          1 :                                 1,
      16                 :          1 :                                 `loadstart(0,0,false)`,
      17                 :          1 :                                 `upload.loadstart(0,12,true)`,
      18                 :          1 :                                 `upload.progress(12,12,true)`,
      19                 :          1 :                                 `upload.load(12,12,true)`,
      20                 :          1 :                                 `upload.loadend(12,12,true)`,
      21                 :          1 :                                 2,
      22                 :          1 :                                 3,
      23                 :          1 :                                 `progress(12,12,true)`,
      24                 :          1 :                                 4,
      25                 :          1 :                                 `load(12,12,true)`,
      26                 :          1 :                                 `loadend(12,12,true)`
      27                 :          1 :                         ]);
      28                 :          1 :         });
      29                 :          1 : 
      30            [ + ]:          1 :         xhr.upload.onloadend = () => {};
      31                 :          1 : 
      32                 :          1 :         xhr.open('POST', `${activeURL}/content.py`);
      33                 :          1 :         xhr.send('Test Message');
      34                 :          1 : }
      35                 :          2 : 
      36                 :          2 : /*
      37                 :          2 :  * send-response-event-order.htm
      38                 :          2 :  *
      39                 :          2 : 
      40                 :          2 : <!DOCTYPE html>
      41                 :          2 : <html>
      42                 :          2 : <head>
      43                 :          2 :     <link rel='help' href='https://xhr.spec.whatwg.org/#handler-xhr-onloadstart' data-tested-assertations='../..' />
      44                 :          2 :     <link rel='help' href='https://xhr.spec.whatwg.org/#handler-xhr-onloadend' data-tested-assertations='../..' />
      45                 :          2 :     <link rel='help' href='https://xhr.spec.whatwg.org/#event-xhr-loadstart' data-tested-assertations='../..' />
      46                 :          2 :     <link rel='help' href='https://xhr.spec.whatwg.org/#event-xhr-loadend' data-tested-assertations='../..' />
      47                 :          2 :     <link rel='help' href='https://xhr.spec.whatwg.org/#the-send()-method' data-tested-assertations='following-sibling::ol/li[9]/ol/li[2] following-sibling::ol/li[9]/ol/li[3] following::a[contains(@href,'#make-upload-progress-notifications')]/.. following::a[contains(@href,'#make-progress-notifications')]/..' />
      48                 :          2 :     <link rel='help' href='https://xhr.spec.whatwg.org/#make-upload-progress-notifications' data-tested-assertations='following::ul[1]/li[1] following::ul[1]/li[2]/ol[1]/li[2] following::ul[1]/li[2]/ol[1]/li[3] following::ul[1]/li[2]/ol[1]/li[4]' />
      49                 :          2 :     <link rel='help' href='https://xhr.spec.whatwg.org/#make-progress-notifications' data-tested-assertations='..' />
      50                 :          2 :     <link rel='help' href='https://xhr.spec.whatwg.org/#infrastructure-for-the-send()-method' data-tested-assertations='following::a[contains(@href,'#switch-done')]/..' />
      51                 :          2 :     <link rel='help' href='https://xhr.spec.whatwg.org/#switch-done' data-tested-assertations='following::ol[1]/li[3] following::ol[1]/li[4] following::ol[1]/li[5] following::ol[1]/li[6] following::ol[1]/li[7]' />
      52                 :          2 :     <script src='/resources/testharness.js'></script>
      53                 :          2 :     <script src='/resources/testharnessreport.js'></script>
      54                 :          2 :     <script src='resources/xmlhttprequest-event-order.js'></script>
      55                 :          2 :     <title>XMLHttpRequest: The send() method: event order when synchronous flag is unset</title>
      56                 :          2 : </head>
      57                 :          2 : 
      58                 :          2 : <body>
      59                 :          2 :     <div id='log'></div>
      60                 :          2 : 
      61                 :          2 :     <script type='text/javascript'>
      62                 :          2 :         var test = async_test();
      63                 :          2 : 
      64                 :          2 :         test.step(function()
      65                 :          2 :         {
      66                 :          2 :             var xhr = new XMLHttpRequest();
      67                 :          2 :             prepare_xhr_for_event_order_test(xhr);
      68                 :          2 : 
      69                 :          2 :             xhr.addEventListener('loadend', test.step_func(function() {
      70                 :          2 :                 assert_xhr_event_order_matches([1, 'loadstart(0,0,false)', 'upload.loadstart(0,12,true)', 'upload.progress(12,12,true)', 'upload.load(12,12,true)', 'upload.loadend(12,12,true)', 2, 3, 'progress(12,12,true)', 4, 'load(12,12,true)', 'loadend(12,12,true)']);
      71                 :          2 :                 test.done();
      72                 :          2 :             }));
      73                 :          2 : 
      74                 :          2 :             xhr.open('POST', './resources/content.py', true);
      75                 :          2 :             xhr.send('Test Message');
      76                 :          2 :         });
      77                 :          2 :     </script>
      78                 :          2 : </body>
      79                 :          2 : </html>
      80                 :          2 : 
      81                 :          2 :  *
      82                 :          2 :  * send-response-event-order.htm
      83                 :          2 :  */

Generated by: LCOV version 1.14