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

Side by Side Diff: third_party/WebKit/LayoutTests/inspector/components/cookies-table.html

Issue 2623743002: DevTools: extract modules (non-extensions) (Closed)
Patch Set: rebaseline Created 3 years, 11 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
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script> 3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script type="text/javascript"> 4 <script type="text/javascript">
5 5
6 var test = function () { 6 var test = function () {
7 function dumpResults(cookies) { 7 function dumpResults(cookies) {
8 InspectorTest.addResult(cookies.map(x => x.name()).join(',')); 8 InspectorTest.addResult(cookies.map(x => x.name()).join(','));
9 } 9 }
10 10
11 function createCookie(data) { 11 function createCookie(data) {
12 const cookie = new SDK.Cookie(null, data.name, data.value); 12 const cookie = new SDK.Cookie(null, data.name, data.value);
13 for (let key in data) { 13 for (let key in data) {
14 if (key === 'name' || key === 'value') 14 if (key === 'name' || key === 'value')
15 continue; 15 continue;
16 16
17 cookie.addAttribute(key, data[key]); 17 cookie.addAttribute(key, data[key]);
18 } 18 }
19 return cookie; 19 return cookie;
20 } 20 }
21 21
22 function createSortAndDumpCookies(cookieData, column, isAsc) { 22 function createSortAndDumpCookies(cookieData, column, isAsc) {
23 const table = new Components.CookiesTable(true); 23 const table = new CookieTable.CookiesTable(true);
24 const cookies = cookieData.map(createCookie); 24 const cookies = cookieData.map(createCookie);
25 table._dataGrid = {isSortOrderAscending: () => isAsc, sortColumnId: () => co lumn}; 25 table._dataGrid = {isSortOrderAscending: () => isAsc, sortColumnId: () => co lumn};
26 table._sortCookies(cookies); 26 table._sortCookies(cookies);
27 InspectorTest.addResult(`params: ${column} ${isAsc ? 'asc' : 'desc'}`); 27 InspectorTest.addResult(`params: ${column} ${isAsc ? 'asc' : 'desc'}`);
28 dumpResults(cookies); 28 dumpResults(cookies);
29 } 29 }
30 30
31 function run() { 31 function run() {
32 const cookieData = [ 32 const cookieData = [
33 {name: 'cookieA', value: '11', path: '/zzz', domain: 'example.com'}, 33 {name: 'cookieA', value: '11', path: '/zzz', domain: 'example.com'},
34 {name: 'cookieB', value: '2', path: '/abc', domain: '.example.com'}, 34 {name: 'cookieB', value: '2', path: '/abc', domain: '.example.com'},
35 {name: 'cookieC', value: 'foo', path: '/', domain: 'abc.example.com'}, 35 {name: 'cookieC', value: 'foo', path: '/', domain: 'abc.example.com'},
36 {name: 'cookieD', value: '{other}', path: '/aa', domain: '.other.com'}, 36 {name: 'cookieD', value: '{other}', path: '/aa', domain: '.other.com'},
37 {name: 'cookieE', value: 'zz', path: '/gg', domain: 'z.example.com'}, 37 {name: 'cookieE', value: 'zz', path: '/gg', domain: 'z.example.com'},
38 {name: 'cookieF', value: 'null', path: '/', domain: 'example.com'}, 38 {name: 'cookieF', value: 'null', path: '/', domain: 'example.com'},
39 ]; 39 ];
40 40
41 createSortAndDumpCookies(cookieData, 'name', false); 41 createSortAndDumpCookies(cookieData, 'name', false);
42 createSortAndDumpCookies(cookieData, 'value', true); 42 createSortAndDumpCookies(cookieData, 'value', true);
43 createSortAndDumpCookies(cookieData, 'path', false); 43 createSortAndDumpCookies(cookieData, 'path', false);
44 createSortAndDumpCookies(cookieData, 'domain', true); 44 createSortAndDumpCookies(cookieData, 'domain', true);
45 createSortAndDumpCookies(cookieData, null, true); 45 createSortAndDumpCookies(cookieData, null, true);
46 InspectorTest.completeTest(); 46 InspectorTest.completeTest();
47 } 47 }
48 48
49 self.runtime.loadModulePromise('components_lazy').then(run); 49 self.runtime.loadModulePromise('cookie_table').then(run);
50 }; 50 };
51 51
52 </script> 52 </script>
53 </head> 53 </head>
54 <body onload="runTest()"> 54 <body onload="runTest()">
55 <p>Tests inspector cookies table</p> 55 <p>Tests inspector cookies table</p>
56 </body> 56 </body>
57 </html> 57 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698