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

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

Issue 2550213002: [DevTools] Fix Cookie Sort (Closed)
Patch Set: Add tests and remove comment 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..0ab9eea028dd98bf85d68e2a22f1d15df06e8993
--- /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">
+
+function initialize_CookiesTableTests() {
dgozman 2016/12/08 19:41:20 Don't put initialize_XXX functions in a test - it'
phulce 2016/12/08 23:02:55 Done.
+ InspectorTest.preloadModule("components_lazy");
+
+ InspectorTest.dumpResults = function (cookies) {
+ InspectorTest.addResult(cookies.map(x => x.name()).join(','));
+ };
+
+ InspectorTest.createCookie = function (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;
+ };
+
+ InspectorTest.createSortAndDumpCookies = function (cookieData, column, isAsc) {
+ const table = new Components.CookiesTable(true);
+ const cookies = cookieData.map(InspectorTest.createCookie);
+ table._dataGrid = {isSortOrderAscending: () => isAsc, sortColumnId: () => column};
+ table._sortCookies(cookies);
+ InspectorTest.addResult(`params: ${column} ${isAsc ? 'asc' : 'desc'}`);
+ InspectorTest.dumpResults(cookies);
+ };
+}
+
+var test = function () {
+ 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'},
+ ];
+
+ InspectorTest.createSortAndDumpCookies(cookieData, 'name', false);
+ InspectorTest.createSortAndDumpCookies(cookieData, 'value', true);
+ InspectorTest.createSortAndDumpCookies(cookieData, 'path', false);
+ InspectorTest.createSortAndDumpCookies(cookieData, 'domain', true);
+ InspectorTest.createSortAndDumpCookies(cookieData, null, true);
+ InspectorTest.completeTest();
+};
+
+</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