Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(444)

Side by Side Diff: chrome/test/data/webui/net_internals/log_view_painter.js

Issue 12310075: Cache failover to LOAD_PREFERRING_CACHE if network response suggests offline. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed net-internals test. Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | net/base/load_flags_list.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
182 'phase': EventPhase.PHASE_BEGIN, 182 'phase': EventPhase.PHASE_BEGIN,
183 'source': { 183 'source': {
184 'id': 146, 184 'id': 146,
185 'type': EventSourceType.URL_REQUEST 185 'type': EventSourceType.URL_REQUEST
186 }, 186 },
187 'time': '953534778', 187 'time': '953534778',
188 'type': EventType.REQUEST_ALIVE 188 'type': EventType.REQUEST_ALIVE
189 }, 189 },
190 { 190 {
191 'params': { 191 'params': {
192 'load_flags': 68223104, 192 'load_flags': 136446208,
193 'method': 'GET', 193 'method': 'GET',
194 'priority': 4, 194 'priority': 4,
195 'url': 'http://www.google.com/' 195 'url': 'http://www.google.com/'
196 }, 196 },
197 'phase': EventPhase.PHASE_BEGIN, 197 'phase': EventPhase.PHASE_BEGIN,
198 'source': { 198 'source': {
199 'id': 146, 199 'id': 146,
200 'type': EventSourceType.URL_REQUEST 200 'type': EventSourceType.URL_REQUEST
201 }, 201 },
202 'time': '953534792', 202 'time': '953534792',
203 'type': EventType.URL_REQUEST_START_JOB 203 'type': EventType.URL_REQUEST_START_JOB
204 }, 204 },
205 { 205 {
206 'phase': EventPhase.PHASE_END, 206 'phase': EventPhase.PHASE_END,
207 'source': { 207 'source': {
208 'id': 146, 208 'id': 146,
209 'type': EventSourceType.URL_REQUEST 209 'type': EventSourceType.URL_REQUEST
210 }, 210 },
211 'time': '953534800', 211 'time': '953534800',
212 'type': EventType.URL_REQUEST_START_JOB 212 'type': EventType.URL_REQUEST_START_JOB
213 }, 213 },
214 { 214 {
215 'params': { 215 'params': {
216 'load_flags': 68223104, 216 'load_flags': 136446208,
217 'method': 'GET', 217 'method': 'GET',
218 'priority': 4, 218 'priority': 4,
219 'url': 'http://www.google.com/' 219 'url': 'http://www.google.com/'
220 }, 220 },
221 'phase': EventPhase.PHASE_BEGIN, 221 'phase': EventPhase.PHASE_BEGIN,
222 'source': { 222 'source': {
223 'id': 146, 223 'id': 146,
224 'type': EventSourceType.URL_REQUEST 224 'type': EventSourceType.URL_REQUEST
225 }, 225 },
226 'time': '953534802', 226 'time': '953534802',
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 'type': EventSourceType.URL_REQUEST 713 'type': EventSourceType.URL_REQUEST
714 }, 714 },
715 'time': '953535567', 715 'time': '953535567',
716 'type': EventType.REQUEST_ALIVE 716 'type': EventType.REQUEST_ALIVE
717 } 717 }
718 ]; 718 ];
719 719
720 testCase.expectedText = 720 testCase.expectedText =
721 't=1338864633224 [st= 0] +REQUEST_ALIVE [dt=789]\n' + 721 't=1338864633224 [st= 0] +REQUEST_ALIVE [dt=789]\n' +
722 't=1338864633238 [st= 14] URL_REQUEST_START_JOB [dt=8]\n' + 722 't=1338864633238 [st= 14] URL_REQUEST_START_JOB [dt=8]\n' +
723 ' --> load_flags = 68223104 ' + 723 ' --> load_flags = 136446208 ' +
724 '(ENABLE_LOAD_TIMING | MAIN_FRAME | MAYBE_USER_GESTURE ' + 724 '(ENABLE_LOAD_TIMING | MAIN_FRAME | MAYBE_USER_GESTURE ' +
725 '| VERIFY_EV_CERT)\n' + 725 '| VERIFY_EV_CERT)\n' +
726 ' --> method = "GET"\n' + 726 ' --> method = "GET"\n' +
727 ' --> priority = 4\n' + 727 ' --> priority = 4\n' +
728 ' --> url = "http://www.google.com/"\n' + 728 ' --> url = "http://www.google.com/"\n' +
729 't=1338864633248 [st= 24] +URL_REQUEST_START_JOB [dt=279]\n' + 729 't=1338864633248 [st= 24] +URL_REQUEST_START_JOB [dt=279]\n' +
730 ' --> load_flags = 68223104 ' + 730 ' --> load_flags = 136446208 ' +
731 '(ENABLE_LOAD_TIMING | MAIN_FRAME | MAYBE_USER_GESTURE ' + 731 '(ENABLE_LOAD_TIMING | MAIN_FRAME | MAYBE_USER_GESTURE ' +
732 '| VERIFY_EV_CERT)\n' + 732 '| VERIFY_EV_CERT)\n' +
733 ' --> method = "GET"\n' + 733 ' --> method = "GET"\n' +
734 ' --> priority = 4\n' + 734 ' --> priority = 4\n' +
735 ' --> url = "http://www.google.com/"\n' + 735 ' --> url = "http://www.google.com/"\n' +
736 't=1338864633255 [st= 31] HTTP_CACHE_GET_BACKEND [dt=1]\n' + 736 't=1338864633255 [st= 31] HTTP_CACHE_GET_BACKEND [dt=1]\n' +
737 't=1338864633257 [st= 33] HTTP_CACHE_OPEN_ENTRY [dt=5]\n' + 737 't=1338864633257 [st= 33] HTTP_CACHE_OPEN_ENTRY [dt=5]\n' +
738 't=1338864633263 [st= 39] HTTP_CACHE_ADD_TO_ENTRY [dt=1]\n' + 738 't=1338864633263 [st= 39] HTTP_CACHE_ADD_TO_ENTRY [dt=1]\n' +
739 't=1338864633269 [st= 45] HTTP_CACHE_READ_INFO [dt=4]\n' + 739 't=1338864633269 [st= 45] HTTP_CACHE_READ_INFO [dt=4]\n' +
740 't=1338864633276 [st= 52] +HTTP_STREAM_REQUEST [dt=72]\n' + 740 't=1338864633276 [st= 52] +HTTP_STREAM_REQUEST [dt=72]\n' +
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 'phase': EventPhase.PHASE_BEGIN, 799 'phase': EventPhase.PHASE_BEGIN,
800 'source': { 800 'source': {
801 'id': 146, 801 'id': 146,
802 'type': EventSourceType.URL_REQUEST 802 'type': EventSourceType.URL_REQUEST
803 }, 803 },
804 'time': '953534778', 804 'time': '953534778',
805 'type': EventType.REQUEST_ALIVE 805 'type': EventType.REQUEST_ALIVE
806 }, 806 },
807 { 807 {
808 'params': { 808 'params': {
809 'load_flags': 128, 809 'load_flags': 256,
810 'method': 'GET', 810 'method': 'GET',
811 'priority': 4, 811 'priority': 4,
812 'url': 'http://www.google.com/' 812 'url': 'http://www.google.com/'
813 }, 813 },
814 'phase': EventPhase.PHASE_BEGIN, 814 'phase': EventPhase.PHASE_BEGIN,
815 'source': { 815 'source': {
816 'id': 146, 816 'id': 146,
817 'type': EventSourceType.URL_REQUEST 817 'type': EventSourceType.URL_REQUEST
818 }, 818 },
819 'time': '953534910', 819 'time': '953534910',
820 'type': EventType.URL_REQUEST_START_JOB 820 'type': EventType.URL_REQUEST_START_JOB
821 }, 821 },
822 { 822 {
823 'phase': EventPhase.PHASE_END, 823 'phase': EventPhase.PHASE_END,
824 'source': { 824 'source': {
825 'id': 146, 825 'id': 146,
826 'type': EventSourceType.URL_REQUEST 826 'type': EventSourceType.URL_REQUEST
827 }, 827 },
828 'time': '953534970', 828 'time': '953534970',
829 'type': EventType.URL_REQUEST_START_JOB 829 'type': EventType.URL_REQUEST_START_JOB
830 }, 830 },
831 ]; 831 ];
832 832
833 testCase.expectedText = 833 testCase.expectedText =
834 't=1338864633224 [st= 0] +REQUEST_ALIVE [dt=?]\n' + 834 't=1338864633224 [st= 0] +REQUEST_ALIVE [dt=?]\n' +
835 't=1338864633356 [st=132] URL_REQUEST_START_JOB [dt=60]\n' + 835 't=1338864633356 [st=132] URL_REQUEST_START_JOB [dt=60]\n' +
836 ' --> load_flags = 128 (ENABLE_LOAD_TIMING)\n' + 836 ' --> load_flags = 256 (ENABLE_LOAD_TIMING)\n' +
837 ' --> method = "GET"\n' + 837 ' --> method = "GET"\n' +
838 ' --> priority = 4\n' + 838 ' --> priority = 4\n' +
839 ' --> url = "http://www.google.com/"'; 839 ' --> url = "http://www.google.com/"';
840 840
841 return testCase; 841 return testCase;
842 } 842 }
843 843
844 /** 844 /**
845 * Test case for a URLRequest that was not completed that came from a loaded 845 * Test case for a URLRequest that was not completed that came from a loaded
846 * log file. 846 * log file.
847 */ 847 */
848 function painterTestURLRequestIncompleteFromLoadedLog() { 848 function painterTestURLRequestIncompleteFromLoadedLog() {
849 var testCase = painterTestURLRequestIncomplete(); 849 var testCase = painterTestURLRequestIncomplete();
850 testCase.logCreationTime = 1338864634013; 850 testCase.logCreationTime = 1338864634013;
851 testCase.expectedText = 851 testCase.expectedText =
852 't=1338864633224 [st= 0] +REQUEST_ALIVE [dt=789+]\n' + 852 't=1338864633224 [st= 0] +REQUEST_ALIVE [dt=789+]\n' +
853 't=1338864633356 [st=132] URL_REQUEST_START_JOB [dt=60]\n' + 853 't=1338864633356 [st=132] URL_REQUEST_START_JOB [dt=60]\n' +
854 ' --> load_flags = 128 (ENABLE_LOAD_TIMING)\n' + 854 ' --> load_flags = 256 (ENABLE_LOAD_TIMING)\n' +
855 ' --> method = "GET"\n' + 855 ' --> method = "GET"\n' +
856 ' --> priority = 4\n' + 856 ' --> priority = 4\n' +
857 ' --> url = "http://www.google.com/"\n' + 857 ' --> url = "http://www.google.com/"\n' +
858 't=1338864634013 [st=789]'; 858 't=1338864634013 [st=789]';
859 return testCase; 859 return testCase;
860 } 860 }
861 861
862 /** 862 /**
863 * Tests the custom formatting of net_errors across several different event 863 * Tests the custom formatting of net_errors across several different event
864 * types. 864 * types.
865 */ 865 */
866 function painterTestNetError() { 866 function painterTestNetError() {
867 var testCase = {}; 867 var testCase = {};
868 testCase.tickOffset = '1337911098446'; 868 testCase.tickOffset = '1337911098446';
869 869
870 testCase.logEntries = [ 870 testCase.logEntries = [
871 { 871 {
872 'phase': EventPhase.PHASE_BEGIN, 872 'phase': EventPhase.PHASE_BEGIN,
873 'source': { 873 'source': {
874 'id': 318, 874 'id': 318,
875 'type': EventSourceType.URL_REQUEST 875 'type': EventSourceType.URL_REQUEST
876 }, 876 },
877 'time': '953675448', 877 'time': '953675448',
878 'type': EventType.REQUEST_ALIVE 878 'type': EventType.REQUEST_ALIVE
879 }, 879 },
880 { 880 {
881 'params': { 881 'params': {
882 'load_flags': 68223104, 882 'load_flags': 136446208,
883 'method': 'GET', 883 'method': 'GET',
884 'priority': 4, 884 'priority': 4,
885 'url': 'http://www.doesnotexistdomain.com/' 885 'url': 'http://www.doesnotexistdomain.com/'
886 }, 886 },
887 'phase': EventPhase.PHASE_BEGIN, 887 'phase': EventPhase.PHASE_BEGIN,
888 'source': { 888 'source': {
889 'id': 318, 889 'id': 318,
890 'type': EventSourceType.URL_REQUEST 890 'type': EventSourceType.URL_REQUEST
891 }, 891 },
892 'time': '953675455', 892 'time': '953675455',
893 'type': EventType.URL_REQUEST_START_JOB 893 'type': EventType.URL_REQUEST_START_JOB
894 }, 894 },
895 { 895 {
896 'phase': EventPhase.PHASE_END, 896 'phase': EventPhase.PHASE_END,
897 'source': { 897 'source': {
898 'id': 318, 898 'id': 318,
899 'type': EventSourceType.URL_REQUEST 899 'type': EventSourceType.URL_REQUEST
900 }, 900 },
901 'time': '953675460', 901 'time': '953675460',
902 'type': EventType.URL_REQUEST_START_JOB 902 'type': EventType.URL_REQUEST_START_JOB
903 }, 903 },
904 { 904 {
905 'params': { 905 'params': {
906 'load_flags': 68223104, 906 'load_flags': 136446208,
907 'method': 'GET', 907 'method': 'GET',
908 'priority': 4, 908 'priority': 4,
909 'url': 'http://www.doesnotexistdomain.com/' 909 'url': 'http://www.doesnotexistdomain.com/'
910 }, 910 },
911 'phase': EventPhase.PHASE_BEGIN, 911 'phase': EventPhase.PHASE_BEGIN,
912 'source': { 912 'source': {
913 'id': 318, 913 'id': 318,
914 'type': EventSourceType.URL_REQUEST 914 'type': EventSourceType.URL_REQUEST
915 }, 915 },
916 'time': '953675460', 916 'time': '953675460',
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 'type': EventSourceType.URL_REQUEST 1031 'type': EventSourceType.URL_REQUEST
1032 }, 1032 },
1033 'time': '953675923', 1033 'time': '953675923',
1034 'type': EventType.REQUEST_ALIVE 1034 'type': EventType.REQUEST_ALIVE
1035 } 1035 }
1036 ]; 1036 ];
1037 1037
1038 testCase.expectedText = 1038 testCase.expectedText =
1039 't=1338864773894 [st= 0] +REQUEST_ALIVE [dt=475]\n' + 1039 't=1338864773894 [st= 0] +REQUEST_ALIVE [dt=475]\n' +
1040 't=1338864773901 [st= 7] URL_REQUEST_START_JOB [dt=5]\n' + 1040 't=1338864773901 [st= 7] URL_REQUEST_START_JOB [dt=5]\n' +
1041 ' --> load_flags = 68223104 (ENABLE_LOAD_TIMING | ' + 1041 ' --> load_flags = 136446208 (' +
1042 'MAIN_FRAME | MAYBE_USER_GESTURE | VERIFY_EV_CERT)\n' + 1042 'ENABLE_LOAD_TIMING | MAIN_FRAME | MAYBE_USER_GESTURE | VERIFY_EV_CERT)\n' +
rvargas (doing something else) 2013/03/20 21:00:02 nit: the rest of the file is careful to indent in
Randy Smith (Not in Mondays) 2013/03/20 22:13:00 Good point; I hadn't noticed the usual pattern for
1043 ' --> method = "GET"\n' + 1043 ' --> method = "GET"\n' +
1044 ' --> priority = 4\n' + 1044 ' --> priority = 4\n' +
1045 ' --> url = "http://www.doesnotexistdomain.com/"\n' + 1045 ' --> url = "http://www.doesnotexistdomain.com/"\n' +
1046 't=1338864773906 [st= 12] +URL_REQUEST_START_JOB [dt=245]\n' + 1046 't=1338864773906 [st= 12] +URL_REQUEST_START_JOB [dt=245]\n' +
1047 ' --> load_flags = 68223104 (ENABLE_LOAD_TIMING | ' + 1047 ' --> load_flags = 136446208 (' +
1048 'MAIN_FRAME | MAYBE_USER_GESTURE | VERIFY_EV_CERT)\n' + 1048 'ENABLE_LOAD_TIMING | MAIN_FRAME | MAYBE_USER_GESTURE | VERIFY_EV_CERT)\n' +
rvargas (doing something else) 2013/03/20 21:00:02 same here.
Randy Smith (Not in Mondays) 2013/03/20 22:13:00 Done.
1049 ' --> method = "GET"\n' + 1049 ' --> method = "GET"\n' +
1050 ' --> priority = 4\n' + 1050 ' --> priority = 4\n' +
1051 ' --> url = "http://www.doesnotexistdomain.com/"\n' + 1051 ' --> url = "http://www.doesnotexistdomain.com/"\n' +
1052 't=1338864773915 [st= 21] HTTP_CACHE_GET_BACKEND [dt=0]\n' + 1052 't=1338864773915 [st= 21] HTTP_CACHE_GET_BACKEND [dt=0]\n' +
1053 't=1338864773915 [st= 21] HTTP_CACHE_OPEN_ENTRY [dt=1]\n' + 1053 't=1338864773915 [st= 21] HTTP_CACHE_OPEN_ENTRY [dt=1]\n' +
1054 ' --> net_error = -2 (ERR_FAILED)\n' + 1054 ' --> net_error = -2 (ERR_FAILED)\n' +
1055 't=1338864773917 [st= 23] HTTP_CACHE_CREATE_ENTRY [dt=2]\n' + 1055 't=1338864773917 [st= 23] HTTP_CACHE_CREATE_ENTRY [dt=2]\n' +
1056 't=1338864773919 [st= 25] HTTP_CACHE_ADD_TO_ENTRY [dt=1]\n' + 1056 't=1338864773919 [st= 25] HTTP_CACHE_ADD_TO_ENTRY [dt=1]\n' +
1057 't=1338864773920 [st= 26] HTTP_STREAM_REQUEST [dt=225]\n' + 1057 't=1338864773920 [st= 26] HTTP_STREAM_REQUEST [dt=225]\n' +
1058 't=1338864774151 [st=257] -URL_REQUEST_START_JOB\n' + 1058 't=1338864774151 [st=257] -URL_REQUEST_START_JOB\n' +
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
1708 * Tests the formatting of a URL request that was just finishing up when 1708 * Tests the formatting of a URL request that was just finishing up when
1709 * net-internals was opened. 1709 * net-internals was opened.
1710 */ 1710 */
1711 function painterTestInProgressURLRequest() { 1711 function painterTestInProgressURLRequest() {
1712 var testCase = {}; 1712 var testCase = {};
1713 testCase.tickOffset = '1337911098446'; 1713 testCase.tickOffset = '1337911098446';
1714 1714
1715 testCase.logEntries = [ 1715 testCase.logEntries = [
1716 { 1716 {
1717 'params': { 1717 'params': {
1718 'load_flags': 68223104, 1718 'load_flags': 136446208,
1719 'load_state': LoadState.READING_RESPONSE, 1719 'load_state': LoadState.READING_RESPONSE,
1720 'method': 'GET', 1720 'method': 'GET',
1721 'url': 'http://www.MagicPonyShopper.com' 1721 'url': 'http://www.MagicPonyShopper.com'
1722 }, 1722 },
1723 'phase': EventPhase.PHASE_BEGIN, 1723 'phase': EventPhase.PHASE_BEGIN,
1724 'source': { 1724 'source': {
1725 'id': 318, 1725 'id': 318,
1726 'type': EventSourceType.URL_REQUEST 1726 'type': EventSourceType.URL_REQUEST
1727 }, 1727 },
1728 'time': '953675548', 1728 'time': '953675548',
(...skipping 23 matching lines...) Expand all
1752 'id': 318, 1752 'id': 318,
1753 'type': EventSourceType.URL_REQUEST 1753 'type': EventSourceType.URL_REQUEST
1754 }, 1754 },
1755 'time': '953675923', 1755 'time': '953675923',
1756 'type': EventType.REQUEST_ALIVE 1756 'type': EventType.REQUEST_ALIVE
1757 } 1757 }
1758 ]; 1758 ];
1759 1759
1760 testCase.expectedText = 1760 testCase.expectedText =
1761 't=1338864773994 [st= 0] +REQUEST_ALIVE [dt=375]\n' + 1761 't=1338864773994 [st= 0] +REQUEST_ALIVE [dt=375]\n' +
1762 ' --> load_flags = 68223104 ' + 1762 ' --> load_flags = 136446208 ' +
1763 '(ENABLE_LOAD_TIMING | MAIN_FRAME | MAYBE_USER_GESTURE ' + 1763 '(ENABLE_LOAD_TIMING | MAIN_FRAME | MAYBE_USER_GESTURE ' +
1764 '| VERIFY_EV_CERT)\n' + 1764 '| VERIFY_EV_CERT)\n' +
1765 ' --> load_state = ' + LoadState.READING_RESPONSE + 1765 ' --> load_state = ' + LoadState.READING_RESPONSE +
1766 ' (READING_RESPONSE)\n' + 1766 ' (READING_RESPONSE)\n' +
1767 ' --> method = "GET"\n' + 1767 ' --> method = "GET"\n' +
1768 ' --> url = "http://www.MagicPonyShopper.com"\n' + 1768 ' --> url = "http://www.MagicPonyShopper.com"\n' +
1769 't=1338864774145 [st=151] -HTTP_STREAM_REQUEST\n' + 1769 't=1338864774145 [st=151] -HTTP_STREAM_REQUEST\n' +
1770 't=1338864774151 [st=157] -URL_REQUEST_START_JOB\n' + 1770 't=1338864774151 [st=157] -URL_REQUEST_START_JOB\n' +
1771 't=1338864774369 [st=375] -REQUEST_ALIVE'; 1771 't=1338864774369 [st=375] -REQUEST_ALIVE';
1772 1772
1773 return testCase; 1773 return testCase;
1774 } 1774 }
1775 1775
1776 })(); // Anonymous namespace 1776 })(); // Anonymous namespace
OLDNEW
« no previous file with comments | « no previous file | net/base/load_flags_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698