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

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

Issue 2526893002: [MD Extensions] Update subpages when the backing extension data changes (Closed)
Patch Set: woot 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 unified diff | Download patch
« no previous file with comments | « chrome/test/data/webui/extensions/cr_extensions_browsertest.js ('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 extension-sidebar. */ 5 /** @fileoverview Suite of tests for extension-sidebar. */
6 cr.define('extension_manager_tests', function() { 6 cr.define('extension_manager_tests', function() {
7 /** @enum {string} */ 7 /** @enum {string} */
8 var TestNames = { 8 var TestNames = {
9 ItemOrder: 'item order', 9 ItemOrder: 'item order',
10 ItemListVisibility: 'item list visibility', 10 ItemListVisibility: 'item list visibility',
11 ShowItems: 'show items', 11 ShowItems: 'show items',
12 ChangePages: 'change pages', 12 ChangePages: 'change pages',
13 UrlNavigationToDetails: 'url navigation to details', 13 UrlNavigationToDetails: 'url navigation to details',
14 UpdateItemData: 'update item data',
14 }; 15 };
15 16
16 function getDataByName(list, name) { 17 function getDataByName(list, name) {
17 return assert(list.find(function(el) { return el.name == name; })); 18 return assert(list.find(function(el) { return el.name == name; }));
18 } 19 }
19 20
20 function registerTests() { 21 function registerTests() {
21 suite('ExtensionManagerTest', function() { 22 suite('ExtensionManagerTest', function() {
22 /** @type {extensions.Manager} */ 23 /** @type {extensions.Manager} */
23 var manager; 24 var manager;
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 MockInteractions.tap(manager.sidebar.$['keyboard-shortcuts']); 153 MockInteractions.tap(manager.sidebar.$['keyboard-shortcuts']);
153 Polymer.dom.flush(); 154 Polymer.dom.flush();
154 expectEquals(Page.KEYBOARD_SHORTCUTS, pages.selected); 155 expectEquals(Page.KEYBOARD_SHORTCUTS, pages.selected);
155 }); 156 });
156 157
157 test(assert(TestNames.UrlNavigationToDetails), function() { 158 test(assert(TestNames.UrlNavigationToDetails), function() {
158 expectEquals(Page.DETAIL_VIEW, manager.$.pages.selected); 159 expectEquals(Page.DETAIL_VIEW, manager.$.pages.selected);
159 var detailsView = manager.$['details-view']; 160 var detailsView = manager.$['details-view'];
160 expectEquals('ldnnhddmnhbkjipkidpdiheffobcpfmf', detailsView.data.id); 161 expectEquals('ldnnhddmnhbkjipkidpdiheffobcpfmf', detailsView.data.id);
161 }); 162 });
163
164 test(assert(TestNames.UpdateItemData), function() {
165 var oldDescription = 'old description';
166 var newDescription = 'new description';
167 var extension = extension_test_util.createExtensionInfo(
168 {description: oldDescription});
169 manager.addItem(extension);
170 var data = manager.extensions[0];
171 manager.showItemDetails(extension);
172 var detailsView = manager.$['details-view'];
173 expectEquals(extension.id, detailsView.data.id);
174 expectEquals(oldDescription, detailsView.data.description);
175 expectEquals(
176 oldDescription,
177 detailsView.$$('.section .section-content').textContent.trim());
178
179 var extensionCopy = Object.assign({}, extension);
180 extensionCopy.description = newDescription;
181 manager.updateItem(extensionCopy);
182 expectEquals(extension.id, detailsView.data.id);
183 expectEquals(newDescription, detailsView.data.description);
184 expectEquals(
185 newDescription,
186 detailsView.$$('.section .section-content').textContent.trim());
michaelpg 2016/11/28 23:00:54 optional: add a different extension item, and veri
Devlin 2016/11/29 02:14:40 Sure, done.
187 });
162 }); 188 });
163 } 189 }
164 190
165 return { 191 return {
166 registerTests: registerTests, 192 registerTests: registerTests,
167 TestNames: TestNames, 193 TestNames: TestNames,
168 }; 194 };
169 }); 195 });
OLDNEW
« no previous file with comments | « chrome/test/data/webui/extensions/cr_extensions_browsertest.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698