LCOV - code coverage report
Current view: top level - test - wpt-xhr.test.js (source / functions) Hit Total Coverage
Test: lcov.info Lines: 1329 1378 96.4 %
Date: 2025-01-24 02:02:48 Functions: 6 11 54.5 %
Branches: 9 13 69.2 %

           Branch data     Line data    Source code
       1            [ + ]:          1 : /**
       2                 :          1 :  * @module  wpt-xhr
       3                 :          1 :  * @desc    The wpt-xhr test module.
       4                 :          1 :  * @version 1.0.0
       5                 :          1 :  * @author  Essam A. El-Sherif
       6                 :          1 :  */
       7                 :          1 : 
       8                 :          1 : /** Import test scripts */
       9                 :          1 : import abort_event_order                                                from './wpt/xhr/abort-event-order.js';
      10                 :          1 : import data_uri                                                         from './wpt/xhr/data-uri.js';
      11                 :          1 : import event_abort_any                                                  from './wpt/xhr/event-abort.any.js';
      12                 :          1 : import event_error_order_sub                                            from './wpt/xhr/event-error-order.sub.js';
      13                 :          1 : import event_error_sub_any                                              from './wpt/xhr/event-error.sub.any.js';
      14                 :          1 : import event_load_any                                                   from './wpt/xhr/event-load.any.js';
      15                 :          1 : import event_loadend_any                                                from './wpt/xhr/event-loadend.any.js';
      16                 :          1 : import event_loadstart_any                                              from './wpt/xhr/event-loadstart.any.js';
      17                 :          1 : import event_loadstart_upload_any                                       from './wpt/xhr/event-loadstart-upload.any.js';
      18                 :          1 : import event_progress_any                                               from './wpt/xhr/event-progress.any.js';
      19                 :          1 : import event_readystatechange_loaded_any                                from './wpt/xhr/event-readystatechange-loaded.any.js';
      20                 :          1 : import event_readystate_sync_open_any                                   from './wpt/xhr/event-readystate-sync-open.any.js';
      21                 :          1 : import event_timeout_any                                                from './wpt/xhr/event-timeout.any.js';
      22                 :          1 : import event_timeout_order_any                                          from './wpt/xhr/event-timeout-order.any.js';
      23                 :          1 : import event_upload_progress_any                                        from './wpt/xhr/event-upload-progress.any.js';
      24                 :          1 : import formdata                                                         from './wpt/xhr/formdata.js';
      25                 :          1 : import formdata_append_any                                              from './wpt/xhr/formdata/append.any.js';
      26                 :          1 : import formdata_constructor_any                                         from './wpt/xhr/formdata/constructor.any.js';
      27                 :          1 : import formdata_delete_any                                              from './wpt/xhr/formdata/delete.any.js';
      28                 :          1 : import formdata_foreach_any                                             from './wpt/xhr/formdata/foreach.any.js';
      29                 :          1 : import formdata_get_any                                                 from './wpt/xhr/formdata/get.any.js';
      30                 :          1 : import formdata_has_any                                                 from './wpt/xhr/formdata/has.any.js';
      31                 :          1 : import formdata_iteration_any                                           from './wpt/xhr/formdata/iteration.any.js';
      32                 :          1 : import formdata_set_any                                                 from './wpt/xhr/formdata/set.any.js';
      33                 :          1 : import formdata_set_blob_any                                            from './wpt/xhr/formdata/set-blob.any.js';
      34                 :          1 : import firing_events_http_content_length                                from './wpt/xhr/firing-events-http-content-length.js';
      35                 :          1 : import firing_events_http_no_content_length                             from './wpt/xhr/firing-events-http-no-content-length.js';
      36                 :          1 : import getallresponseheaders_cookies                                    from './wpt/xhr/getallresponseheaders-cookies.js';
      37                 :          1 : // import getallresponseheaders                                         from './wpt/xhr/getallresponseheaders.js';
      38                 :          1 : import getallresponseheaders_status                                     from './wpt/xhr/getallresponseheaders-status.js';
      39                 :          1 : import getresponseheader_case_insensitive                               from './wpt/xhr/getresponseheader-case-insensitive.js';
      40                 :          1 : import getresponseheader_chunked_trailer                                from './wpt/xhr/getresponseheader-chunked-trailer.js';
      41                 :          1 : import getresponseheader_cookies_and_more                               from './wpt/xhr/getresponseheader-cookies-and-more.js';
      42                 :          1 : import getresponseheader_error_state                                    from './wpt/xhr/getresponseheader-error-state.js';
      43                 :          1 : import getresponseheader_server_date                                    from './wpt/xhr/getresponseheader-server-date.js';
      44                 :          1 : import getresponseheader_special_characters                             from './wpt/xhr/getresponseheader-special-characters.js';
      45                 :          1 : import getresponseheader_unsent_opened_state                            from './wpt/xhr/getresponseheader-unsent-opened-state.js';
      46                 :          1 : import headers_normalize_response                                       from './wpt/xhr/headers-normalize-response.js';
      47                 :          1 : import header_user_agent_async                                          from './wpt/xhr/header-user-agent-async.js';
      48                 :          1 : import header_user_agent_sync                                           from './wpt/xhr/header-user-agent-sync.js';
      49                 :          1 : import historical                                                       from './wpt/xhr/historical.js';
      50                 :          1 : import loadstart_and_state                                              from './wpt/xhr/loadstart-and-state.js';
      51                 :          1 : import open_after_abort                                                 from './wpt/xhr/open-after-abort.js';
      52                 :          1 : import open_after_setrequestheader                                      from './wpt/xhr/open-after-setrequestheader.js';
      53                 :          1 : import open_during_abort                                                from './wpt/xhr/open-during-abort.js';
      54                 :          1 : // import open_during_abort_event                                       from './wpt/xhr/open-during-abort-event.js';
      55                 :          1 : // import open_during_abort_processing                                  from './wpt/xhr/open-during-abort-processing.js';
      56                 :          1 : import open_method_bogus                                                from './wpt/xhr/open-method-bogus.js';
      57                 :          1 : import open_method_case_insensitive                                     from './wpt/xhr/open-method-case-insensitive.js';
      58                 :          1 : // import open_method_case_sensitive                                    from './wpt/xhr/open-method-case-sensitive.js';
      59                 :          1 : import open_method_insecure                                             from './wpt/xhr/open-method-insecure.js';
      60                 :          1 : import open_method_responsetype_set_sync                                from './wpt/xhr/open-method-responsetype-set-sync.js';
      61                 :          1 : import open_open_send                                                   from './wpt/xhr/open-open-send.js';
      62                 :          1 : import open_open_sync_send                                              from './wpt/xhr/open-open-sync-send.js';
      63                 :          1 : import open_parameters_toString                                         from './wpt/xhr/open-parameters-toString.js';
      64                 :          1 : import open_send_during_abort                                           from './wpt/xhr/open-send-during-abort.js';
      65                 :          1 : import open_send_open                                                   from './wpt/xhr/open-send-open.js';
      66                 :          1 : import open_sync_open_send                                              from './wpt/xhr/open-sync-open-send.js';
      67                 :          1 : import open_url_base                                                    from './wpt/xhr/open-url-base.js';
      68                 :          1 : // import open_url_encoding                                             from './wpt/xhr/open-url-encoding.js';
      69                 :          1 : import open_url_fragment                                                from './wpt/xhr/open-url-fragment.js';
      70                 :          1 : import overridemimetype_headers_received_state_force_shiftjis           from './wpt/xhr/overridemimetype-headers-received-state-force-shiftjis.js';
      71                 :          1 : import overridemimetype_invalid_mime_type                               from './wpt/xhr/overridemimetype-invalid-mime-type.js';
      72                 :          1 : import overridemimetype_loading_state                                   from './wpt/xhr/overridemimetype-loading-state.js';
      73                 :          1 : import overridemimetype_open_state_force_utf_8                          from './wpt/xhr/overridemimetype-open-state-force-utf-8.js';
      74                 :          1 : import preserve_ua_header_on_redirect                                   from './wpt/xhr/preserve-ua-header-on-redirect.js';
      75                 :          1 : import progressevent_constructor                                        from './wpt/xhr/progressevent-constructor.js';
      76                 :          1 : import progressevent_interface                                          from './wpt/xhr/progressevent-interface.js';
      77                 :          1 : import progress_events_response_data_gzip                               from './wpt/xhr/progress-events-response-data-gzip.js';
      78                 :          1 : import response_body_errors                                             from './wpt/xhr/response-body-errors.any.js';
      79                 :          1 : import response_data_arraybuffer                                        from './wpt/xhr/response-data-arraybuffer.js';
      80                 :          1 : import response_data_blob                                               from './wpt/xhr/response-data-blob.js';
      81                 :          1 : import response_data_progress                                           from './wpt/xhr/response-data-progress.js';
      82                 :          1 : import response_invalid_responsetype                                    from './wpt/xhr/response-invalid-responsetype.js';
      83                 :          1 : import response_json                                                    from './wpt/xhr/response-json.js';
      84                 :          1 : // import response_method                                               from './wpt/xhr/response-method.js';
      85                 :          1 : import responsetext_decoding                                            from './wpt/xhr/responsetext-decoding.js';
      86                 :          1 : import responsetext_status                                              from './wpt/xhr/responsetext-status.js';
      87                 :          1 : import send_accept                                                      from './wpt/xhr/send-accept.js';
      88                 :          1 : import send_accept_language                                             from './wpt/xhr/send-accept-language.js';
      89                 :          1 : import send_blob_with_no_mime_type                                      from './wpt/xhr/send-blob-with-no-mime-type.js';
      90                 :          1 : import send_content_type_charset                                        from './wpt/xhr/send-content-type-charset.js';
      91                 :          1 : import send_content_type_string                                         from './wpt/xhr/send-content-type-string.js';
      92                 :          1 : import send_data_blob                                                   from './wpt/xhr/send-data-blob.js';
      93                 :          1 : import send_entity_body_basic                                           from './wpt/xhr/send-entity-body-basic.js';
      94                 :          1 : import send_entity_body_empty                                           from './wpt/xhr/send-entity-body-empty.js';
      95                 :          1 : import send_entity_body_get_head                                        from './wpt/xhr/send-entity-body-get-head.js';
      96                 :          1 : import send_entity_body_get_head_async                                  from './wpt/xhr/send-entity-body-get-head-async.js';
      97                 :          1 : import send_entity_body_none                                            from './wpt/xhr/send-entity-body-none.js';
      98                 :          1 : import send_network_error_async_events_sub                              from './wpt/xhr/send-network-error-async-events.sub.js';
      99                 :          1 : import send_network_error_sync_events_sub                               from './wpt/xhr/send-network-error-sync-events.sub.js';
     100                 :          1 : import send_no_response_event_loadend                                   from './wpt/xhr/send-no-response-event-loadend.js';
     101                 :          1 : import send_no_response_event_loadstart                                 from './wpt/xhr/send-no-response-event-loadstart.js';
     102                 :          1 : import send_no_response_event_order                                     from './wpt/xhr/send-no-response-event-order.js';
     103                 :          1 : import send_receive_utf16                                               from './wpt/xhr/send-receive-utf16.js';
     104                 :          1 : import send_redirect                                                    from './wpt/xhr/send-redirect.js';
     105                 :          1 : import send_redirect_bogus                                              from './wpt/xhr/send-redirect-bogus.js';
     106                 :          1 : import send_redirect_bogus_sync                                         from './wpt/xhr/send-redirect-bogus-sync.js';
     107                 :          1 : import send_redirect_infinite                                           from './wpt/xhr/send-redirect-infinite.js';
     108                 :          1 : import send_redirect_infinite_sync                                      from './wpt/xhr/send-redirect-infinite-sync.js';
     109                 :          1 : // import send_redirect_no_location                                     from './wpt/xhr/send-redirect-no-location.js';
     110                 :          1 : import send_redirect_post_upload                                        from './wpt/xhr/send-redirect-post-upload.js';
     111                 :          1 : import send_response_event_order                                        from './wpt/xhr/send-response-event-order.js';
     112                 :          1 : import send_response_upload_event_loadend                               from './wpt/xhr/send-response-upload-event-loadend.js';
     113                 :          1 : import send_response_upload_event_loadstart                             from './wpt/xhr/send-response-upload-event-loadstart.js';
     114                 :          1 : import send_response_upload_event_progress                              from './wpt/xhr/send-response-upload-event-progress.js';
     115                 :          1 : import send_sync_blocks_async                                           from './wpt/xhr/send-sync-blocks-async.js';
     116                 :          1 : import send_sync_no_response_event_loadend                              from './wpt/xhr/send-sync-no-response-event-loadend.js';
     117                 :          1 : import send_sync_no_response_event_load                                 from './wpt/xhr/send-sync-no-response-event-load.js';
     118                 :          1 : import send_sync_no_response_event_order                                from './wpt/xhr/send-sync-no-response-event-order.js';
     119                 :          1 : import send_sync_response_event_order                                   from './wpt/xhr/send-sync-response-event-order.js';
     120                 :          1 : import send_sync_timeout                                                from './wpt/xhr/send-sync-timeout.js';
     121                 :          1 : import send_timeout_events                                              from './wpt/xhr/send-timeout-events.js';
     122                 :          1 : import setrequestheader_after_send                                      from './wpt/xhr/setrequestheader-after-send.js';
     123                 :          1 : import setrequestheader_allow_empty_value                               from './wpt/xhr/setrequestheader-allow-empty-value.js';
     124                 :          1 : import setrequestheader_allow_whitespace_in_value                       from './wpt/xhr/setrequestheader-allow-whitespace-in-value.js';
     125                 :          1 : import setrequestheader_before_open                                     from './wpt/xhr/setrequestheader-before-open.js';
     126                 :          1 : import setrequestheader_bogus_name                                      from './wpt/xhr/setrequestheader-bogus-name.js';
     127                 :          1 : import setrequestheader_bogus_value                                     from './wpt/xhr/setrequestheader-bogus-value.js';
     128                 :          1 : import setrequestheader_case_insensitive                                from './wpt/xhr/setrequestheader-case-insensitive.js';
     129                 :          1 : import setrequestheader_content_type                                    from './wpt/xhr/setrequestheader-content-type.js';
     130                 :          1 : import setrequestheader_header_allowed                                  from './wpt/xhr/setrequestheader-header-allowed.js';
     131                 :          1 : import setrequestheader_header_forbidden                                from './wpt/xhr/setrequestheader-header-forbidden.js';
     132                 :          1 : import setrequestheader_open_setrequestheader                           from './wpt/xhr/setrequestheader-open-setrequestheader.js';
     133                 :          1 : import status_async                                                     from './wpt/xhr/status-async.js';
     134                 :          1 : import status_basic                                                     from './wpt/xhr/status-basic.js';
     135                 :          1 : import status_error                                                     from './wpt/xhr/status-error.js';
     136                 :          1 : import xmlhttprequest_basic                                             from './wpt/xhr/xmlhttprequest-basic.js';
     137                 :          1 : import xmlhttprequest_eventtarget                                       from './wpt/xhr/xmlhttprequest-eventtarget.js';
     138                 :          1 : import xmlhttprequest_network_error                                     from './wpt/xhr/xmlhttprequest-network-error.js';
     139                 :          1 : import xmlhttprequest_network_error_sync                                from './wpt/xhr/xmlhttprequest-network-error-sync.js';
     140                 :          1 : import xmlhttprequest_unsent                                            from './wpt/xhr/xmlhttprequest-unsent.js';
     141                 :          1 : import File_constructor_any                                             from './wpt/FileAPI/file/File-constructor.any.js';
     142                 :          1 : import File_constructor_endings                                         from './wpt/FileAPI/file/File-constructor-endings.js';
     143                 :          1 : 
     144                 :          1 : /** @const {object} cmdOptions - Command line options */
     145                 :          1 : import cmdOptions from './wpt-xhr.cmd.js';
     146                 :          1 : 
     147                 :          1 : let activeURL = new URL (cmdOptions.url).href;
     148                 :          1 : activeURL = activeURL.substring(0, activeURL.length - 1);
     149                 :          1 : 
     150                 :          1 : /** Prepare test environment */
     151                 :          1 : 
     152                 :          1 : let testCount   = 0;
     153                 :          1 : let passCount   = 0;
     154                 :          1 : let failCount   = 0;
     155                 :          1 : let cancelCount = 0;
     156                 :          1 : let skipCount   = 0;
     157                 :          1 : let todoCount   = 0;
     158                 :          1 : let startTime   = Date.now();
     159                 :          1 : 
     160                 :          1 : const suites = new Map();
     161                 :          1 : 
     162                 :          1 : /**
     163                 :          1 :  * @func Main
     164                 :          1 :  * @desc The application entry point function
     165                 :          1 :  */
     166            [ + ]:          1 : (() => {
     167                 :          1 :         loadTestData();
     168                 :          1 : 
     169            [ - ]:          1 :         cmdOptions.verbose && splash();
     170                 :          1 : 
     171                 :          1 :         if(cmdOptions.node){
     172                 :          1 :                 import('node:test')
     173            [ + ]:          1 :                         .then(runner => {
     174                 :          1 :                                 nodeRunner(runner);
     175                 :          1 :                         })
     176                 :          1 :                         .catch(() => {
     177                 :          0 :                                 defRunner();
     178                 :          1 :                         });
     179            [ - ]:          1 :         }
     180                 :          0 :         else{
     181                 :          0 :                 defRunner();
     182                 :          0 :         }
     183                 :          1 : 
     184                 :          1 : })('Main Function');
     185                 :          1 : 
     186                 :          1 : /**
     187                 :          1 :  * @func loadTestData
     188                 :          1 :  * @desc Load test data
     189                 :          1 :  */
     190            [ + ]:          1 : function loadTestData(){
     191                 :          1 : 
     192                 :          1 :         let testData = null;
     193                 :          1 :         let suiteDesc = '';
     194                 :          1 : 
     195                 :          1 :         // TEST SUITE #1 - XMLHttpRequest
     196                 :          1 :         suiteDesc = 'XMLHttpRequest';
     197                 :          1 :         suites.set(suiteDesc, []);
     198                 :          1 : 
     199                 :          1 :                 // TEST 001 - XMLHttpRequest - prototype and members
     200                 :          1 :                 testData = {};
     201                 :          1 :                 testData.desc = 'XMLHttpRequest - prototype and members';
     202                 :          1 :                 testData.method = xmlhttprequest_basic;
     203                 :          1 : 
     204                 :          1 :                 testData.skip = false;
     205                 :          1 :                 suites.get(suiteDesc).push(testData);
     206                 :          1 : 
     207                 :          1 :                 // TEST 002 - XMLHttpRequest - implements EventTarget
     208                 :          1 :                 testData = {};
     209                 :          1 :                 testData.desc = 'XMLHttpRequest - implements EventTarget';
     210                 :          1 :                 testData.method = xmlhttprequest_eventtarget;
     211                 :          1 : 
     212                 :          1 :                 testData.skip = false;
     213                 :          1 :                 suites.get(suiteDesc).push(testData);
     214                 :          1 : 
     215                 :          1 :                 // TEST 003 - XMLHttpRequest - members during network errors (async)
     216                 :          1 :                 testData = {};
     217                 :          1 :                 testData.desc = 'XMLHttpRequest - members during network errors (async)';
     218                 :          1 :                 testData.method = xmlhttprequest_network_error;
     219                 :          1 : 
     220                 :          1 :                 testData.skip = false;
     221                 :          1 :                 suites.get(suiteDesc).push(testData);
     222                 :          1 : 
     223                 :          1 :                 // TEST 004 - XMLHttpRequest - members during network errors (sync)
     224                 :          1 :                 testData = {};
     225                 :          1 :                 testData.desc = 'XMLHttpRequest - members during network errors (sync)';
     226                 :          1 :                 testData.method = xmlhttprequest_network_error_sync;
     227                 :          1 : 
     228                 :          1 :                 testData.skip = false;
     229                 :          1 :                 suites.get(suiteDesc).push(testData);
     230                 :          1 : 
     231                 :          1 :                 // TEST 005 - XMLHttpRequest - members during UNSENT
     232                 :          1 :                 testData = {};
     233                 :          1 :                 testData.desc = 'XMLHttpRequest - members during UNSENT';
     234                 :          1 :                 testData.method = xmlhttprequest_unsent;
     235                 :          1 : 
     236                 :          1 :                 testData.skip = false;
     237                 :          1 :                 suites.get(suiteDesc).push(testData);
     238                 :          1 : 
     239                 :          1 :         // TEST SUITE #2 - Events
     240                 :          1 :         suiteDesc = 'Events';
     241                 :          1 :         suites.set(suiteDesc, []);
     242                 :          1 : 
     243                 :          1 :                 // TEST 006 - event - abort event
     244                 :          1 :                 testData = {};
     245                 :          1 :                 testData.desc = 'event - abort event';
     246                 :          1 :                 testData.method = event_abort_any;
     247                 :          1 : 
     248                 :          1 :                 testData.skip = false;
     249                 :          1 :                 suites.get(suiteDesc).push(testData);
     250                 :          1 : 
     251                 :          1 :                 // TEST 007 - event - error (order of events)
     252                 :          1 :                 testData = {};
     253                 :          1 :                 testData.desc = 'event - error (order of events)';
     254                 :          1 :                 testData.method = event_error_order_sub;
     255                 :          1 : 
     256                 :          1 :                 testData.skip = false;
     257                 :          1 :                 suites.get(suiteDesc).push(testData);
     258                 :          1 : 
     259                 :          1 :                 // TEST 008 - event - error event
     260                 :          1 :                 testData = {};
     261                 :          1 :                 testData.desc = 'event - error event';
     262                 :          1 :                 testData.method = event_error_sub_any;
     263                 :          1 : 
     264                 :          1 :                 testData.skip = false;
     265                 :          1 :                 suites.get(suiteDesc).push(testData);
     266                 :          1 : 
     267                 :          1 :                 // TEST 009 - event - load event
     268                 :          1 :                 testData = {};
     269                 :          1 :                 testData.desc = 'event - load event';
     270                 :          1 :                 testData.method = event_load_any;
     271                 :          1 : 
     272                 :          1 :                 testData.skip = false;
     273                 :          1 :                 suites.get(suiteDesc).push(testData);
     274                 :          1 : 
     275                 :          1 :                 // TEST 010 - event - loadend event
     276                 :          1 :                 testData = {};
     277                 :          1 :                 testData.desc = 'event - loadend event';
     278                 :          1 :                 testData.method = event_loadend_any;
     279                 :          1 : 
     280                 :          1 :                 testData.skip = false;
     281                 :          1 :                 suites.get(suiteDesc).push(testData);
     282                 :          1 : 
     283                 :          1 :                 // TEST 011 - event - loadstart event
     284                 :          1 :                 testData = {};
     285                 :          1 :                 testData.desc = 'event - loadstart event';
     286                 :          1 :                 testData.method = event_loadstart_any;
     287                 :          1 : 
     288                 :          1 :                 testData.skip = false;
     289                 :          1 :                 suites.get(suiteDesc).push(testData);
     290                 :          1 : 
     291                 :          1 :                 // TEST 012 - event - loadstart on upload object
     292                 :          1 :                 testData = {};
     293                 :          1 :                 testData.desc = 'event - loadstart on upload object';
     294                 :          1 :                 testData.method = event_loadstart_upload_any;
     295                 :          1 : 
     296                 :          1 :                 testData.skip = false;
     297                 :          1 :                 suites.get(suiteDesc).push(testData);
     298                 :          1 : 
     299                 :          1 :                 // TEST 013 - event - the LOADING state change may be emitted multiple times
     300                 :          1 :                 testData = {};
     301                 :          1 :                 testData.desc = 'event - the LOADING state change may be emitted multiple times';
     302                 :          1 :                 testData.method = event_readystatechange_loaded_any;
     303                 :          1 : 
     304                 :          1 :                 testData.skip = false;
     305                 :          1 :                 suites.get(suiteDesc).push(testData);
     306                 :          1 : 
     307                 :          1 :                 // TEST 014 - event - open() - call fires sync readystate event
     308                 :          1 :                 testData = {};
     309                 :          1 :                 testData.desc = 'event - open() - call fires sync readystate event';
     310                 :          1 :                 testData.method = event_readystate_sync_open_any;
     311                 :          1 : 
     312                 :          1 :                 testData.skip = false;
     313                 :          1 :                 suites.get(suiteDesc).push(testData);
     314                 :          1 : 
     315                 :          1 :                 // TEST 015 - event - timeout event
     316                 :          1 :                 testData = {};
     317                 :          1 :                 testData.desc = 'event - timeout event';
     318                 :          1 :                 testData.method = event_timeout_any;
     319                 :          1 : 
     320                 :          1 :                 testData.skip = false;
     321                 :          1 :                 suites.get(suiteDesc).push(testData);
     322                 :          1 : 
     323                 :          1 :                 // TEST 016 - event - timeout (order of events)
     324                 :          1 :                 testData = {};
     325                 :          1 :                 testData.desc = 'event - timeout (order of events)';
     326                 :          1 :                 testData.method = event_timeout_order_any;
     327                 :          1 : 
     328                 :          1 :                 testData.skip = false;
     329                 :          1 :                 suites.get(suiteDesc).push(testData);
     330                 :          1 : 
     331                 :          1 :                 // TEST 017 - event - progress event
     332                 :          1 :                 testData = {};
     333                 :          1 :                 testData.desc = 'event - progress event';
     334                 :          1 :                 testData.method = event_progress_any;
     335                 :          1 : 
     336                 :          1 :                 testData.skip = false;
     337                 :          1 :                 suites.get(suiteDesc).push(testData);
     338                 :          1 : 
     339                 :          1 :                 // TEST 018 - event - upload progress event
     340                 :          1 :                 testData = {};
     341                 :          1 :                 testData.desc = 'event - upload progress event';
     342                 :          1 :                 testData.method = event_upload_progress_any;
     343                 :          1 : 
     344                 :          1 :                 testData.skip = false;
     345                 :          1 :                 suites.get(suiteDesc).push(testData);
     346                 :          1 : 
     347                 :          1 :         // TEST SUITE #3 - Progress Events
     348                 :          1 :         suiteDesc = 'Progress Events';
     349                 :          1 :         suites.set(suiteDesc, []);
     350                 :          1 : 
     351                 :          1 :                 // TEST 019 - ProgressEvent - constructor
     352                 :          1 :                 testData = {};
     353                 :          1 :                 testData.desc = 'ProgressEvent - constructor';
     354                 :          1 :                 testData.method = progressevent_constructor;
     355                 :          1 : 
     356                 :          1 :                 testData.skip = false;
     357                 :          1 :                 suites.get(suiteDesc).push(testData);
     358                 :          1 : 
     359                 :          1 :                 // TEST 020 - ProgressEvent - interface
     360                 :          1 :                 testData = {};
     361                 :          1 :                 testData.desc = 'ProgressEvent - interface';
     362                 :          1 :                 testData.method = progressevent_interface;
     363                 :          1 : 
     364                 :          1 :                 testData.skip = false;
     365                 :          1 :                 suites.get(suiteDesc).push(testData);
     366                 :          1 : 
     367                 :          1 :                 // TEST 021 - ProgressEvent - firing events for HTTP with Content-Length
     368                 :          1 :                 testData = {};
     369                 :          1 :                 testData.desc = 'ProgressEvent - firing events for HTTP with Content-Length';
     370                 :          1 :                 testData.method = firing_events_http_content_length;
     371                 :          1 : 
     372                 :          1 :                 testData.skip = false;
     373                 :          1 :                 suites.get(suiteDesc).push(testData);
     374                 :          1 : 
     375                 :          1 :                 // TEST 022 - ProgressEvent - firing events for HTTP with NO Content-Length
     376                 :          1 :                 testData = {};
     377                 :          1 :                 testData.desc = 'ProgressEvent - firing events for HTTP with NO Content-Length';
     378                 :          1 :                 testData.method = firing_events_http_no_content_length;
     379                 :          1 : 
     380                 :          1 :                 testData.skip = false;
     381                 :          1 :                 suites.get(suiteDesc).push(testData);
     382                 :          1 : 
     383                 :          1 :                 // TEST 023 - ProgressEvent - and GZIP encoding
     384                 :          1 :                 testData = {};
     385                 :          1 :                 testData.desc = 'ProgressEvent - and GZIP encoding';
     386                 :          1 :                 testData.method = progress_events_response_data_gzip;
     387                 :          1 : 
     388                 :          1 :                 testData.skip = false;
     389                 :          1 :                 suites.get(suiteDesc).push(testData);
     390                 :          1 : 
     391                 :          1 :         // TEST SUITE #4 - Headers
     392                 :          1 :         suiteDesc = 'Headers';
     393                 :          1 :         suites.set(suiteDesc, []);
     394                 :          1 : 
     395                 :          1 :                 // TEST 024 - Headers - Whitespace and null in header values
     396                 :          1 :                 testData = {};
     397                 :          1 :                 testData.desc = 'Headers - Whitespace and null in header values';
     398                 :          1 :                 testData.method = headers_normalize_response;
     399                 :          1 : 
     400                 :          1 :                 testData.skip = false;
     401                 :          1 :                 suites.get(suiteDesc).push(testData);
     402                 :          1 : 
     403                 :          1 :                 // TEST 025 - Headers - Test that async requests are sent with the User-Agent header
     404                 :          1 :                 testData = {};
     405                 :          1 :                 testData.desc = 'Headers - Test that async requests are sent with the User-Agent header';
     406                 :          1 :                 testData.method = header_user_agent_async;
     407                 :          1 : 
     408                 :          1 :                 testData.skip = false;
     409                 :          1 :                 suites.get(suiteDesc).push(testData);
     410                 :          1 : 
     411                 :          1 :                 // TEST 026 - Headers - Test that sync requests are sent with the User-Agent header
     412                 :          1 :                 testData = {};
     413                 :          1 :                 testData.desc = 'Headers - Test that sync requests are sent with the User-Agent header';
     414                 :          1 :                 testData.method = header_user_agent_sync;
     415                 :          1 : 
     416                 :          1 :                 testData.skip = false;
     417                 :          1 :                 suites.get(suiteDesc).push(testData);
     418                 :          1 : 
     419                 :          1 :                 // TEST 027 - Headers - User-Agent header is preserved on redirect
     420                 :          1 :                 testData = {};
     421                 :          1 :                 testData.desc = 'Headers - User-Agent header is preserved on redirect';
     422                 :          1 :                 testData.method = preserve_ua_header_on_redirect;
     423                 :          1 : 
     424                 :          1 :                 testData.skip = false;
     425                 :          1 :                 suites.get(suiteDesc).push(testData);
     426                 :          1 : 
     427                 :          1 :         // TEST SUITE #5 - Methods - open
     428                 :          1 :         suiteDesc = 'Methods - open';
     429                 :          1 :         suites.set(suiteDesc, []);
     430                 :          1 : 
     431                 :          1 :                 // TEST 028 - open() - after abort()
     432                 :          1 :                 testData = {};
     433                 :          1 :                 testData.desc = 'open() - after abort()';
     434                 :          1 :                 testData.method = open_after_abort;
     435                 :          1 : 
     436                 :          1 :                 testData.skip = false;
     437                 :          1 :                 suites.get(suiteDesc).push(testData);
     438                 :          1 : 
     439                 :          1 :                 // TEST 029 - open() - after setRequestHeader()
     440                 :          1 :                 testData = {};
     441                 :          1 :                 testData.desc = 'open() - after setRequestHeader()';
     442                 :          1 :                 testData.method = open_after_setrequestheader;
     443                 :          1 : 
     444                 :          1 :                 testData.skip = false;
     445                 :          1 :                 suites.get(suiteDesc).push(testData);
     446                 :          1 : 
     447                 :          1 :                 // TEST 030 - open() - during abort()
     448                 :          1 :                 testData = {};
     449                 :          1 :                 testData.desc = 'open() - during abort()';
     450                 :          1 :                 testData.method = open_during_abort;
     451                 :          1 : 
     452                 :          1 :                 testData.skip = false;
     453                 :          1 :                 suites.get(suiteDesc).push(testData);
     454                 :          1 : 
     455                 :          1 :                 // TEST 031 - open() - bogus methods
     456                 :          1 :                 testData = {};
     457                 :          1 :                 testData.desc = 'open() - bogus methods';
     458                 :          1 :                 testData.method = open_method_bogus;
     459                 :          1 : 
     460                 :          1 :                 testData.skip = false;
     461                 :          1 :                 suites.get(suiteDesc).push(testData);
     462                 :          1 : 
     463                 :          1 :                 // TEST 032 - open() - case-insensitive methods test
     464                 :          1 :                 testData = {};
     465                 :          1 :                 testData.desc = 'open() - case-insensitive methods test';
     466                 :          1 :                 testData.method = open_method_case_insensitive;
     467                 :          1 : 
     468                 :          1 :                 testData.skip = false;
     469                 :          1 :                 suites.get(suiteDesc).push(testData);
     470                 :          1 : 
     471                 :          1 :                 // TEST 033 - open() - "insecure" methods
     472                 :          1 :                 testData = {};
     473                 :          1 :                 testData.desc = 'open() - "insecure" methods';
     474                 :          1 :                 testData.method = open_method_insecure;
     475                 :          1 : 
     476                 :          1 :                 testData.skip = false;
     477                 :          1 :                 suites.get(suiteDesc).push(testData);
     478                 :          1 : 
     479                 :          1 :                 // TEST 034 - open() - sync request not allowed if responseType is set
     480                 :          1 :                 testData = {};
     481                 :          1 :                 testData.desc = 'open() - sync request not allowed if responseType is set';
     482                 :          1 :                 testData.method = open_method_responsetype_set_sync;
     483                 :          1 : 
     484                 :          1 :                 testData.skip = false;
     485                 :          1 :                 suites.get(suiteDesc).push(testData);
     486                 :          1 : 
     487                 :          1 :                 // TEST 035 - open() - attempts to toString its string parameters
     488                 :          1 :                 testData = {};
     489                 :          1 :                 testData.desc = 'open() - attempts to toString its string parameters';
     490                 :          1 :                 testData.method = open_parameters_toString;
     491                 :          1 : 
     492                 :          1 :                 testData.skip = false;
     493                 :          1 :                 suites.get(suiteDesc).push(testData);
     494                 :          1 : 
     495                 :          1 :                 // TEST 036 - open() - open() - send()
     496                 :          1 :                 testData = {};
     497                 :          1 :                 testData.desc = 'open() - open() - send()';
     498                 :          1 :                 testData.method = open_open_send;
     499                 :          1 : 
     500                 :          1 :                 testData.skip = false;
     501                 :          1 :                 suites.get(suiteDesc).push(testData);
     502                 :          1 : 
     503                 :          1 :                 // TEST 037 - open() - open() (sync) - send()
     504                 :          1 :                 testData = {};
     505                 :          1 :                 testData.desc = 'open() - open() (sync) - send()';
     506                 :          1 :                 testData.method = open_open_sync_send;
     507                 :          1 : 
     508                 :          1 :                 testData.skip = false;
     509                 :          1 :                 suites.get(suiteDesc).push(testData);
     510                 :          1 : 
     511                 :          1 :                 // TEST 038 - open() - send() - open()
     512                 :          1 :                 testData = {};
     513                 :          1 :                 testData.desc = 'open() - send() - open()';
     514                 :          1 :                 testData.method = open_send_open;
     515                 :          1 : 
     516                 :          1 :                 testData.skip = false;
     517                 :          1 :                 suites.get(suiteDesc).push(testData);
     518                 :          1 : 
     519                 :          1 :                 // TEST 039 - open() - during abort()
     520                 :          1 :                 testData = {};
     521                 :          1 :                 testData.desc = 'open() - during abort()';
     522                 :          1 :                 testData.method = open_send_during_abort;
     523                 :          1 : 
     524                 :          1 :                 testData.skip = false;
     525                 :          1 :                 suites.get(suiteDesc).push(testData);
     526                 :          1 : 
     527                 :          1 :                 // TEST 040 - open() - (sync) - send() - open()
     528                 :          1 :                 testData = {};
     529                 :          1 :                 testData.desc = 'open() - (sync) - send() - open()';
     530                 :          1 :                 testData.method = open_sync_open_send;
     531                 :          1 : 
     532                 :          1 :                 testData.skip = false;
     533                 :          1 :                 suites.get(suiteDesc).push(testData);
     534                 :          1 : 
     535                 :          1 :                 // TEST 041 - open() - resolving URLs
     536                 :          1 :                 testData = {};
     537                 :          1 :                 testData.desc = 'open() - resolving URLs';
     538                 :          1 :                 testData.method = open_url_base;
     539                 :          1 : 
     540                 :          1 :                 testData.skip = false;
     541                 :          1 :                 suites.get(suiteDesc).push(testData);
     542                 :          1 : 
     543                 :          1 :                 // TEST 042 - open() - resolving URLs - fragment identifier
     544                 :          1 :                 testData = {};
     545                 :          1 :                 testData.desc = 'open() - resolving URLs - fragment identifier';
     546                 :          1 :                 testData.method = open_url_fragment;
     547                 :          1 : 
     548                 :          1 :                 testData.skip = false;
     549                 :          1 :                 suites.get(suiteDesc).push(testData);
     550                 :          1 : 
     551                 :          1 :         // TEST SUITE #6 - Methods - setRequestHeader
     552                 :          1 :         suiteDesc = 'Methods - setRequestHeader';
     553                 :          1 :         suites.set(suiteDesc, []);
     554                 :          1 : 
     555                 :          1 :                 // TEST 043 - setRequestHeader() - after send()
     556                 :          1 :                 testData = {};
     557                 :          1 :                 testData.desc = 'setRequestHeader() - after send()';
     558                 :          1 :                 testData.method = setrequestheader_after_send;
     559                 :          1 : 
     560                 :          1 :                 testData.skip = false;
     561                 :          1 :                 suites.get(suiteDesc).push(testData);
     562                 :          1 : 
     563                 :          1 :                 // TEST 044 - setRequestHeader() - empty header
     564                 :          1 :                 testData = {};
     565                 :          1 :                 testData.desc = 'setRequestHeader() - empty header';
     566                 :          1 :                 testData.method = setrequestheader_allow_empty_value;
     567                 :          1 : 
     568                 :          1 :                 testData.skip = false;
     569                 :          1 :                 suites.get(suiteDesc).push(testData);
     570                 :          1 : 
     571                 :          1 :                 // TEST 045 - setRequestHeader() - header value with whitespace
     572                 :          1 :                 testData = {};
     573                 :          1 :                 testData.desc = 'setRequestHeader() - header value with whitespace';
     574                 :          1 :                 testData.method = setrequestheader_allow_whitespace_in_value;
     575                 :          1 : 
     576                 :          1 :                 testData.skip = false;
     577                 :          1 :                 suites.get(suiteDesc).push(testData);
     578                 :          1 : 
     579                 :          1 :                 // TEST 046 - setRequestHeader() - before open()
     580                 :          1 :                 testData = {};
     581                 :          1 :                 testData.desc = 'setRequestHeader() - before open()';
     582                 :          1 :                 testData.method = setrequestheader_before_open;
     583                 :          1 : 
     584                 :          1 :                 testData.skip = false;
     585                 :          1 :                 suites.get(suiteDesc).push(testData);
     586                 :          1 : 
     587                 :          1 :                 // TEST 047 - setRequestHeader() - name argument checks
     588                 :          1 :                 testData = {};
     589                 :          1 :                 testData.desc = 'setRequestHeader() - name argument checks';
     590                 :          1 :                 testData.method = setrequestheader_bogus_name;
     591                 :          1 : 
     592                 :          1 :                 testData.skip = false;
     593                 :          1 :                 suites.get(suiteDesc).push(testData);
     594                 :          1 : 
     595                 :          1 :                 // TEST 048 - setRequestHeader() - value argument checks
     596                 :          1 :                 testData = {};
     597                 :          1 :                 testData.desc = 'setRequestHeader() - value argument checks';
     598                 :          1 :                 testData.method = setrequestheader_bogus_value;
     599                 :          1 : 
     600                 :          1 :                 testData.skip = false;
     601                 :          1 :                 suites.get(suiteDesc).push(testData);
     602                 :          1 : 
     603                 :          1 :                 // TEST 049 - setRequestHeader() - headers that differ in case
     604                 :          1 :                 testData = {};
     605                 :          1 :                 testData.desc = 'setRequestHeader() - headers that differ in case';
     606                 :          1 :                 testData.method = setrequestheader_case_insensitive;
     607                 :          1 : 
     608                 :          1 :                 testData.skip = false;
     609                 :          1 :                 suites.get(suiteDesc).push(testData);
     610                 :          1 : 
     611                 :          1 :                 // TEST 050 - setRequestHeader() - Content-Type header
     612                 :          1 :                 testData = {};
     613                 :          1 :                 testData.desc = 'setRequestHeader() - Content-Type header';
     614                 :          1 :                 testData.method = setrequestheader_content_type;
     615                 :          1 : 
     616                 :          1 :                 testData.skip = false;
     617                 :          1 :                 suites.get(suiteDesc).push(testData);
     618                 :          1 : 
     619                 :          1 :                 // TEST 051 - setRequestHeader() - headers that are allowed
     620                 :          1 :                 testData = {};
     621                 :          1 :                 testData.desc = 'setRequestHeader() - headers that are allowed';
     622                 :          1 :                 testData.method = setrequestheader_header_allowed;
     623                 :          1 : 
     624                 :          1 :                 testData.skip = false;
     625                 :          1 :                 suites.get(suiteDesc).push(testData);
     626                 :          1 : 
     627                 :          1 :                 // TEST 052 - setRequestHeader() - headers that are forbidden
     628                 :          1 :                 testData = {};
     629                 :          1 :                 testData.desc = 'setRequestHeader() - headers that are forbidden';
     630                 :          1 :                 testData.method = setrequestheader_header_forbidden;
     631                 :          1 : 
     632                 :          1 :                 testData.skip = false;
     633                 :          1 :                 suites.get(suiteDesc).push(testData);
     634                 :          1 : 
     635                 :          1 :                 // TEST 053 - setRequestHeader() - and open()
     636                 :          1 :                 testData = {};
     637                 :          1 :                 testData.desc = 'setRequestHeader() - and open()';
     638                 :          1 :                 testData.method = setrequestheader_open_setrequestheader;
     639                 :          1 : 
     640                 :          1 :                 testData.skip = false;
     641                 :          1 :                 suites.get(suiteDesc).push(testData);
     642                 :          1 : 
     643                 :          1 :         // TEST SUITE #7 - Methods - overrideMimeType
     644                 :          1 :         suiteDesc = 'Methods - overrideMimeType';
     645                 :          1 :         suites.set(suiteDesc, []);
     646                 :          1 : 
     647                 :          1 :                 // TEST 054 - overrideMimeType() - in HEADERS RECEIVED state, enforcing Shift-JIS encoding
     648                 :          1 :                 testData = {};
     649                 :          1 :                 testData.desc = 'overrideMimeType() - in HEADERS RECEIVED state, enforcing Shift-JIS encoding';
     650                 :          1 :                 testData.method = overridemimetype_headers_received_state_force_shiftjis;
     651                 :          1 : 
     652                 :          1 :                 testData.skip = false;
     653                 :          1 :                 suites.get(suiteDesc).push(testData);
     654                 :          1 : 
     655                 :          1 :                 // TEST 055 - overrideMimeType() - and invalid MIME types
     656                 :          1 :                 testData = {};
     657                 :          1 :                 testData.desc = 'overrideMimeType() - and invalid MIME types';
     658                 :          1 :                 testData.method = overridemimetype_invalid_mime_type;
     659                 :          1 : 
     660                 :          1 :                 testData.skip = false;
     661                 :          1 :                 suites.get(suiteDesc).push(testData);
     662                 :          1 : 
     663                 :          1 :                 // TEST 056 - overrideMimeType() - in LOADING state
     664                 :          1 :                 testData = {};
     665                 :          1 :                 testData.desc = 'overrideMimeType() - in LOADING state';
     666                 :          1 :                 testData.method = overridemimetype_loading_state;
     667                 :          1 : 
     668                 :          1 :                 testData.skip = false;
     669                 :          1 :                 suites.get(suiteDesc).push(testData);
     670                 :          1 : 
     671                 :          1 :                 // TEST 057 - overrideMimeType() - in open state, enforcing UTF-8 encoding
     672                 :          1 :                 testData = {};
     673                 :          1 :                 testData.desc = 'overrideMimeType() - in open state, enforcing UTF-8 encoding';
     674                 :          1 :                 testData.method = overridemimetype_open_state_force_utf_8;
     675                 :          1 : 
     676                 :          1 :                 testData.skip = false;
     677                 :          1 :                 suites.get(suiteDesc).push(testData);
     678                 :          1 : 
     679                 :          1 :         // TEST SUITE #8 - Methods - send
     680                 :          1 :         suiteDesc = 'Methods - send';
     681                 :          1 :         suites.set(suiteDesc, []);
     682                 :          1 : 
     683                 :          1 :                 // TEST 058 - send() - Accept
     684                 :          1 :                 testData = {};
     685                 :          1 :                 testData.desc = 'send() - Accept';
     686                 :          1 :                 testData.method = send_accept;
     687                 :          1 : 
     688                 :          1 :                 testData.skip = false;
     689                 :          1 :                 suites.get(suiteDesc).push(testData);
     690                 :          1 : 
     691                 :          1 :                 // TEST 059 - send() - Accept-Language
     692                 :          1 :                 testData = {};
     693                 :          1 :                 testData.desc = 'send() - Accept-Language';
     694                 :          1 :                 testData.method = send_accept_language;
     695                 :          1 : 
     696                 :          1 :                 testData.skip = false;
     697                 :          1 :                 suites.get(suiteDesc).push(testData);
     698                 :          1 : 
     699                 :          1 :                 // TEST 060 - send() - Blob data with no mime type
     700                 :          1 :                 testData = {};
     701                 :          1 :                 testData.desc = 'send() - Blob data with no mime type';
     702                 :          1 :                 testData.method = send_blob_with_no_mime_type;
     703                 :          1 : 
     704                 :          1 :                 testData.skip = false;
     705                 :          1 :                 suites.get(suiteDesc).push(testData);
     706                 :          1 : 
     707                 :          1 :                 // TEST 061 - send() - Content-Type
     708                 :          1 :                 testData = {};
     709                 :          1 :                 testData.desc = 'send() - Content-Type';
     710                 :          1 :                 testData.method = send_content_type_string;
     711                 :          1 : 
     712                 :          1 :                 testData.skip = false;
     713                 :          1 :                 suites.get(suiteDesc).push(testData);
     714                 :          1 : 
     715                 :          1 :                 // TEST 062 - send() - charset parameter of Content-Type
     716                 :          1 :                 testData = {};
     717                 :          1 :                 testData.desc = 'send() - charset parameter of Content-Type';
     718                 :          1 :                 testData.method = send_content_type_charset;
     719                 :          1 : 
     720                 :          1 :                 testData.skip = false;
     721                 :          1 :                 suites.get(suiteDesc).push(testData);
     722                 :          1 : 
     723                 :          1 :                 // TEST 063 - send() - method: Blob data
     724                 :          1 :                 testData = {};
     725                 :          1 :                 testData.desc = 'send() - method: Blob data';
     726                 :          1 :                 testData.method = send_data_blob;
     727                 :          1 : 
     728                 :          1 :                 testData.skip = false;
     729                 :          1 :                 suites.get(suiteDesc).push(testData);
     730                 :          1 : 
     731                 :          1 :                 // TEST 064 - send() - data argument
     732                 :          1 :                 testData = {};
     733                 :          1 :                 testData.desc = 'send() - data argument';
     734                 :          1 :                 testData.method = send_entity_body_basic;
     735                 :          1 : 
     736                 :          1 :                 testData.skip = false;
     737                 :          1 :                 suites.get(suiteDesc).push(testData);
     738                 :          1 : 
     739                 :          1 :                 // TEST 065 - send() - "" empty entity body
     740                 :          1 :                 testData = {};
     741                 :          1 :                 testData.desc = 'send() - "" empty entity body';
     742                 :          1 :                 testData.method = send_entity_body_empty;
     743                 :          1 : 
     744                 :          1 :                 testData.skip = false;
     745                 :          1 :                 suites.get(suiteDesc).push(testData);
     746                 :          1 : 
     747                 :          1 :                 // TEST 066 - send() - non-empty data argument and GET/HEAD - async, no upload events should fire
     748                 :          1 :                 testData = {};
     749                 :          1 :                 testData.desc = 'send() - non-empty data argument and GET/HEAD - async, no upload events should fire';
     750                 :          1 :                 testData.method = send_entity_body_get_head_async;
     751                 :          1 : 
     752                 :          1 :                 testData.skip = false;
     753                 :          1 :                 suites.get(suiteDesc).push(testData);
     754                 :          1 : 
     755                 :          1 :                 // TEST 067 - send() - non-empty data argument and GET/HEAD, no upload events should fire
     756                 :          1 :                 testData = {};
     757                 :          1 :                 testData.desc = 'send() - non-empty data argument and GET/HEAD, no upload events should fire';
     758                 :          1 :                 testData.method = send_entity_body_get_head;
     759                 :          1 : 
     760                 :          1 :                 testData.skip = false;
     761                 :          1 :                 suites.get(suiteDesc).push(testData);
     762                 :          1 : 
     763                 :          1 :                 // TEST 068 - send() - null entity body
     764                 :          1 :                 testData = {};
     765                 :          1 :                 testData.desc = 'send() - null entity body';
     766                 :          1 :                 testData.method = send_entity_body_none;
     767                 :          1 : 
     768                 :          1 :                 testData.skip = false;
     769                 :          1 :                 suites.get(suiteDesc).push(testData);
     770                 :          1 : 
     771                 :          1 :                 // TEST 069 - send() - Fire a progress event named error when Network error happens (synchronous flag is unset
     772                 :          1 :                 testData = {};
     773                 :          1 :                 testData.desc = 'send() - Fire a progress event named error when Network error happens (synchronous flag is unset)';
     774                 :          1 :                 testData.method = send_network_error_async_events_sub;
     775                 :          1 : 
     776                 :          1 :                 testData.skip = false;
     777                 :          1 :                 suites.get(suiteDesc).push(testData);
     778                 :          1 : 
     779                 :          1 :                 // TEST 070 - send() - Throw a "throw an "NetworkError" exception when Network error happens (synchronous flag is set)
     780                 :          1 :                 testData = {};
     781                 :          1 :                 testData.desc = 'send() - Throw a "throw an "NetworkError" exception when Network error happens (synchronous flag is set)';
     782                 :          1 :                 testData.method = send_network_error_sync_events_sub;
     783                 :          1 : 
     784                 :          1 :                 testData.skip = false;
     785                 :          1 :                 suites.get(suiteDesc).push(testData);
     786                 :          1 : 
     787                 :          1 :                 // TEST 071 - send() - Fire a progress event named loadend (no response entity body)
     788                 :          1 :                 testData = {};
     789                 :          1 :                 testData.desc = 'send() - Fire a progress event named loadend (no response entity body)';
     790                 :          1 :                 testData.method = send_no_response_event_loadend;
     791                 :          1 : 
     792                 :          1 :                 testData.skip = false;
     793                 :          1 :                 suites.get(suiteDesc).push(testData);
     794                 :          1 : 
     795                 :          1 :                 // TEST 072 - send() - Fire a progress event named loadstart (no response entity body and the state is LOADING)
     796                 :          1 :                 testData = {};
     797                 :          1 :                 testData.desc = 'send() - Fire a progress event named loadstart (no response entity body and the state is LOADING)';
     798                 :          1 :                 testData.method = send_no_response_event_loadstart;
     799                 :          1 : 
     800                 :          1 :                 testData.skip = false;
     801                 :          1 :                 suites.get(suiteDesc).push(testData);
     802                 :          1 : 
     803                 :          1 :                 // TEST 073 - send() - event order when there is no response entity body
     804                 :          1 :                 testData = {};
     805                 :          1 :                 testData.desc = 'send() - event order when there is no response entity body';
     806                 :          1 :                 testData.method = send_no_response_event_order;
     807                 :          1 : 
     808                 :          1 :                 testData.skip = false;
     809                 :          1 :                 suites.get(suiteDesc).push(testData);
     810                 :          1 : 
     811                 :          1 :                 // TEST 074 - send() - receive data which is UTF-16 encoded
     812                 :          1 :                 testData = {};
     813                 :          1 :                 testData.desc = 'send() - receive data which is UTF-16 encoded';
     814                 :          1 :                 testData.method = send_receive_utf16;
     815                 :          1 : 
     816                 :          1 :                 testData.skip = false;
     817                 :          1 :                 suites.get(suiteDesc).push(testData);
     818                 :          1 : 
     819                 :          1 :                 // TEST 075 - send() - Redirects (basics)
     820                 :          1 :                 testData = {};
     821                 :          1 :                 testData.desc = 'send() - Redirects (basics)';
     822                 :          1 :                 testData.method = send_redirect;
     823                 :          1 : 
     824                 :          1 :                 testData.skip = false;
     825                 :          1 :                 suites.get(suiteDesc).push(testData);
     826                 :          1 : 
     827                 :          1 :                 // TEST 076 - send() - Redirects (bogus Location header)
     828                 :          1 :                 testData = {};
     829                 :          1 :                 testData.desc = 'send() - Redirects (bogus Location header)';
     830                 :          1 :                 testData.method = send_redirect_bogus;
     831                 :          1 : 
     832                 :          1 :                 testData.skip = false;
     833                 :          1 :                 suites.get(suiteDesc).push(testData);
     834                 :          1 : 
     835                 :          1 :                 // TEST 077 - send() - Redirects (bogus Location header; sync)
     836                 :          1 :                 testData = {};
     837                 :          1 :                 testData.desc = 'send() - Redirects (bogus Location header; sync)';
     838                 :          1 :                 testData.method = send_redirect_bogus_sync;
     839                 :          1 : 
     840                 :          1 :                 testData.skip = false;
     841                 :          1 :                 suites.get(suiteDesc).push(testData);
     842                 :          1 : 
     843                 :          1 :                 // TEST 078 - send() - Redirects (infinite loop)
     844                 :          1 :                 testData = {};
     845                 :          1 :                 testData.desc = 'send() - Redirects (infinite loop)';
     846                 :          1 :                 testData.method = send_redirect_infinite;
     847                 :          1 : 
     848                 :          1 :                 testData.skip = false;
     849                 :          1 :                 suites.get(suiteDesc).push(testData);
     850                 :          1 : 
     851                 :          1 :                 // TEST 079 - send() - Redirects (infinite loop; sync)
     852                 :          1 :                 testData = {};
     853                 :          1 :                 testData.desc = 'send() - Redirects (infinite loop; sync)';
     854                 :          1 :                 testData.method = send_redirect_infinite_sync;
     855                 :          1 : 
     856                 :          1 :                 testData.skip = false;
     857                 :          1 :                 suites.get(suiteDesc).push(testData);
     858                 :          1 : 
     859                 :          1 :                 // TEST 080 - send() - POSTing to URL that redirects
     860                 :          1 :                 testData = {};
     861                 :          1 :                 testData.desc = 'send() - POSTing to URL that redirects';
     862                 :          1 :                 testData.method = send_redirect_post_upload;
     863                 :          1 : 
     864                 :          1 :                 testData.skip = false;
     865                 :          1 :                 suites.get(suiteDesc).push(testData);
     866                 :          1 : 
     867                 :          1 :                 // TEST 081 - send() - event order when synchronous flag is unset
     868                 :          1 :                 testData = {};
     869                 :          1 :                 testData.desc = 'send() - event order when synchronous flag is unset';
     870                 :          1 :                 testData.method = send_response_event_order;
     871                 :          1 : 
     872                 :          1 :                 testData.skip = false;
     873                 :          1 :                 suites.get(suiteDesc).push(testData);
     874                 :          1 : 
     875                 :          1 :                 // TEST 082 - send() - Fire a progress event named loadstart on the XMLHttpRequestUpload (synchronous flag is unset)
     876                 :          1 :                 testData = {};
     877                 :          1 :                 testData.desc = 'send() - Fire a progress event named loadstart on the XMLHttpRequestUpload (synchronous flag is unset)';
     878                 :          1 :                 testData.method = send_response_upload_event_loadstart;
     879                 :          1 : 
     880                 :          1 :                 testData.skip = false;
     881                 :          1 :                 suites.get(suiteDesc).push(testData);
     882                 :          1 : 
     883                 :          1 :                 // TEST 083 - send() - Fire a progress event named loadend on the XMLHttpRequestUpload (synchronous flag is unset)
     884                 :          1 :                 testData = {};
     885                 :          1 :                 testData.desc = 'send() - Fire a progress event named loadend on the XMLHttpRequestUpload (synchronous flag is unset)';
     886                 :          1 :                 testData.method = send_response_upload_event_loadend;
     887                 :          1 : 
     888                 :          1 :                 testData.skip = false;
     889                 :          1 :                 suites.get(suiteDesc).push(testData);
     890                 :          1 : 
     891                 :          1 :                 // TEST 084 - send() - Fire a progress event named progress on the XMLHttpRequestUpload (synchronous flag is unset)
     892                 :          1 :                 testData = {};
     893                 :          1 :                 testData.desc = 'send() - Fire a progress event named progress on the XMLHttpRequestUpload (synchronous flag is unset)';
     894                 :          1 :                 testData.method = send_response_upload_event_progress;
     895                 :          1 : 
     896                 :          1 :                 testData.skip = false;
     897                 :          1 :                 suites.get(suiteDesc).push(testData);
     898                 :          1 : 
     899                 :          1 :                 // TEST 085 - send() - sync requests should block events on pending async requests
     900                 :          1 :                 testData = {};
     901                 :          1 :                 testData.desc = 'send() - sync requests should block events on pending async requests';
     902                 :          1 :                 testData.method = send_sync_blocks_async;
     903                 :          1 : 
     904                 :          1 :                 testData.skip = false;
     905                 :          1 :                 suites.get(suiteDesc).push(testData);
     906                 :          1 : 
     907                 :          1 :                 // TEST 086 - send() - event order when synchronous flag is set and there is no response entity body
     908                 :          1 :                 testData = {};
     909                 :          1 :                 testData.desc = 'send() - event order when synchronous flag is set and there is no response entity body';
     910                 :          1 :                 testData.method = send_sync_no_response_event_order;
     911                 :          1 : 
     912                 :          1 :                 testData.skip = false;
     913                 :          1 :                 suites.get(suiteDesc).push(testData);
     914                 :          1 : 
     915                 :          1 :                 // TEST 087 - send() - Fire an event named loadend (no response entity body and the synchronous flag is set)
     916                 :          1 :                 testData = {};
     917                 :          1 :                 testData.desc = 'send() - Fire an event named loadend (no response entity body and the synchronous flag is set)';
     918                 :          1 :                 testData.method = send_sync_no_response_event_load;
     919                 :          1 : 
     920                 :          1 :                 testData.skip = false;
     921                 :          1 :                 suites.get(suiteDesc).push(testData);
     922                 :          1 : 
     923                 :          1 :                 // TEST 088 - send() - Fire an event named loadend (no response entity body and the synchronous flag is set)
     924                 :          1 :                 testData = {};
     925                 :          1 :                 testData.desc = 'send() - Fire an event named loadend (no response entity body and the synchronous flag is set)';
     926                 :          1 :                 testData.method = send_sync_no_response_event_loadend;
     927                 :          1 : 
     928                 :          1 :                 testData.skip = false;
     929                 :          1 :                 suites.get(suiteDesc).push(testData);
     930                 :          1 : 
     931                 :          1 :                 // TEST 089 - send() - event order when synchronous flag is set
     932                 :          1 :                 testData = {};
     933                 :          1 :                 testData.desc = 'send() - event order when synchronous flag is set';
     934                 :          1 :                 testData.method = send_sync_response_event_order;
     935                 :          1 : 
     936                 :          1 :                 testData.skip = false;
     937                 :          1 :                 suites.get(suiteDesc).push(testData);
     938                 :          1 : 
     939                 :          1 :                 // TEST 090 - send() - timeout during sync send() should not run
     940                 :          1 :                 testData = {};
     941                 :          1 :                 testData.desc = 'send() - timeout during sync send() should not run';
     942                 :          1 :                 testData.method = send_sync_timeout;
     943                 :          1 : 
     944                 :          1 :                 testData.skip = false;
     945                 :          1 :                 suites.get(suiteDesc).push(testData);
     946                 :          1 : 
     947                 :          1 :                 // TEST 091 - send() - timeout is not 0
     948                 :          1 :                 testData = {};
     949                 :          1 :                 testData.desc = 'send() - timeout is not 0';
     950                 :          1 :                 testData.method = send_timeout_events;
     951                 :          1 : 
     952                 :          1 :                 testData.skip = false;
     953                 :          1 :                 suites.get(suiteDesc).push(testData);
     954                 :          1 : 
     955                 :          1 :         // TEST SUITE #9 - Methods - abort
     956                 :          1 :         suiteDesc = 'Methods - abort';
     957                 :          1 :         suites.set(suiteDesc, []);
     958                 :          1 : 
     959                 :          1 :                 // TEST 092 - abort() - abort and loadend events
     960                 :          1 :                 testData = {};
     961                 :          1 :                 testData.desc = 'abort() - abort and loadend events';
     962                 :          1 :                 testData.method = abort_event_order;
     963                 :          1 : 
     964                 :          1 :                 testData.skip = false;
     965                 :          1 :                 suites.get(suiteDesc).push(testData);
     966                 :          1 : 
     967                 :          1 :         // TEST SUITE #10 - Methods - getAllResponseHeaders
     968                 :          1 :         suiteDesc = 'Methods - getAllResponseHeaders';
     969                 :          1 :         suites.set(suiteDesc, []);
     970                 :          1 : 
     971                 :          1 :                 // TEST 093 - getAllResponseHeaders() - excludes cookies
     972                 :          1 :                 testData = {};
     973                 :          1 :                 testData.desc = 'getAllResponseHeaders() - excludes cookies';
     974                 :          1 :                 testData.method = getallresponseheaders_cookies;
     975                 :          1 : 
     976                 :          1 :                 testData.skip = false;
     977                 :          1 :                 suites.get(suiteDesc).push(testData);
     978                 :          1 : 
     979                 :          1 :                 // TEST 094 - getAllResponseHeaders() - excludes status line (HTTP/1.1 ...)
     980                 :          1 :                 testData = {};
     981                 :          1 :                 testData.desc = 'getAllResponseHeaders() - excludes status line (HTTP/1.1 ...)';
     982                 :          1 :                 testData.method = getallresponseheaders_status;
     983                 :          1 : 
     984                 :          1 :                 testData.skip = false;
     985                 :          1 :                 suites.get(suiteDesc).push(testData);
     986                 :          1 : 
     987                 :          1 :         // TEST SUITE #11 - Methods - getResponseHeader
     988                 :          1 :         suiteDesc = 'Methods - getResponseHeader';
     989                 :          1 :         suites.set(suiteDesc, []);
     990                 :          1 : 
     991                 :          1 :                 // TEST 095 - getResponseHeader() - case-insensitive matching
     992                 :          1 :                 testData = {};
     993                 :          1 :                 testData.desc = 'getResponseHeader() - case-insensitive matching';
     994                 :          1 :                 testData.method = getresponseheader_case_insensitive;
     995                 :          1 : 
     996                 :          1 :                 testData.skip = false;
     997                 :          1 :                 suites.get(suiteDesc).push(testData);
     998                 :          1 : 
     999                 :          1 :                 // TEST 096 - getResponseHeader() - and HTTP trailer
    1000                 :          1 :                 testData = {};
    1001                 :          1 :                 testData.desc = 'getResponseHeader() - and HTTP trailer';
    1002                 :          1 :                 testData.method = getresponseheader_chunked_trailer;
    1003                 :          1 : 
    1004                 :          1 :                 testData.skip = false;
    1005                 :          1 :                 suites.get(suiteDesc).push(testData);
    1006                 :          1 : 
    1007                 :          1 :                 // TEST 097 - getResponseHeader() - custom/non-existent headers and cookies
    1008                 :          1 :                 testData = {};
    1009                 :          1 :                 testData.desc = 'getResponseHeader() - custom/non-existent headers and cookies';
    1010                 :          1 :                 testData.method = getresponseheader_cookies_and_more;
    1011                 :          1 : 
    1012                 :          1 :                 testData.skip = false;
    1013                 :          1 :                 suites.get(suiteDesc).push(testData);
    1014                 :          1 : 
    1015                 :          1 :                 // TEST 098 - getResponseHeader() - in error state
    1016                 :          1 :                 testData = {};
    1017                 :          1 :                 testData.desc = 'getResponseHeader() - in error state';
    1018                 :          1 :                 testData.method = getresponseheader_error_state;
    1019                 :          1 : 
    1020                 :          1 :                 testData.skip = false;
    1021                 :          1 :                 suites.get(suiteDesc).push(testData);
    1022                 :          1 : 
    1023                 :          1 :                 // TEST 099 - getResponseHeader() - server and date
    1024                 :          1 :                 testData = {};
    1025                 :          1 :                 testData.desc = 'getResponseHeader() - server and date';
    1026                 :          1 :                 testData.method = getresponseheader_server_date;
    1027                 :          1 : 
    1028                 :          1 :                 testData.skip = false;
    1029                 :          1 :                 suites.get(suiteDesc).push(testData);
    1030                 :          1 : 
    1031                 :          1 :                 // TEST 100 - getResponseHeader() - funny characters
    1032                 :          1 :                 testData = {};
    1033                 :          1 :                 testData.desc = 'getResponseHeader() - funny characters';
    1034                 :          1 :                 testData.method = getresponseheader_special_characters;
    1035                 :          1 : 
    1036                 :          1 :                 testData.skip = false;
    1037                 :          1 :                 suites.get(suiteDesc).push(testData);
    1038                 :          1 : 
    1039                 :          1 :                 // TEST 101 - getResponseHeader() - in unsent, opened states
    1040                 :          1 :                 testData = {};
    1041                 :          1 :                 testData.desc = 'getResponseHeader() - in unsent, opened states';
    1042                 :          1 :                 testData.method = getresponseheader_unsent_opened_state;
    1043                 :          1 : 
    1044                 :          1 :                 testData.skip = false;
    1045                 :          1 :                 suites.get(suiteDesc).push(testData);
    1046                 :          1 : 
    1047                 :          1 :         // TEST SUITE #12 - Response
    1048                 :          1 :         suiteDesc = 'Response';
    1049                 :          1 :         suites.set(suiteDesc, []);
    1050                 :          1 : 
    1051                 :          1 :                 // TEST 102 - transmitting two chunks TEST_CHUNK and then garbage, which should result in an error
    1052                 :          1 :                 testData = {};
    1053                 :          1 :                 testData.desc = 'transmitting two chunks TEST_CHUNK and then garbage, which should result in an error';
    1054                 :          1 :                 testData.method = response_body_errors;
    1055                 :          1 : 
    1056                 :          1 :                 testData.skip = false;
    1057                 :          1 :                 suites.get(suiteDesc).push(testData);
    1058                 :          1 : 
    1059                 :          1 :                 // TEST 103 - response - ArrayBuffer data
    1060                 :          1 :                 testData = {};
    1061                 :          1 :                 testData.desc = 'response - ArrayBuffer data';
    1062                 :          1 :                 testData.method = response_data_arraybuffer;
    1063                 :          1 : 
    1064                 :          1 :                 testData.skip = false;
    1065                 :          1 :                 suites.get(suiteDesc).push(testData);
    1066                 :          1 : 
    1067                 :          1 :                 // TEST 104 - response - Blob data
    1068                 :          1 :                 testData = {};
    1069                 :          1 :                 testData.desc = 'response - Blob data';
    1070                 :          1 :                 testData.method = response_data_blob;
    1071                 :          1 : 
    1072                 :          1 :                 testData.skip = false;
    1073                 :          1 :                 suites.get(suiteDesc).push(testData);
    1074                 :          1 : 
    1075                 :          1 :                 // TEST 105 - progress events grow response body size
    1076                 :          1 :                 testData = {};
    1077                 :          1 :                 testData.desc = 'progress events grow response body size';
    1078                 :          1 :                 testData.method = response_data_progress;
    1079                 :          1 : 
    1080                 :          1 :                 testData.skip = false;
    1081                 :          1 :                 suites.get(suiteDesc).push(testData);
    1082                 :          1 : 
    1083                 :          1 :                 // TEST 106 - responseType - is plain text if responseType is set to an invalid string
    1084                 :          1 :                 testData = {};
    1085                 :          1 :                 testData.desc = 'responseType - is plain text if responseType is set to an invalid string';
    1086                 :          1 :                 testData.method = response_invalid_responsetype;
    1087                 :          1 : 
    1088                 :          1 :                 testData.skip = false;
    1089                 :          1 :                 suites.get(suiteDesc).push(testData);
    1090                 :          1 : 
    1091                 :          1 :                 // TEST 107 - responseType - json
    1092                 :          1 :                 testData = {};
    1093                 :          1 :                 testData.desc = 'responseType - json';
    1094                 :          1 :                 testData.method = response_json;
    1095                 :          1 : 
    1096                 :          1 :                 testData.skip = false;
    1097                 :          1 :                 suites.get(suiteDesc).push(testData);
    1098                 :          1 : 
    1099                 :          1 :                 // TEST 108 - responseText - status
    1100                 :          1 :                 testData = {};
    1101                 :          1 :                 testData.desc = 'responseText - status';
    1102                 :          1 :                 testData.method = responsetext_status;
    1103                 :          1 : 
    1104                 :          1 :                 testData.skip = false;
    1105                 :          1 :                 suites.get(suiteDesc).push(testData);
    1106                 :          1 : 
    1107                 :          1 :                 // TEST 109 - responseText - decoding
    1108                 :          1 :                 testData = {};
    1109                 :          1 :                 testData.desc = 'responseText - decoding';
    1110                 :          1 :                 testData.method = responsetext_decoding;
    1111                 :          1 : 
    1112                 :          1 :                 testData.skip = false;
    1113                 :          1 :                 suites.get(suiteDesc).push(testData);
    1114                 :          1 : 
    1115                 :          1 :         // TEST SUITE #13 - Status
    1116                 :          1 :         suiteDesc = 'Status';
    1117                 :          1 :         suites.set(suiteDesc, []);
    1118                 :          1 : 
    1119                 :          1 :                 // TEST 110 - status/statusText - various responses
    1120                 :          1 :                 testData = {};
    1121                 :          1 :                 testData.desc = 'status/statusText - various responses';
    1122                 :          1 :                 testData.method = status_async;
    1123                 :          1 : 
    1124                 :          1 :                 testData.skip = false;
    1125                 :          1 :                 suites.get(suiteDesc).push(testData);
    1126                 :          1 : 
    1127                 :          1 :                 // TEST 111 - status/statusText - basic
    1128                 :          1 :                 testData = {};
    1129                 :          1 :                 testData.desc = 'status/statusText - basic';
    1130                 :          1 :                 testData.method = status_basic;
    1131                 :          1 : 
    1132                 :          1 :                 testData.skip = false;
    1133                 :          1 :                 suites.get(suiteDesc).push(testData);
    1134                 :          1 : 
    1135                 :          1 :                 // TEST 112 - status - error handling
    1136                 :          1 :                 testData = {};
    1137                 :          1 :                 testData.desc = 'status - error handling';
    1138                 :          1 :                 testData.method = status_error;
    1139                 :          1 : 
    1140                 :          1 :                 testData.skip = false;
    1141                 :          1 :                 suites.get(suiteDesc).push(testData);
    1142                 :          1 : 
    1143                 :          1 :         // TEST SUITE #14 - FormData
    1144                 :          1 :         suiteDesc = 'FormData';
    1145                 :          1 :         suites.set(suiteDesc, []);
    1146                 :          1 : 
    1147                 :          1 :                 // TEST 113 - XMLHttpRequest: Construct and upload FormData
    1148                 :          1 :                 testData = {};
    1149                 :          1 :                 testData.desc = 'XMLHttpRequest: Construct and upload FormData';
    1150                 :          1 :                 testData.method = formdata;
    1151                 :          1 : 
    1152                 :          1 :                 testData.skip = false;
    1153                 :          1 :                 suites.get(suiteDesc).push(testData);
    1154                 :          1 : 
    1155                 :          1 :                 // TEST 114 - FormData Constructor
    1156                 :          1 :                 testData = {};
    1157                 :          1 :                 testData.desc = 'FormData Constructor';
    1158                 :          1 :                 testData.method = formdata_constructor_any;
    1159                 :          1 : 
    1160                 :          1 :                 testData.skip = false;
    1161                 :          1 :                 suites.get(suiteDesc).push(testData);
    1162                 :          1 : 
    1163                 :          1 :                 // TEST 115 - FormData set
    1164                 :          1 :                 testData = {};
    1165                 :          1 :                 testData.desc = 'FormData set';
    1166                 :          1 :                 testData.method = formdata_set_any;
    1167                 :          1 : 
    1168                 :          1 :                 testData.skip = false;
    1169                 :          1 :                 suites.get(suiteDesc).push(testData);
    1170                 :          1 : 
    1171                 :          1 :                 // TEST 116 - FormData set-blob
    1172                 :          1 :                 testData = {};
    1173                 :          1 :                 testData.desc = 'FormData set-blob';
    1174                 :          1 :                 testData.method = formdata_set_blob_any;
    1175                 :          1 : 
    1176                 :          1 :                 testData.skip = false;
    1177                 :          1 :                 suites.get(suiteDesc).push(testData);
    1178                 :          1 : 
    1179                 :          1 :                 // TEST 117 - FormData get
    1180                 :          1 :                 testData = {};
    1181                 :          1 :                 testData.desc = 'FormData get';
    1182                 :          1 :                 testData.method = formdata_get_any;
    1183                 :          1 : 
    1184                 :          1 :                 testData.skip = false;
    1185                 :          1 :                 suites.get(suiteDesc).push(testData);
    1186                 :          1 : 
    1187                 :          1 :                 // TEST 118 - FormData append
    1188                 :          1 :                 testData = {};
    1189                 :          1 :                 testData.desc = 'FormData append';
    1190                 :          1 :                 testData.method = formdata_append_any;
    1191                 :          1 : 
    1192                 :          1 :                 testData.skip = false;
    1193                 :          1 :                 suites.get(suiteDesc).push(testData);
    1194                 :          1 : 
    1195                 :          1 :                 // TEST 119 - FormData delete
    1196                 :          1 :                 testData = {};
    1197                 :          1 :                 testData.desc = 'FormData delete';
    1198                 :          1 :                 testData.method = formdata_delete_any;
    1199                 :          1 : 
    1200                 :          1 :                 testData.skip = false;
    1201                 :          1 :                 suites.get(suiteDesc).push(testData);
    1202                 :          1 : 
    1203                 :          1 :                 // TEST 120 - FormData has
    1204                 :          1 :                 testData = {};
    1205                 :          1 :                 testData.desc = 'FormData has';
    1206                 :          1 :                 testData.method = formdata_has_any;
    1207                 :          1 : 
    1208                 :          1 :                 testData.skip = false;
    1209                 :          1 :                 suites.get(suiteDesc).push(testData);
    1210                 :          1 : 
    1211                 :          1 :                 // TEST 121 - FormData iteration
    1212                 :          1 :                 testData = {};
    1213                 :          1 :                 testData.desc = 'FormData iteration';
    1214                 :          1 :                 testData.method = formdata_iteration_any;
    1215                 :          1 : 
    1216                 :          1 :                 testData.skip = false;
    1217                 :          1 :                 suites.get(suiteDesc).push(testData);
    1218                 :          1 : 
    1219                 :          1 :                 // TEST 122 - FormData forEach
    1220                 :          1 :                 testData = {};
    1221                 :          1 :                 testData.desc = 'FormData forEach';
    1222                 :          1 :                 testData.method = formdata_foreach_any;
    1223                 :          1 : 
    1224                 :          1 :                 testData.skip = false;
    1225                 :          1 :                 suites.get(suiteDesc).push(testData);
    1226                 :          1 : 
    1227                 :          1 :         // TEST SUITE #15 - File
    1228                 :          1 :         suiteDesc = 'File';
    1229                 :          1 :         suites.set(suiteDesc, []);
    1230                 :          1 : 
    1231                 :          1 :                 // TEST 123 - File: Constructor
    1232                 :          1 :                 testData = {};
    1233                 :          1 :                 testData.desc = 'File: Constructor';
    1234                 :          1 :                 testData.method = File_constructor_any;
    1235                 :          1 : 
    1236                 :          1 :                 testData.skip = false;
    1237                 :          1 :                 suites.get(suiteDesc).push(testData);
    1238                 :          1 : 
    1239                 :          1 :                 // TEST 124 - File: Constructor endings
    1240                 :          1 :                 testData = {};
    1241                 :          1 :                 testData.desc = 'File: Constructor endings';
    1242                 :          1 :                 testData.method = File_constructor_endings;
    1243                 :          1 : 
    1244                 :          1 :                 testData.skip = false;
    1245                 :          1 :                 suites.get(suiteDesc).push(testData);
    1246                 :          1 : 
    1247                 :          1 :         // TEST SUITE #16 - Miscellaneous
    1248                 :          1 :         suiteDesc = 'Miscellaneous';
    1249                 :          1 :         suites.set(suiteDesc, []);
    1250                 :          1 : 
    1251                 :          1 :                 // TEST 125 - data URLs
    1252                 :          1 :                 testData = {};
    1253                 :          1 :                 testData.desc = 'data URLs';
    1254                 :          1 :                 testData.method = data_uri;
    1255                 :          1 : 
    1256                 :          1 :                 testData.skip = false;
    1257                 :          1 :                 suites.get(suiteDesc).push(testData);
    1258                 :          1 : 
    1259                 :          1 :                 // TEST 126 - historical features
    1260                 :          1 :                 testData = {};
    1261                 :          1 :                 testData.desc = 'historical features';
    1262                 :          1 :                 testData.method = historical;
    1263                 :          1 : 
    1264                 :          1 :                 testData.skip = false;
    1265                 :          1 :                 suites.get(suiteDesc).push(testData);
    1266                 :          1 : 
    1267                 :          1 :                 // TEST 127 - loadstart event corner cases
    1268                 :          1 :                 testData = {};
    1269                 :          1 :                 testData.desc = 'loadstart event corner cases';
    1270                 :          1 :                 testData.method = loadstart_and_state;
    1271                 :          1 : 
    1272                 :          1 :                 testData.skip = false;
    1273                 :          1 :                 suites.get(suiteDesc).push(testData);
    1274                 :          1 : }
    1275                 :          1 : 
    1276                 :          1 : /**
    1277                 :          1 :  * @func  nodeRunner
    1278                 :          1 :  * @param {object} runner - The node core module 'node:test' object
    1279                 :          1 :  * @desc  Carry out the loaded tests using node test runner
    1280                 :          1 :  */
    1281            [ + ]:          1 : function nodeRunner(runner){
    1282                 :          1 : 
    1283                 :          1 :         let startTime, success;
    1284                 :          1 : 
    1285            [ - ]:          1 :         if(cmdOptions.verbose){
    1286                 :          0 : 
    1287                 :          0 :                 const callbackBefore = () => {
    1288                 :          0 :                         process.stderr.write(`wptTest-${(++testCount).toString().padStart(3, '0')} ... `);
    1289                 :          0 :                         startTime = Date.now();
    1290                 :          0 :                         success = true;
    1291                 :          0 :                 };
    1292                 :          0 : 
    1293                 :          0 :                 const callbackAfter = (t) => {
    1294                 :          0 :                         let duration = Date.now() - startTime;
    1295                 :          0 :                         process.stderr.write(`${success ? 'success' : 'failure'} ... ${String(duration).padStart(6)} msec ... ${t.name}\n`);
    1296                 :          0 :                 };
    1297                 :          0 : 
    1298                 :          0 :                 runner.beforeEach(callbackBefore);
    1299                 :          0 :                 runner.afterEach(callbackAfter);
    1300                 :          0 :         }
    1301                 :          1 : 
    1302            [ + ]:          1 :         for(let [suiteDesc, suiteTests] of suites){
    1303            [ + ]:         16 :                 runner.suite(suiteDesc, () => {
    1304            [ + ]:         16 :                         for(let testObj of suiteTests){
    1305            [ + ]:        127 :                                 runner.test(testObj.desc, {skip: testObj.skip}, (t) => {
    1306            [ - ]:        127 :                                         if(cmdOptions.verbose){
    1307                 :          0 :                                                 try{
    1308                 :          0 :                                                         testObj.method(activeURL);
    1309                 :          0 :                                                 }
    1310                 :          0 :                                                 catch(err){
    1311                 :          0 :                                                         success = false; throw err;
    1312                 :          0 :                                                 }
    1313                 :          0 :                                         }
    1314                 :        127 :                                         else{
    1315                 :        127 :                                                 testObj.method(activeURL);
    1316                 :        127 :                                         }
    1317                 :        127 :                                 });
    1318                 :        127 :                         }
    1319                 :         16 :                 });
    1320                 :         16 :         }
    1321                 :          1 : }
    1322                 :          1 : 
    1323                 :          1 : /* node:coverage disable */
    1324                 :            : 
    1325                 :            : /**
    1326                 :            :  * @func  defRunner
    1327                 :            :  * @desc  Carry out the loaded tests using this developed test runner
    1328                 :            :  */
    1329                 :            : function defRunner(){
    1330                 :            : 
    1331                 :            :         let startTime, success;
    1332                 :            :         let callbackBefore, callbackAfter
    1333                 :            : 
    1334                 :            :         if(cmdOptions.verbose){
    1335                 :            :                 callbackBefore = () => {
    1336                 :            :                         process.stderr.write(`wptTest-${(++testCount).toString().padStart(3, '0')} ... `);
    1337                 :            :                         startTime = Date.now();
    1338                 :            :                         success = true;
    1339                 :            :                 };
    1340                 :            : 
    1341                 :            :                 callbackAfter = (testObj) => {
    1342                 :            :                         let duration = Date.now() - startTime;
    1343                 :            :                         process.stderr.write(`${success ? 'success' : 'failure'} ... ${String(duration).padStart(6)} msec ... ${testObj.desc}\n`);
    1344                 :            :                 };
    1345                 :            :         }
    1346                 :            : 
    1347                 :            :         cmdOptions.verbose && process.on('exit', () => {
    1348                 :            :                 console.log();
    1349                 :            :                 console.log('▶ tests',       testCount);
    1350                 :            :                 console.log('▶ suites',      suites.size);
    1351                 :            :                 console.log('▶ pass',        passCount);
    1352                 :            :                 console.log('▶ fail',        failCount);
    1353                 :            :                 console.log('▶ cancelled',   cancelCount);
    1354                 :            :                 console.log('▶ skipped',     skipCount);
    1355                 :            :                 console.log('▶ todo',        todoCount);
    1356                 :            :                 console.log('▶ duration_ms', Math.round(Date.now() - startTime));
    1357                 :            :         });
    1358                 :            : 
    1359                 :            :         cmdOptions.verbose && console.error();
    1360                 :            : 
    1361                 :            :         for(let [suiteDesc, suiteTests] of suites){
    1362                 :            :                 for(let testObj of suiteTests){
    1363                 :            :                         if(!testObj.skip){
    1364                 :            :                                 if(cmdOptions.verbose){
    1365                 :            :                                         callbackBefore();
    1366                 :            :                                         try{
    1367                 :            :                                                 testObj.method(activeURL);
    1368                 :            :                                                 ++passCount;
    1369                 :            :                                         }
    1370                 :            :                                         catch(err){
    1371                 :            :                                                 success = false;
    1372                 :            :                                                 ++failCount;
    1373                 :            :                                         }
    1374                 :            :                                         callbackAfter(testObj);
    1375                 :            :                                 }
    1376                 :            :                                 else{
    1377                 :            :                                         testObj.method(activeURL);
    1378                 :            :                                         ++passCount;
    1379                 :            :                                 }
    1380                 :            :                         }
    1381                 :            :                         else{
    1382                 :            :                                 ++skipCount;
    1383                 :            :                         }
    1384                 :            :                 }
    1385                 :            :         }
    1386                 :            : 
    1387                 :            :         cmdOptions.verbose && console.error();
    1388                 :            : }
    1389                 :            : 
    1390                 :            : /* node:coverage enable */
    1391                 :          1 : 
    1392                 :          1 : /**
    1393                 :          1 :  * @func splash
    1394                 :          1 :  * @desc The application splash screen
    1395                 :          1 :  */
    1396                 :          0 : function splash(){
    1397                 :          0 : 
    1398                 :          0 : const banner = String.raw`
    1399                 :          0 :   __   ____  __ _      _    _ _   _         _____                            _
    1400                 :          0 :   \ \ / /  \/  | |    | |  | | | | |       |  __ \                          | |
    1401                 :          0 :    \ V /| \  / | |    | |__| | |_| |_ _ __ | |__) |___  __ _ _   _  ___  ___| |_
    1402                 :          0 :     > < | |\/| | |    |  __  | __| __| '_ \|  _  // _ \/ _  | | | |/ _ \/ __| __|
    1403                 :          0 :    / . \| |  | | |____| |  | | |_| |_| |_) | | \ \  __/ (_| | |_| |  __/\__ \ |_
    1404                 :          0 :   /_/ \_\_|  |_|______|_|  |_|\__|\__| .__/|_|  \_\___|\__, |\__,_|\___||___/\__|
    1405                 :          0 :                                      | |                  | |
    1406                 :          0 :                                      |_|                  |_|
    1407                 :          0 : `;
    1408                 :          0 : 
    1409                 :          0 :         console.clear();
    1410                 :          0 :         console.log(banner);
    1411                 :          0 :         console.log();
    1412                 :          0 : 
    1413                 :          0 :         let url = new URL(activeURL);
    1414                 :          0 : 
    1415                 :          0 :         console.log();
    1416                 :          0 :         console.log(`▶ Test Server: ${url.host}`);
    1417                 :          0 :         console.log();
    1418                 :          0 : }
    1419                 :          1 : 
    1420                 :          1 : /*
    1421                 :          1 :  * imported - skipped
    1422                 :          1 :  *
    1423                 :          1 :  *    getallresponseheaders(activeURL);         // using insecure http parser is required
    1424                 :          1 :  *    open_during_abort_event(activeURL);
    1425                 :          1 :  *    open_during_abort_processing(activeURL);
    1426                 :          1 :  *    open_method_case_sensitive(activeURL);    // nodeJS http module always uppercase methods
    1427                 :          1 :  *    open_url_encoding(activeURL);             // results different from browser environment
    1428                 :          1 :  *    response_method(activeURL);               // using insecure http parser is required
    1429                 :          1 :  *    send_redirect_no_location(activeURL);     // requires xml parser
    1430                 :          1 :  *
    1431                 :          1 :  * imported - included but not fully tested
    1432                 :          1 :  *
    1433                 :          1 :  *    send_content_type_charset(activeURL);     // not fully tested
    1434                 :          1 :  *    setrequestheader_content_type(activeURL); // not fully tested - XMLDocument
    1435                 :          1 :  *    status_basic(activeURL);                  // not fully tested type=text/xml
    1436                 :          1 :  *
    1437                 :          1 :  * imported - tested but suspicious
    1438                 :          1 :  *
    1439                 :          1 :  *    response_data_progress(activeURL);        // failure with content-length not included
    1440                 :          1 :  *
    1441                 :          1 :  * imported - tested but to be revised
    1442                 :          1 :  *
    1443                 :          1 :  *    progressevent_interface(activeURL);       // revise/complete progressevent-interface.js
    1444                 :          1 :  *    open_open_send(activeURL);                // unknown failure
    1445                 :          1 :  */

Generated by: LCOV version 1.14