| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Include test fixture. | 5 // Include test fixture. |
| 6 GEN_INCLUDE(['net_internals_test.js']); | 6 GEN_INCLUDE(['net_internals_test.js']); |
| 7 | 7 |
| 8 // Anonymous namespace | 8 // Anonymous namespace |
| 9 (function() { | 9 (function() { |
| 10 | 10 |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 /** | 210 /** |
| 211 * Test case for a URLRequest. This includes custom formatting for load flags, | 211 * Test case for a URLRequest. This includes custom formatting for load flags, |
| 212 * request/response HTTP headers, dependent sources, as well as basic | 212 * request/response HTTP headers, dependent sources, as well as basic |
| 213 * indentation and grouping. Also makes sure that no extra event is logged | 213 * indentation and grouping. Also makes sure that no extra event is logged |
| 214 * for finished sources when there's a logCreationTime. | 214 * for finished sources when there's a logCreationTime. |
| 215 */ | 215 */ |
| 216 function painterTestURLRequest() { | 216 function painterTestURLRequest() { |
| 217 var testCase = {}; | 217 var testCase = {}; |
| 218 testCase.tickOffset = '1337911098446'; | 218 testCase.tickOffset = '1337911098446'; |
| 219 testCase.logCreationTime = 1338864634013; | 219 testCase.logCreationTime = 1338864634013; |
| 220 testCase.loadFlags = LoadFlag.MAIN_FRAME | LoadFlag.MAYBE_USER_GESTURE | | 220 testCase.loadFlags = LoadFlag.MAIN_FRAME_DEPRECATED | |
| 221 LoadFlag.MAYBE_USER_GESTURE | |
| 221 LoadFlag.VERIFY_EV_CERT; | 222 LoadFlag.VERIFY_EV_CERT; |
| 222 | 223 |
| 223 testCase.logEntries = [ | 224 testCase.logEntries = [ |
| 224 { | 225 { |
| 225 'phase': EventPhase.PHASE_BEGIN, | 226 'phase': EventPhase.PHASE_BEGIN, |
| 226 'source': { | 227 'source': { |
| 227 'id': 146, | 228 'id': 146, |
| 228 'type': EventSourceType.URL_REQUEST | 229 'type': EventSourceType.URL_REQUEST |
| 229 }, | 230 }, |
| 230 'time': '953534778', | 231 'time': '953534778', |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 'time': '953535567', | 759 'time': '953535567', |
| 759 'type': EventType.REQUEST_ALIVE | 760 'type': EventType.REQUEST_ALIVE |
| 760 } | 761 } |
| 761 ]; | 762 ]; |
| 762 | 763 |
| 763 testCase.expectedText = | 764 testCase.expectedText = |
| 764 't=1338864633224 [st= 0] +REQUEST_ALIVE [dt=789]\n' + | 765 't=1338864633224 [st= 0] +REQUEST_ALIVE [dt=789]\n' + |
| 765 't=1338864633238 [st= 14] URL_REQUEST_START_JOB [dt=8]\n' + | 766 't=1338864633238 [st= 14] URL_REQUEST_START_JOB [dt=8]\n' + |
| 766 ' --> load_flags = ' + | 767 ' --> load_flags = ' + |
| 767 testCase.loadFlags.toString() + | 768 testCase.loadFlags.toString() + |
| 768 ' (MAIN_FRAME | MAYBE_USER_GESTURE ' + | 769 ' (MAIN_FRAME_DEPRECATED | MAYBE_USER_GESTURE ' + |
| 769 '| VERIFY_EV_CERT)\n' + | 770 '| VERIFY_EV_CERT)\n' + |
| 770 ' --> method = "GET"\n' + | 771 ' --> method = "GET"\n' + |
| 771 ' --> priority = 4\n' + | 772 ' --> priority = 4\n' + |
| 772 ' --> url = "http://www.google.com/"\n' + | 773 ' --> url = "http://www.google.com/"\n' + |
| 773 't=1338864633248 [st= 24] +URL_REQUEST_START_JOB [dt=279]\n' + | 774 't=1338864633248 [st= 24] +URL_REQUEST_START_JOB [dt=279]\n' + |
| 774 ' --> load_flags = ' + | 775 ' --> load_flags = ' + |
| 775 testCase.loadFlags.toString() + | 776 testCase.loadFlags.toString() + |
| 776 ' (MAIN_FRAME | MAYBE_USER_GESTURE ' + | 777 ' (MAIN_FRAME_DEPRECATED | MAYBE_USER_GESTURE ' + |
| 777 '| VERIFY_EV_CERT)\n' + | 778 '| VERIFY_EV_CERT)\n' + |
| 778 ' --> method = "GET"\n' + | 779 ' --> method = "GET"\n' + |
| 779 ' --> priority = 4\n' + | 780 ' --> priority = 4\n' + |
| 780 ' --> url = "http://www.google.com/"\n' + | 781 ' --> url = "http://www.google.com/"\n' + |
| 781 't=1338864633255 [st= 31] HTTP_CACHE_GET_BACKEND [dt=1]\n' + | 782 't=1338864633255 [st= 31] HTTP_CACHE_GET_BACKEND [dt=1]\n' + |
| 782 't=1338864633257 [st= 33] HTTP_CACHE_OPEN_ENTRY [dt=5]\n' + | 783 't=1338864633257 [st= 33] HTTP_CACHE_OPEN_ENTRY [dt=5]\n' + |
| 783 't=1338864633263 [st= 39] HTTP_CACHE_ADD_TO_ENTRY [dt=1]\n' + | 784 't=1338864633263 [st= 39] HTTP_CACHE_ADD_TO_ENTRY [dt=1]\n' + |
| 784 't=1338864633269 [st= 45] HTTP_CACHE_READ_INFO [dt=4]\n' + | 785 't=1338864633269 [st= 45] HTTP_CACHE_READ_INFO [dt=4]\n' + |
| 785 't=1338864633276 [st= 52] +HTTP_STREAM_REQUEST [dt=72]\n' + | 786 't=1338864633276 [st= 52] +HTTP_STREAM_REQUEST [dt=72]\n' + |
| 786 't=1338864633344 [st=120] HTTP_STREAM_REQUEST_BOUND_TO_JOB\n' + | 787 't=1338864633344 [st=120] HTTP_STREAM_REQUEST_BOUND_TO_JOB\n' + |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 918 return testCase; | 919 return testCase; |
| 919 } | 920 } |
| 920 | 921 |
| 921 /** | 922 /** |
| 922 * Tests the custom formatting of net_errors across several different event | 923 * Tests the custom formatting of net_errors across several different event |
| 923 * types. | 924 * types. |
| 924 */ | 925 */ |
| 925 function painterTestNetError() { | 926 function painterTestNetError() { |
| 926 var testCase = {}; | 927 var testCase = {}; |
| 927 testCase.tickOffset = '1337911098446'; | 928 testCase.tickOffset = '1337911098446'; |
| 928 testCase.loadFlags = LoadFlag.MAIN_FRAME | LoadFlag.MAYBE_USER_GESTURE | | 929 testCase.loadFlags = LoadFlag.MAIN_FRAME_DEPRECATED | |
| 930 LoadFlag.MAYBE_USER_GESTURE | |
| 929 LoadFlag.VERIFY_EV_CERT; | 931 LoadFlag.VERIFY_EV_CERT; |
| 930 | 932 |
| 931 testCase.logEntries = [ | 933 testCase.logEntries = [ |
| 932 { | 934 { |
| 933 'phase': EventPhase.PHASE_BEGIN, | 935 'phase': EventPhase.PHASE_BEGIN, |
| 934 'source': { | 936 'source': { |
| 935 'id': 318, | 937 'id': 318, |
| 936 'type': EventSourceType.URL_REQUEST | 938 'type': EventSourceType.URL_REQUEST |
| 937 }, | 939 }, |
| 938 'time': '953675448', | 940 'time': '953675448', |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1094 'time': '953675923', | 1096 'time': '953675923', |
| 1095 'type': EventType.REQUEST_ALIVE | 1097 'type': EventType.REQUEST_ALIVE |
| 1096 } | 1098 } |
| 1097 ]; | 1099 ]; |
| 1098 | 1100 |
| 1099 testCase.expectedText = | 1101 testCase.expectedText = |
| 1100 't=1338864773894 [st= 0] +REQUEST_ALIVE [dt=475]\n' + | 1102 't=1338864773894 [st= 0] +REQUEST_ALIVE [dt=475]\n' + |
| 1101 't=1338864773901 [st= 7] URL_REQUEST_START_JOB [dt=5]\n' + | 1103 't=1338864773901 [st= 7] URL_REQUEST_START_JOB [dt=5]\n' + |
| 1102 ' --> load_flags = ' + | 1104 ' --> load_flags = ' + |
| 1103 testCase.loadFlags.toString() + | 1105 testCase.loadFlags.toString() + |
| 1104 ' (MAIN_FRAME | MAYBE_USER_GESTURE ' + | 1106 ' (MAIN_FRAME_DEPRECATED | MAYBE_USER_GESTURE ' + |
| 1105 '| VERIFY_EV_CERT)\n' + | 1107 '| VERIFY_EV_CERT)\n' + |
| 1106 ' --> method = "GET"\n' + | 1108 ' --> method = "GET"\n' + |
| 1107 ' --> priority = 4\n' + | 1109 ' --> priority = 4\n' + |
| 1108 ' --> url = "http://www.doesnotexistdomain.com/"\n' + | 1110 ' --> url = "http://www.doesnotexistdomain.com/"\n' + |
| 1109 't=1338864773906 [st= 12] +URL_REQUEST_START_JOB [dt=245]\n' + | 1111 't=1338864773906 [st= 12] +URL_REQUEST_START_JOB [dt=245]\n' + |
| 1110 ' --> load_flags = ' + | 1112 ' --> load_flags = ' + |
| 1111 testCase.loadFlags.toString() + | 1113 testCase.loadFlags.toString() + |
| 1112 ' (MAIN_FRAME | MAYBE_USER_GESTURE ' + | 1114 ' (MAIN_FRAME_DEPRECATED | MAYBE_USER_GESTURE ' + |
| 1113 '| VERIFY_EV_CERT)\n' + | 1115 '| VERIFY_EV_CERT)\n' + |
| 1114 ' --> method = "GET"\n' + | 1116 ' --> method = "GET"\n' + |
| 1115 ' --> priority = 4\n' + | 1117 ' --> priority = 4\n' + |
| 1116 ' --> url = "http://www.doesnotexistdomain.com/"\n' + | 1118 ' --> url = "http://www.doesnotexistdomain.com/"\n' + |
| 1117 't=1338864773915 [st= 21] HTTP_CACHE_GET_BACKEND [dt=0]\n' + | 1119 't=1338864773915 [st= 21] HTTP_CACHE_GET_BACKEND [dt=0]\n' + |
| 1118 't=1338864773915 [st= 21] HTTP_CACHE_OPEN_ENTRY [dt=1]\n' + | 1120 't=1338864773915 [st= 21] HTTP_CACHE_OPEN_ENTRY [dt=1]\n' + |
| 1119 ' --> net_error = -2 (ERR_FAILED)\n' + | 1121 ' --> net_error = -2 (ERR_FAILED)\n' + |
| 1120 't=1338864773917 [st= 23] HTTP_CACHE_CREATE_ENTRY [dt=2]\n' + | 1122 't=1338864773917 [st= 23] HTTP_CACHE_CREATE_ENTRY [dt=2]\n' + |
| 1121 't=1338864773919 [st= 25] HTTP_CACHE_ADD_TO_ENTRY [dt=1]\n' + | 1123 't=1338864773919 [st= 25] HTTP_CACHE_ADD_TO_ENTRY [dt=1]\n' + |
| 1122 't=1338864773920 [st= 26] HTTP_STREAM_REQUEST [dt=225]\n' + | 1124 't=1338864773920 [st= 26] HTTP_STREAM_REQUEST [dt=225]\n' + |
| (...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2081 return testCase; | 2083 return testCase; |
| 2082 } | 2084 } |
| 2083 | 2085 |
| 2084 /** | 2086 /** |
| 2085 * Tests the formatting of a URL request that was just finishing up when | 2087 * Tests the formatting of a URL request that was just finishing up when |
| 2086 * net-internals was opened. | 2088 * net-internals was opened. |
| 2087 */ | 2089 */ |
| 2088 function painterTestInProgressURLRequest() { | 2090 function painterTestInProgressURLRequest() { |
| 2089 var testCase = {}; | 2091 var testCase = {}; |
| 2090 testCase.tickOffset = '1337911098446'; | 2092 testCase.tickOffset = '1337911098446'; |
| 2091 testCase.loadFlags = LoadFlag.MAIN_FRAME | LoadFlag.MAYBE_USER_GESTURE | | 2093 testCase.loadFlags = LoadFlag.MAIN_FRAME_DEPRECATED | |
| 2094 LoadFlag.MAYBE_USER_GESTURE | |
| 2092 LoadFlag.VERIFY_EV_CERT; | 2095 LoadFlag.VERIFY_EV_CERT; |
| 2093 | 2096 |
| 2094 testCase.logEntries = [ | 2097 testCase.logEntries = [ |
| 2095 { | 2098 { |
| 2096 'params': { | 2099 'params': { |
| 2097 'load_flags': testCase.loadFlags, | 2100 'load_flags': testCase.loadFlags, |
| 2098 'load_state': LoadState.READING_RESPONSE, | 2101 'load_state': LoadState.READING_RESPONSE, |
| 2099 'method': 'GET', | 2102 'method': 'GET', |
| 2100 'url': 'http://www.MagicPonyShopper.com' | 2103 'url': 'http://www.MagicPonyShopper.com' |
| 2101 }, | 2104 }, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2133 }, | 2136 }, |
| 2134 'time': '953675923', | 2137 'time': '953675923', |
| 2135 'type': EventType.REQUEST_ALIVE | 2138 'type': EventType.REQUEST_ALIVE |
| 2136 } | 2139 } |
| 2137 ]; | 2140 ]; |
| 2138 | 2141 |
| 2139 testCase.expectedText = | 2142 testCase.expectedText = |
| 2140 't=1338864773994 [st= 0] +REQUEST_ALIVE [dt=375]\n' + | 2143 't=1338864773994 [st= 0] +REQUEST_ALIVE [dt=375]\n' + |
| 2141 ' --> load_flags = ' + | 2144 ' --> load_flags = ' + |
| 2142 testCase.loadFlags.toString() + | 2145 testCase.loadFlags.toString() + |
| 2143 ' (MAIN_FRAME | MAYBE_USER_GESTURE ' + | 2146 ' (MAIN_FRAME_DEPRECATED | MAYBE_USER_GESTURE ' + |
| 2144 '| VERIFY_EV_CERT)\n' + | 2147 '| VERIFY_EV_CERT)\n' + |
| 2145 ' --> load_state = ' + LoadState.READING_RESPONSE + | 2148 ' --> load_state = ' + LoadState.READING_RESPONSE + |
| 2146 ' (READING_RESPONSE)\n' + | 2149 ' (READING_RESPONSE)\n' + |
| 2147 ' --> method = "GET"\n' + | 2150 ' --> method = "GET"\n' + |
| 2148 ' --> url = "http://www.MagicPonyShopper.com"\n' + | 2151 ' --> url = "http://www.MagicPonyShopper.com"\n' + |
| 2149 't=1338864774145 [st=151] -HTTP_STREAM_REQUEST\n' + | 2152 't=1338864774145 [st=151] -HTTP_STREAM_REQUEST\n' + |
| 2150 't=1338864774151 [st=157] -URL_REQUEST_START_JOB\n' + | 2153 't=1338864774151 [st=157] -URL_REQUEST_START_JOB\n' + |
| 2151 't=1338864774369 [st=375] -REQUEST_ALIVE'; | 2154 't=1338864774369 [st=375] -REQUEST_ALIVE'; |
| 2152 | 2155 |
| 2153 return testCase; | 2156 return testCase; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2195 | 2198 |
| 2196 testCase.expectedText = | 2199 testCase.expectedText = |
| 2197 't= 2 [st= 0] +REQUEST_ALIVE [dt=789+]\n' + | 2200 't= 2 [st= 0] +REQUEST_ALIVE [dt=789+]\n' + |
| 2198 't=152 [st=150] HTTP_STREAM_REQUEST [dt=1]\n' + | 2201 't=152 [st=150] HTTP_STREAM_REQUEST [dt=1]\n' + |
| 2199 't=791 [st=789]'; | 2202 't=791 [st=789]'; |
| 2200 | 2203 |
| 2201 return testCase; | 2204 return testCase; |
| 2202 } | 2205 } |
| 2203 | 2206 |
| 2204 })(); // Anonymous namespace | 2207 })(); // Anonymous namespace |
| OLD | NEW |