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

Unified Diff: chrome/test/data/webui/settings/site_data_details_subpage_tests.js

Issue 2687553003: MD Settings: Fix site data details regression and add test. (Closed)
Patch Set: resetRoutForTesting() Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/webui/settings/site_data_details_subpage_tests.js
diff --git a/chrome/test/data/webui/settings/site_data_details_subpage_tests.js b/chrome/test/data/webui/settings/site_data_details_subpage_tests.js
new file mode 100644
index 0000000000000000000000000000000000000000..43b50513871587bdb51df6e762e3abfb79cd388b
--- /dev/null
+++ b/chrome/test/data/webui/settings/site_data_details_subpage_tests.js
@@ -0,0 +1,77 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/** @fileoverview Suite of tests for site-data-details-subpage. */
+suite('SiteDataDetailsSubpage', function() {
+ /** @type {?SiteDataDetailsSubpageElement} */
+ var page = null;
+
+ /** @type {TestSiteSettingsPrefsBrowserProxy} */
+ var browserProxy = null;
+ /** @type {!CookieDetails} */
+ var cookieDetails = {
+ accessibleToScript: "Yes",
+ content: "dummy_cookie_contents",
+ created: "Tuesday, February 7, 2017 at 11:28:45 AM",
+ domain: ".foo.com",
+ expires: "Wednesday, February 7, 2018 at 11:28:45 AM",
+ hasChildren: false,
+ id: "328",
+ idPath: "74,165,328",
+ name: "abcd",
+ path: "/",
+ sendfor: "Any kind of connection",
+ title: "abcd",
+ type: "cookie"
+ };
+
+ /** @type {!CookieList} */
+ var cookieList = {
+ id: 'fooId',
+ children: [cookieDetails],
+ };
+
+ var site = 'foo.com';
+
+ setup(function() {
+ browserProxy = new TestSiteSettingsPrefsBrowserProxy();
+ browserProxy.setCookieDetails(cookieList);
+ settings.SiteSettingsPrefsBrowserProxyImpl.instance_ = browserProxy;
+ PolymerTest.clearBody();
+ page = document.createElement('site-data-details-subpage');
+ settings.navigateTo(
+ settings.Route.SITE_SETTINGS_DATA_DETAILS,
+ new URLSearchParams('site=' + site));
+
+ document.body.appendChild(page);
+ });
+
+ teardown(function() {
+ settings.resetRouteForTesting();
+ });
+
+ test('DetailsShownForCookie', function() {
+ return browserProxy.whenCalled('getCookieDetails').then(
+ function(actualSite) {
+ assertEquals(site, actualSite);
+
+ Polymer.dom.flush();
+ var entries = page.root.querySelectorAll('.settings-box');
+ assertEquals(1, entries.length);
+
+ var listItems = page.root.querySelectorAll('.list-item');
+ // |cookieInfo| is a global var defined in
+ // site_settings/cookie_info.js, and specifies the fields that are
+ // shown for a cookie.
+ assertEquals(cookieInfo.cookie.length, listItems.length);
+
+ // Check that all the cookie information is presented in the DOM.
+ var cookieDetailValues = page.root.querySelectorAll('.secondary');
+ cookieDetailValues.forEach(function(div, i) {
+ var key = cookieInfo.cookie[i][0];
+ assertEquals(cookieDetails[key], div.textContent);
+ });
+ });
+ });
+});
« no previous file with comments | « chrome/test/data/webui/settings/cr_settings_browsertest.js ('k') | chrome/test/data/webui/settings/site_list_tests.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698