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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 /** | 182 /** |
183 * Test case for a URLRequest. This includes custom formatting for load flags, | 183 * Test case for a URLRequest. This includes custom formatting for load flags, |
184 * request/response HTTP headers, dependent sources, as well as basic | 184 * request/response HTTP headers, dependent sources, as well as basic |
185 * indentation and grouping. Also makes sure that no extra event is logged | 185 * indentation and grouping. Also makes sure that no extra event is logged |
186 * for finished sources when there's a logCreationTime. | 186 * for finished sources when there's a logCreationTime. |
187 */ | 187 */ |
188 function painterTestURLRequest() { | 188 function painterTestURLRequest() { |
189 var testCase = {}; | 189 var testCase = {}; |
190 testCase.tickOffset = '1337911098446'; | 190 testCase.tickOffset = '1337911098446'; |
191 testCase.logCreationTime = 1338864634013; | 191 testCase.logCreationTime = 1338864634013; |
192 testCase.loadFlags = LoadFlag.MAIN_FRAME | LoadFlag.MAYBE_USER_GESTURE | | |
193 LoadFlag.VERIFY_EV_CERT; | |
194 | 192 |
195 testCase.logEntries = [ | 193 testCase.logEntries = [ |
196 { | 194 { |
197 'phase': EventPhase.PHASE_BEGIN, | 195 'phase': EventPhase.PHASE_BEGIN, |
198 'source': { | 196 'source': { |
199 'id': 146, | 197 'id': 146, |
200 'type': EventSourceType.URL_REQUEST | 198 'type': EventSourceType.URL_REQUEST |
201 }, | 199 }, |
202 'time': '953534778', | 200 'time': '953534778', |
203 'type': EventType.REQUEST_ALIVE | 201 'type': EventType.REQUEST_ALIVE |
204 }, | 202 }, |
205 { | 203 { |
206 'params': { | 204 'params': { |
207 'load_flags': testCase.loadFlags, | 205 'load_flags': 68222976, |
208 'method': 'GET', | 206 'method': 'GET', |
209 'priority': 4, | 207 'priority': 4, |
210 'url': 'http://www.google.com/' | 208 'url': 'http://www.google.com/' |
211 }, | 209 }, |
212 'phase': EventPhase.PHASE_BEGIN, | 210 'phase': EventPhase.PHASE_BEGIN, |
213 'source': { | 211 'source': { |
214 'id': 146, | 212 'id': 146, |
215 'type': EventSourceType.URL_REQUEST | 213 'type': EventSourceType.URL_REQUEST |
216 }, | 214 }, |
217 'time': '953534792', | 215 'time': '953534792', |
218 'type': EventType.URL_REQUEST_START_JOB | 216 'type': EventType.URL_REQUEST_START_JOB |
219 }, | 217 }, |
220 { | 218 { |
221 'phase': EventPhase.PHASE_END, | 219 'phase': EventPhase.PHASE_END, |
222 'source': { | 220 'source': { |
223 'id': 146, | 221 'id': 146, |
224 'type': EventSourceType.URL_REQUEST | 222 'type': EventSourceType.URL_REQUEST |
225 }, | 223 }, |
226 'time': '953534800', | 224 'time': '953534800', |
227 'type': EventType.URL_REQUEST_START_JOB | 225 'type': EventType.URL_REQUEST_START_JOB |
228 }, | 226 }, |
229 { | 227 { |
230 'params': { | 228 'params': { |
231 'load_flags': testCase.loadFlags, | 229 'load_flags': 68222976, |
232 'method': 'GET', | 230 'method': 'GET', |
233 'priority': 4, | 231 'priority': 4, |
234 'url': 'http://www.google.com/' | 232 'url': 'http://www.google.com/' |
235 }, | 233 }, |
236 'phase': EventPhase.PHASE_BEGIN, | 234 'phase': EventPhase.PHASE_BEGIN, |
237 'source': { | 235 'source': { |
238 'id': 146, | 236 'id': 146, |
239 'type': EventSourceType.URL_REQUEST | 237 'type': EventSourceType.URL_REQUEST |
240 }, | 238 }, |
241 'time': '953534802', | 239 'time': '953534802', |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 'type': EventSourceType.URL_REQUEST | 726 'type': EventSourceType.URL_REQUEST |
729 }, | 727 }, |
730 'time': '953535567', | 728 'time': '953535567', |
731 'type': EventType.REQUEST_ALIVE | 729 'type': EventType.REQUEST_ALIVE |
732 } | 730 } |
733 ]; | 731 ]; |
734 | 732 |
735 testCase.expectedText = | 733 testCase.expectedText = |
736 't=1338864633224 [st= 0] +REQUEST_ALIVE [dt=789]\n' + | 734 't=1338864633224 [st= 0] +REQUEST_ALIVE [dt=789]\n' + |
737 't=1338864633238 [st= 14] URL_REQUEST_START_JOB [dt=8]\n' + | 735 't=1338864633238 [st= 14] URL_REQUEST_START_JOB [dt=8]\n' + |
738 ' --> load_flags = ' + | 736 ' --> load_flags = 68222976 ' + |
739 testCase.loadFlags.toString() + | 737 '(MAIN_FRAME | MAYBE_USER_GESTURE ' + |
740 ' (MAIN_FRAME | MAYBE_USER_GESTURE ' + | |
741 '| VERIFY_EV_CERT)\n' + | 738 '| VERIFY_EV_CERT)\n' + |
742 ' --> method = "GET"\n' + | 739 ' --> method = "GET"\n' + |
743 ' --> priority = 4\n' + | 740 ' --> priority = 4\n' + |
744 ' --> url = "http://www.google.com/"\n' + | 741 ' --> url = "http://www.google.com/"\n' + |
745 't=1338864633248 [st= 24] +URL_REQUEST_START_JOB [dt=279]\n' + | 742 't=1338864633248 [st= 24] +URL_REQUEST_START_JOB [dt=279]\n' + |
746 ' --> load_flags = ' + | 743 ' --> load_flags = 68222976 ' + |
747 testCase.loadFlags.toString() + | 744 '(MAIN_FRAME | MAYBE_USER_GESTURE ' + |
748 ' (MAIN_FRAME | MAYBE_USER_GESTURE ' + | |
749 '| VERIFY_EV_CERT)\n' + | 745 '| VERIFY_EV_CERT)\n' + |
750 ' --> method = "GET"\n' + | 746 ' --> method = "GET"\n' + |
751 ' --> priority = 4\n' + | 747 ' --> priority = 4\n' + |
752 ' --> url = "http://www.google.com/"\n' + | 748 ' --> url = "http://www.google.com/"\n' + |
753 't=1338864633255 [st= 31] HTTP_CACHE_GET_BACKEND [dt=1]\n' + | 749 't=1338864633255 [st= 31] HTTP_CACHE_GET_BACKEND [dt=1]\n' + |
754 't=1338864633257 [st= 33] HTTP_CACHE_OPEN_ENTRY [dt=5]\n' + | 750 't=1338864633257 [st= 33] HTTP_CACHE_OPEN_ENTRY [dt=5]\n' + |
755 't=1338864633263 [st= 39] HTTP_CACHE_ADD_TO_ENTRY [dt=1]\n' + | 751 't=1338864633263 [st= 39] HTTP_CACHE_ADD_TO_ENTRY [dt=1]\n' + |
756 't=1338864633269 [st= 45] HTTP_CACHE_READ_INFO [dt=4]\n' + | 752 't=1338864633269 [st= 45] HTTP_CACHE_READ_INFO [dt=4]\n' + |
757 't=1338864633276 [st= 52] +HTTP_STREAM_REQUEST [dt=72]\n' + | 753 't=1338864633276 [st= 52] +HTTP_STREAM_REQUEST [dt=72]\n' + |
758 't=1338864633344 [st=120] HTTP_STREAM_REQUEST_BOUND_TO_JOB\n' + | 754 't=1338864633344 [st=120] HTTP_STREAM_REQUEST_BOUND_TO_JOB\n' + |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
890 return testCase; | 886 return testCase; |
891 } | 887 } |
892 | 888 |
893 /** | 889 /** |
894 * Tests the custom formatting of net_errors across several different event | 890 * Tests the custom formatting of net_errors across several different event |
895 * types. | 891 * types. |
896 */ | 892 */ |
897 function painterTestNetError() { | 893 function painterTestNetError() { |
898 var testCase = {}; | 894 var testCase = {}; |
899 testCase.tickOffset = '1337911098446'; | 895 testCase.tickOffset = '1337911098446'; |
900 testCase.loadFlags = LoadFlag.MAIN_FRAME | LoadFlag.MAYBE_USER_GESTURE | | |
901 LoadFlag.VERIFY_EV_CERT; | |
902 | 896 |
903 testCase.logEntries = [ | 897 testCase.logEntries = [ |
904 { | 898 { |
905 'phase': EventPhase.PHASE_BEGIN, | 899 'phase': EventPhase.PHASE_BEGIN, |
906 'source': { | 900 'source': { |
907 'id': 318, | 901 'id': 318, |
908 'type': EventSourceType.URL_REQUEST | 902 'type': EventSourceType.URL_REQUEST |
909 }, | 903 }, |
910 'time': '953675448', | 904 'time': '953675448', |
911 'type': EventType.REQUEST_ALIVE | 905 'type': EventType.REQUEST_ALIVE |
912 }, | 906 }, |
913 { | 907 { |
914 'params': { | 908 'params': { |
915 'load_flags': testCase.loadFlags, | 909 'load_flags': 68222976, |
916 'method': 'GET', | 910 'method': 'GET', |
917 'priority': 4, | 911 'priority': 4, |
918 'url': 'http://www.doesnotexistdomain.com/' | 912 'url': 'http://www.doesnotexistdomain.com/' |
919 }, | 913 }, |
920 'phase': EventPhase.PHASE_BEGIN, | 914 'phase': EventPhase.PHASE_BEGIN, |
921 'source': { | 915 'source': { |
922 'id': 318, | 916 'id': 318, |
923 'type': EventSourceType.URL_REQUEST | 917 'type': EventSourceType.URL_REQUEST |
924 }, | 918 }, |
925 'time': '953675455', | 919 'time': '953675455', |
926 'type': EventType.URL_REQUEST_START_JOB | 920 'type': EventType.URL_REQUEST_START_JOB |
927 }, | 921 }, |
928 { | 922 { |
929 'phase': EventPhase.PHASE_END, | 923 'phase': EventPhase.PHASE_END, |
930 'source': { | 924 'source': { |
931 'id': 318, | 925 'id': 318, |
932 'type': EventSourceType.URL_REQUEST | 926 'type': EventSourceType.URL_REQUEST |
933 }, | 927 }, |
934 'time': '953675460', | 928 'time': '953675460', |
935 'type': EventType.URL_REQUEST_START_JOB | 929 'type': EventType.URL_REQUEST_START_JOB |
936 }, | 930 }, |
937 { | 931 { |
938 'params': { | 932 'params': { |
939 'load_flags': testCase.loadFlags, | 933 'load_flags': 68222976, |
940 'method': 'GET', | 934 'method': 'GET', |
941 'priority': 4, | 935 'priority': 4, |
942 'url': 'http://www.doesnotexistdomain.com/' | 936 'url': 'http://www.doesnotexistdomain.com/' |
943 }, | 937 }, |
944 'phase': EventPhase.PHASE_BEGIN, | 938 'phase': EventPhase.PHASE_BEGIN, |
945 'source': { | 939 'source': { |
946 'id': 318, | 940 'id': 318, |
947 'type': EventSourceType.URL_REQUEST | 941 'type': EventSourceType.URL_REQUEST |
948 }, | 942 }, |
949 'time': '953675460', | 943 'time': '953675460', |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1064 'type': EventSourceType.URL_REQUEST | 1058 'type': EventSourceType.URL_REQUEST |
1065 }, | 1059 }, |
1066 'time': '953675923', | 1060 'time': '953675923', |
1067 'type': EventType.REQUEST_ALIVE | 1061 'type': EventType.REQUEST_ALIVE |
1068 } | 1062 } |
1069 ]; | 1063 ]; |
1070 | 1064 |
1071 testCase.expectedText = | 1065 testCase.expectedText = |
1072 't=1338864773894 [st= 0] +REQUEST_ALIVE [dt=475]\n' + | 1066 't=1338864773894 [st= 0] +REQUEST_ALIVE [dt=475]\n' + |
1073 't=1338864773901 [st= 7] URL_REQUEST_START_JOB [dt=5]\n' + | 1067 't=1338864773901 [st= 7] URL_REQUEST_START_JOB [dt=5]\n' + |
1074 ' --> load_flags = ' + | 1068 ' --> load_flags = 68222976 (' + |
1075 testCase.loadFlags.toString() + | 1069 'MAIN_FRAME | MAYBE_USER_GESTURE ' + |
1076 ' (MAIN_FRAME | MAYBE_USER_GESTURE ' + | |
1077 '| VERIFY_EV_CERT)\n' + | 1070 '| VERIFY_EV_CERT)\n' + |
1078 ' --> method = "GET"\n' + | 1071 ' --> method = "GET"\n' + |
1079 ' --> priority = 4\n' + | 1072 ' --> priority = 4\n' + |
1080 ' --> url = "http://www.doesnotexistdomain.com/"\n' + | 1073 ' --> url = "http://www.doesnotexistdomain.com/"\n' + |
1081 't=1338864773906 [st= 12] +URL_REQUEST_START_JOB [dt=245]\n' + | 1074 't=1338864773906 [st= 12] +URL_REQUEST_START_JOB [dt=245]\n' + |
1082 ' --> load_flags = ' + | 1075 ' --> load_flags = 68222976 (' + |
1083 testCase.loadFlags.toString() + | 1076 'MAIN_FRAME | MAYBE_USER_GESTURE ' + |
1084 ' (MAIN_FRAME | MAYBE_USER_GESTURE ' + | |
1085 '| VERIFY_EV_CERT)\n' + | 1077 '| VERIFY_EV_CERT)\n' + |
1086 ' --> method = "GET"\n' + | 1078 ' --> method = "GET"\n' + |
1087 ' --> priority = 4\n' + | 1079 ' --> priority = 4\n' + |
1088 ' --> url = "http://www.doesnotexistdomain.com/"\n' + | 1080 ' --> url = "http://www.doesnotexistdomain.com/"\n' + |
1089 't=1338864773915 [st= 21] HTTP_CACHE_GET_BACKEND [dt=0]\n' + | 1081 't=1338864773915 [st= 21] HTTP_CACHE_GET_BACKEND [dt=0]\n' + |
1090 't=1338864773915 [st= 21] HTTP_CACHE_OPEN_ENTRY [dt=1]\n' + | 1082 't=1338864773915 [st= 21] HTTP_CACHE_OPEN_ENTRY [dt=1]\n' + |
1091 ' --> net_error = -2 (ERR_FAILED)\n' + | 1083 ' --> net_error = -2 (ERR_FAILED)\n' + |
1092 't=1338864773917 [st= 23] HTTP_CACHE_CREATE_ENTRY [dt=2]\n' + | 1084 't=1338864773917 [st= 23] HTTP_CACHE_CREATE_ENTRY [dt=2]\n' + |
1093 't=1338864773919 [st= 25] HTTP_CACHE_ADD_TO_ENTRY [dt=1]\n' + | 1085 't=1338864773919 [st= 25] HTTP_CACHE_ADD_TO_ENTRY [dt=1]\n' + |
1094 't=1338864773920 [st= 26] HTTP_STREAM_REQUEST [dt=225]\n' + | 1086 't=1338864773920 [st= 26] HTTP_STREAM_REQUEST [dt=225]\n' + |
(...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2048 return testCase; | 2040 return testCase; |
2049 } | 2041 } |
2050 | 2042 |
2051 /** | 2043 /** |
2052 * Tests the formatting of a URL request that was just finishing up when | 2044 * Tests the formatting of a URL request that was just finishing up when |
2053 * net-internals was opened. | 2045 * net-internals was opened. |
2054 */ | 2046 */ |
2055 function painterTestInProgressURLRequest() { | 2047 function painterTestInProgressURLRequest() { |
2056 var testCase = {}; | 2048 var testCase = {}; |
2057 testCase.tickOffset = '1337911098446'; | 2049 testCase.tickOffset = '1337911098446'; |
2058 testCase.loadFlags = LoadFlag.MAIN_FRAME | LoadFlag.MAYBE_USER_GESTURE | | |
2059 LoadFlag.VERIFY_EV_CERT; | |
2060 | 2050 |
2061 testCase.logEntries = [ | 2051 testCase.logEntries = [ |
2062 { | 2052 { |
2063 'params': { | 2053 'params': { |
2064 'load_flags': testCase.loadFlags, | 2054 'load_flags': 68222976, |
2065 'load_state': LoadState.READING_RESPONSE, | 2055 'load_state': LoadState.READING_RESPONSE, |
2066 'method': 'GET', | 2056 'method': 'GET', |
2067 'url': 'http://www.MagicPonyShopper.com' | 2057 'url': 'http://www.MagicPonyShopper.com' |
2068 }, | 2058 }, |
2069 'phase': EventPhase.PHASE_BEGIN, | 2059 'phase': EventPhase.PHASE_BEGIN, |
2070 'source': { | 2060 'source': { |
2071 'id': 318, | 2061 'id': 318, |
2072 'type': EventSourceType.URL_REQUEST | 2062 'type': EventSourceType.URL_REQUEST |
2073 }, | 2063 }, |
2074 'time': '953675548', | 2064 'time': '953675548', |
(...skipping 23 matching lines...) Expand all Loading... |
2098 'id': 318, | 2088 'id': 318, |
2099 'type': EventSourceType.URL_REQUEST | 2089 'type': EventSourceType.URL_REQUEST |
2100 }, | 2090 }, |
2101 'time': '953675923', | 2091 'time': '953675923', |
2102 'type': EventType.REQUEST_ALIVE | 2092 'type': EventType.REQUEST_ALIVE |
2103 } | 2093 } |
2104 ]; | 2094 ]; |
2105 | 2095 |
2106 testCase.expectedText = | 2096 testCase.expectedText = |
2107 't=1338864773994 [st= 0] +REQUEST_ALIVE [dt=375]\n' + | 2097 't=1338864773994 [st= 0] +REQUEST_ALIVE [dt=375]\n' + |
2108 ' --> load_flags = ' + | 2098 ' --> load_flags = 68222976 ' + |
2109 testCase.loadFlags.toString() + | 2099 '(MAIN_FRAME | MAYBE_USER_GESTURE ' + |
2110 ' (MAIN_FRAME | MAYBE_USER_GESTURE ' + | |
2111 '| VERIFY_EV_CERT)\n' + | 2100 '| VERIFY_EV_CERT)\n' + |
2112 ' --> load_state = ' + LoadState.READING_RESPONSE + | 2101 ' --> load_state = ' + LoadState.READING_RESPONSE + |
2113 ' (READING_RESPONSE)\n' + | 2102 ' (READING_RESPONSE)\n' + |
2114 ' --> method = "GET"\n' + | 2103 ' --> method = "GET"\n' + |
2115 ' --> url = "http://www.MagicPonyShopper.com"\n' + | 2104 ' --> url = "http://www.MagicPonyShopper.com"\n' + |
2116 't=1338864774145 [st=151] -HTTP_STREAM_REQUEST\n' + | 2105 't=1338864774145 [st=151] -HTTP_STREAM_REQUEST\n' + |
2117 't=1338864774151 [st=157] -URL_REQUEST_START_JOB\n' + | 2106 't=1338864774151 [st=157] -URL_REQUEST_START_JOB\n' + |
2118 't=1338864774369 [st=375] -REQUEST_ALIVE'; | 2107 't=1338864774369 [st=375] -REQUEST_ALIVE'; |
2119 | 2108 |
2120 return testCase; | 2109 return testCase; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2162 | 2151 |
2163 testCase.expectedText = | 2152 testCase.expectedText = |
2164 't= 2 [st= 0] +REQUEST_ALIVE [dt=789+]\n' + | 2153 't= 2 [st= 0] +REQUEST_ALIVE [dt=789+]\n' + |
2165 't=152 [st=150] HTTP_STREAM_REQUEST [dt=1]\n' + | 2154 't=152 [st=150] HTTP_STREAM_REQUEST [dt=1]\n' + |
2166 't=791 [st=789]'; | 2155 't=791 [st=789]'; |
2167 | 2156 |
2168 return testCase; | 2157 return testCase; |
2169 } | 2158 } |
2170 | 2159 |
2171 })(); // Anonymous namespace | 2160 })(); // Anonymous namespace |
OLD | NEW |