Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 cr.define('site_data_details', function() { | |
| 6 function registerTests() { | |
| 7 /** @fileoverview Suite of tests for site-data-details-subpage. */ | |
| 8 suite('SiteDataDetailsSubpage', function() { | |
| 9 /** @type {?SiteDataDetailsSubpageElement} */ | |
| 10 var page = null; | |
| 11 | |
| 12 /** @type {TestSiteSettingsPrefsBrowserProxy} */ | |
| 13 var browserProxy = null; | |
| 14 /** @type {!CookieDetails} */ | |
| 15 var cookieDetails = { | |
| 16 accessibleToScript: "Yes", | |
| 17 content: "dummy_cookie_contents", | |
| 18 created: "Tuesday, February 7, 2017 at 11:28:45 AM", | |
| 19 domain: ".foo.com", | |
| 20 expires: "Wednesday, February 7, 2018 at 11:28:45 AM", | |
| 21 hasChildren: false, | |
| 22 id: "328", | |
| 23 idPath: "74,165,328", | |
| 24 name: "abcd", | |
| 25 path: "/", | |
| 26 sendfor: "Any kind of connection", | |
| 27 title: "abcd", | |
| 28 type: "cookie" | |
| 29 }; | |
| 30 | |
| 31 /** @type {!CookieList} */ | |
| 32 var cookieList = { | |
| 33 id: 'fooId', | |
| 34 children: [cookieDetails], | |
| 35 }; | |
| 36 | |
| 37 var site = 'foo.com'; | |
| 38 | |
| 39 setup(function() { | |
| 40 browserProxy = new TestSiteSettingsPrefsBrowserProxy(); | |
| 41 browserProxy.setCookieDetails(cookieList); | |
| 42 settings.SiteSettingsPrefsBrowserProxyImpl.instance_ = browserProxy; | |
| 43 PolymerTest.clearBody(); | |
| 44 page = document.createElement('site-data-details-subpage'); | |
| 45 settings.navigateTo( | |
| 46 settings.Route.SITE_SETTINGS_DATA_DETAILS, | |
| 47 new URLSearchParams('site=' + site)); | |
| 48 | |
| 49 document.body.appendChild(page); | |
| 50 }); | |
| 51 | |
| 52 test('DetailsShownForCookie', function() { | |
| 53 return browserProxy.whenCalled('getCookieDetails').then( | |
|
tommycli
2017/02/08 19:28:40
This test does fail without the one char change ri
dpapad
2017/02/08 22:01:09
Yes, I doubled checked that. It fails with the fol
| |
| 54 function(actualSite) { | |
| 55 assertEquals(site, actualSite); | |
| 56 | |
| 57 Polymer.dom.flush(); | |
| 58 var entries = page.root.querySelectorAll('.settings-box'); | |
| 59 assertEquals(1, entries.length); | |
| 60 | |
| 61 var listItems = page.root.querySelectorAll('.list-item'); | |
| 62 // |cookieInfo| is a global var defined in | |
| 63 // site_settings/cookie_info.js, and specifies the fields that are | |
| 64 // shown for a cookie. | |
| 65 assertEquals(cookieInfo.cookie.length, listItems.length); | |
| 66 | |
| 67 // Check that all the cookie information is presented in the DOM. | |
| 68 var cookieDetailValues = page.root.querySelectorAll('.secondary'); | |
| 69 cookieDetailValues.forEach(function(div, i) { | |
| 70 var key = cookieInfo.cookie[i][0]; | |
| 71 assertEquals(cookieDetails[key], div.textContent); | |
| 72 }); | |
| 73 }); | |
| 74 }); | |
| 75 }); | |
| 76 } | |
| 77 | |
| 78 return { | |
| 79 registerTests: registerTests, | |
| 80 }; | |
| 81 }); | |
| OLD | NEW |