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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/inspector/components/cookies-table.html
diff --git a/third_party/WebKit/LayoutTests/inspector/components/cookies-table.html b/third_party/WebKit/LayoutTests/inspector/components/cookies-table.html
new file mode 100644
index 0000000000000000000000000000000000000000..df5f88e467ffc5287eb4a93d670df457bc119ff7
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector/components/cookies-table.html
@@ -0,0 +1,57 @@
+<html>
+<head>
+<script src="../../http/tests/inspector/inspector-test.js"></script>
+<script type="text/javascript">
+
+var test = function () {
+ function dumpResults(cookies) {
+ InspectorTest.addResult(cookies.map(x => x.name()).join(','));
+ }
+
+ function createCookie(data) {
+ const cookie = new SDK.Cookie(null, data.name, data.value);
+ for (let key in data) {
+ if (key === 'name' || key === 'value')
+ continue;
+
+ cookie.addAttribute(key, data[key]);
+ }
+ return cookie;
+ }
+
+ function createSortAndDumpCookies(cookieData, column, isAsc) {
+ const table = new Components.CookiesTable(true);
+ const cookies = cookieData.map(createCookie);
+ table._dataGrid = {isSortOrderAscending: () => isAsc, sortColumnId: () => column};
+ table._sortCookies(cookies);
+ InspectorTest.addResult(`params: ${column} ${isAsc ? 'asc' : 'desc'}`);
+ dumpResults(cookies);
+ }
+
+ function run() {
+ const cookieData = [
+ {name: 'cookieA', value: '11', path: '/zzz', domain: 'example.com'},
+ {name: 'cookieB', value: '2', path: '/abc', domain: '.example.com'},
+ {name: 'cookieC', value: 'foo', path: '/', domain: 'abc.example.com'},
+ {name: 'cookieD', value: '{other}', path: '/aa', domain: '.other.com'},
+ {name: 'cookieE', value: 'zz', path: '/gg', domain: 'z.example.com'},
+ {name: 'cookieF', value: 'null', path: '/', domain: 'example.com'},
+ ];
+
+ createSortAndDumpCookies(cookieData, 'name', false);
+ createSortAndDumpCookies(cookieData, 'value', true);
+ createSortAndDumpCookies(cookieData, 'path', false);
+ createSortAndDumpCookies(cookieData, 'domain', true);
+ createSortAndDumpCookies(cookieData, null, true);
+ InspectorTest.completeTest();
+ }
+
+ self.runtime.loadModulePromise('components_lazy').then(run);
+};
+
+</script>
+</head>
+<body onload="runTest()">
+<p>Tests inspector cookies table</p>
+</body>
+</html>
« 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