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