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

Side by Side Diff: chrome/test/data/webui/extensions/extension_detail_view_test.js

Issue 2723613004: [MD Extensions] Update Detail View UI (Closed)
Patch Set: nit Created 3 years, 9 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/browser/ui/webui/extensions/extensions_ui.cc ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 extensions-detail-view. */ 5 /** @fileoverview Suite of tests for extensions-detail-view. */
6 cr.define('extension_detail_view_tests', function() { 6 cr.define('extension_detail_view_tests', function() {
7 /** @enum {string} */ 7 /** @enum {string} */
8 var TestNames = { 8 var TestNames = {
9 Layout: 'layout', 9 Layout: 'layout',
10 ClickableElements: 'clickable elements', 10 ClickableElements: 'clickable elements',
(...skipping 26 matching lines...) Expand all
37 extensionData = extension_test_util.createExtensionInfo({ 37 extensionData = extension_test_util.createExtensionInfo({
38 incognitoAccess: {isEnabled: true, isActive: false}, 38 incognitoAccess: {isEnabled: true, isActive: false},
39 fileAccess: {isEnabled: true, isActive: false}, 39 fileAccess: {isEnabled: true, isActive: false},
40 runOnAllUrls: {isEnabled: true, isActive: false}, 40 runOnAllUrls: {isEnabled: true, isActive: false},
41 errorCollection: {isEnabled: true, isActive: false}, 41 errorCollection: {isEnabled: true, isActive: false},
42 }); 42 });
43 mockDelegate = new extension_test_util.MockItemDelegate(); 43 mockDelegate = new extension_test_util.MockItemDelegate();
44 item = new extensions.DetailView(); 44 item = new extensions.DetailView();
45 item.set('data', extensionData); 45 item.set('data', extensionData);
46 item.set('delegate', mockDelegate); 46 item.set('delegate', mockDelegate);
47 item.set('inDevMode', false);
47 document.body.appendChild(item); 48 document.body.appendChild(item);
48 }); 49 });
49 50
50 test(assert(TestNames.Layout), function() { 51 test(assert(TestNames.Layout), function() {
51 Polymer.dom.flush(); 52 Polymer.dom.flush();
52 53
53 extension_test_util.testIronIcons(item); 54 extension_test_util.testIronIcons(item);
54 55
55 var testIsVisible = extension_test_util.isVisible.bind(null, item); 56 var testIsVisible = extension_test_util.isVisible.bind(null, item);
56 expectTrue(testIsVisible('#close-button')); 57 expectTrue(testIsVisible('#close-button'));
57 expectFalse(testIsVisible('#open-homepage')); 58 expectTrue(testIsVisible('#icon'));
58 expectFalse(testIsVisible('#options')); 59 expectTrue(testIsVisible('#enable-toggle'));
60 expectFalse(testIsVisible('#extensions-options'));
59 61
60 // Check the checkboxes visibility and state. They should be visible 62 // Check the checkboxes visibility and state. They should be visible
61 // only if the associated option is enabled, and checked if the 63 // only if the associated option is enabled, and checked if the
62 // associated option is active. 64 // associated option is active.
63 var accessOptions = [ 65 var accessOptions = [
64 {key: 'incognitoAccess', id: '#allow-incognito'}, 66 {key: 'incognitoAccess', id: '#allow-incognito'},
65 {key: 'fileAccess', id: '#allow-on-file-urls'}, 67 {key: 'fileAccess', id: '#allow-on-file-urls'},
66 {key: 'runOnAllUrls', id: '#allow-on-all-sites'}, 68 {key: 'runOnAllUrls', id: '#allow-on-all-sites'},
67 {key: 'errorCollection', id: '#collect-errors'}, 69 {key: 'errorCollection', id: '#collect-errors'},
68 ]; 70 ];
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 Polymer.dom.flush(); 102 Polymer.dom.flush();
101 expectTrue(testIsVisible('#permissions-list')); 103 expectTrue(testIsVisible('#permissions-list'));
102 expectEquals(2, 104 expectEquals(2,
103 item.$$('#permissions-list').querySelectorAll('li'). 105 item.$$('#permissions-list').querySelectorAll('li').
104 length); 106 length);
105 expectFalse(testIsVisible('#no-permissions')); 107 expectFalse(testIsVisible('#no-permissions'));
106 108
107 var optionsUrl = 109 var optionsUrl =
108 'chrome-extension://' + extensionData.id + '/options.html'; 110 'chrome-extension://' + extensionData.id + '/options.html';
109 item.set('data.optionsPage', {openInTab: true, url: optionsUrl}); 111 item.set('data.optionsPage', {openInTab: true, url: optionsUrl});
110 expectTrue(testIsVisible('#options')); 112 expectTrue(testIsVisible('#extensions-options'));
111 113
112 var homepageUrl = 'https://www.example.com/'; 114 // TODO(devlin): Add checks for homepage once it's added back to the
113 item.set('data.homePage', {specified: true, url: homepageUrl}); 115 // mocks.
114 expectTrue(testIsVisible('#open-homepage')); 116
115 expectEquals(homepageUrl, item.$$('#open-homepage').href); 117 expectFalse(testIsVisible('#id-section'));
118 expectFalse(testIsVisible('#inspectable-views'));
119
120 item.set('inDevMode', true);
121 Polymer.dom.flush();
122 expectTrue(testIsVisible('#id-section'));
123 expectTrue(testIsVisible('#inspectable-views'));
116 }); 124 });
117 125
118 test(assert(TestNames.ClickableElements), function() { 126 test(assert(TestNames.ClickableElements), function() {
119 var optionsUrl = 127 var optionsUrl =
120 'chrome-extension://' + extensionData.id + '/options.html'; 128 'chrome-extension://' + extensionData.id + '/options.html';
121 item.set('data.optionsPage', {openInTab: true, url: optionsUrl}); 129 item.set('data.optionsPage', {openInTab: true, url: optionsUrl});
122 Polymer.dom.flush(); 130 Polymer.dom.flush();
123 mockDelegate.testClickingCalls( 131 mockDelegate.testClickingCalls(
124 item.$$('#allow-incognito'), 'setItemAllowedIncognito', 132 item.$$('#allow-incognito'), 'setItemAllowedIncognito',
125 [extensionData.id, true]); 133 [extensionData.id, true]);
126 mockDelegate.testClickingCalls( 134 mockDelegate.testClickingCalls(
127 item.$$('#allow-on-file-urls'), 'setItemAllowedOnFileUrls', 135 item.$$('#allow-on-file-urls'), 'setItemAllowedOnFileUrls',
128 [extensionData.id, true]); 136 [extensionData.id, true]);
129 mockDelegate.testClickingCalls( 137 mockDelegate.testClickingCalls(
130 item.$$('#allow-on-all-sites'), 'setItemAllowedOnAllSites', 138 item.$$('#allow-on-all-sites'), 'setItemAllowedOnAllSites',
131 [extensionData.id, true]); 139 [extensionData.id, true]);
132 mockDelegate.testClickingCalls( 140 mockDelegate.testClickingCalls(
133 item.$$('#collect-errors'), 'setItemCollectsErrors', 141 item.$$('#collect-errors'), 'setItemCollectsErrors',
134 [extensionData.id, true]); 142 [extensionData.id, true]);
135 mockDelegate.testClickingCalls( 143 mockDelegate.testClickingCalls(
136 item.$$('#options'), 'showItemOptionsPage', [extensionData.id]); 144 item.$$('#extensions-options'), 'showItemOptionsPage',
145 [extensionData.id]);
146 mockDelegate.testClickingCalls(
147 item.$$('#remove-extension'), 'deleteItem',
148 [extensionData.id]);
137 }); 149 });
138 }); 150 });
139 } 151 }
140 152
141 return { 153 return {
142 registerTests: registerTests, 154 registerTests: registerTests,
143 TestNames: TestNames, 155 TestNames: TestNames,
144 }; 156 };
145 }); 157 });
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/extensions/extensions_ui.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698