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

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

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

Powered by Google App Engine
This is Rietveld 408576698