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

Side by Side Diff: chrome/test/data/webui/settings/site_details_tests.js

Issue 1607483005: Show data usage on Site Details (MDSettings) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix update problem Created 4 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 unified diff | Download patch
« no previous file with comments | « chrome/chrome_browser_ui.gypi ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** @fileoverview Suite of tests for site-details. */ 5 /** @fileoverview Suite of tests for site-details. */
6 cr.define('site_details', function() { 6 cr.define('site_details', function() {
7 function registerTests() { 7 function registerTests() {
8 suite('SiteDetails', function() { 8 suite('SiteDetails', function() {
9 /** 9 /**
10 * A site list element created before each test. 10 * A site list element created before each test.
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 100
101 // Initialize a site-details before each test. 101 // Initialize a site-details before each test.
102 setup(function() { 102 setup(function() {
103 PolymerTest.clearBody(); 103 PolymerTest.clearBody();
104 testElement = document.createElement('site-details'); 104 testElement = document.createElement('site-details');
105 document.body.appendChild(testElement); 105 document.body.appendChild(testElement);
106 }); 106 });
107 107
108 test('empty state', function() { 108 test('empty state', function() {
109 testElement.prefs = prefsEmpty; 109 testElement.prefs = prefsEmpty;
110 testElement.origin = "http://www.google.com"; 110 testElement.origin = 'http://www.google.com';
111 111
112 // Once actual storage numbers are shown (instead of hard-coded), these 112 assertTrue(testElement.$.usage.hidden);
113 // two will become hidden by default. 113 assertTrue(testElement.$.storage.hidden);
114 assertFalse(testElement.$.usage.hidden);
115 assertFalse(testElement.$.storage.hidden);
116 114
117 // TODO(finnur): Check for the Permission heading hiding when no 115 // TODO(finnur): Check for the Permission heading hiding when no
118 // permissions are showing. 116 // permissions are showing.
119 117
120 var msg = 'No category should be showing, height'; 118 var msg = 'No category should be showing, height';
121 assertEquals(0, testElement.$.camera.offsetHeight, msg); 119 assertEquals(0, testElement.$.camera.offsetHeight, msg);
122 assertEquals(0, testElement.$.cookies.offsetHeight, msg); 120 assertEquals(0, testElement.$.cookies.offsetHeight, msg);
123 assertEquals(0, testElement.$.fullscreen.offsetHeight, msg); 121 assertEquals(0, testElement.$.fullscreen.offsetHeight, msg);
124 assertEquals(0, testElement.$.geolocation.offsetHeight, msg); 122 assertEquals(0, testElement.$.geolocation.offsetHeight, msg);
125 assertEquals(0, testElement.$.javascript.offsetHeight, msg); 123 assertEquals(0, testElement.$.javascript.offsetHeight, msg);
126 assertEquals(0, testElement.$.mic.offsetHeight, msg); 124 assertEquals(0, testElement.$.mic.offsetHeight, msg);
127 assertEquals(0, testElement.$.notification.offsetHeight, msg); 125 assertEquals(0, testElement.$.notification.offsetHeight, msg);
128 assertEquals(0, testElement.$.popups.offsetHeight, msg); 126 assertEquals(0, testElement.$.popups.offsetHeight, msg);
129 }); 127 });
130 128
131 test('all categories visible', function() { 129 test('all categories visible', function() {
132 testElement.prefs = prefs; 130 testElement.prefs = prefs;
133 testElement.origin = "https://foo-allow.com:443"; 131 testElement.origin = 'https://foo-allow.com:443';
134 132
135 var msg = 'All categories should be showing'; 133 var msg = 'All categories should be showing';
136 assertNotEquals(0, testElement.$.camera.offsetHeight, msg); 134 assertNotEquals(0, testElement.$.camera.offsetHeight, msg);
137 assertNotEquals(0, testElement.$.cookies.offsetHeight, msg); 135 assertNotEquals(0, testElement.$.cookies.offsetHeight, msg);
138 assertNotEquals(0, testElement.$.fullscreen.offsetHeight, msg); 136 assertNotEquals(0, testElement.$.fullscreen.offsetHeight, msg);
139 assertNotEquals(0, testElement.$.geolocation.offsetHeight, msg); 137 assertNotEquals(0, testElement.$.geolocation.offsetHeight, msg);
140 assertNotEquals(0, testElement.$.javascript.offsetHeight, msg); 138 assertNotEquals(0, testElement.$.javascript.offsetHeight, msg);
141 assertNotEquals(0, testElement.$.mic.offsetHeight, msg); 139 assertNotEquals(0, testElement.$.mic.offsetHeight, msg);
142 assertNotEquals(0, testElement.$.notification.offsetHeight, msg); 140 assertNotEquals(0, testElement.$.notification.offsetHeight, msg);
143 assertNotEquals(0, testElement.$.popups.offsetHeight, msg); 141 assertNotEquals(0, testElement.$.popups.offsetHeight, msg);
144 }); 142 });
143
144 test('usage heading shows on storage available', function() {
145 // Remove the current website-usage-private-api element.
146 var parent = testElement.$.usageApi.parentNode;
147 testElement.$.usageApi.remove();
148
149 // Replace it with a mock version.
150 Polymer({
151 is: 'mock-website-usage-private-api',
152
153 fetchUsageTotal: function(origin) {
154 testElement.storedData_ = '1 KB';
155 },
156 });
157 var api = document.createElement('mock-website-usage-private-api');
158 testElement.$.usageApi = api;
159 Polymer.dom(parent).appendChild(api);
160
161 testElement.prefs = prefs;
162 testElement.origin = 'https://foo-allow.com:443';
163
164 assertFalse(testElement.$.usage.hidden);
165 assertFalse(testElement.$.storage.hidden);
166 });
145 }); 167 });
146 } 168 }
147 return { 169 return {
148 registerTests: registerTests, 170 registerTests: registerTests,
149 }; 171 };
150 }); 172 });
OLDNEW
« no previous file with comments | « chrome/chrome_browser_ui.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698