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

Unified Diff: chrome/test/data/webui/extensions/extension_test_util.js

Issue 1447183005: [MD Extensions] Fix item sorting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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/extensions/extension_test_util.js
diff --git a/chrome/test/data/webui/extensions/extension_test_util.js b/chrome/test/data/webui/extensions/extension_test_util.js
index ccea8dfed8aef36382e994b1bbf2289df49f6c56..81f10013526829e8b6181324b7fd0b40931d15b6 100644
--- a/chrome/test/data/webui/extensions/extension_test_util.js
+++ b/chrome/test/data/webui/extensions/extension_test_util.js
@@ -46,8 +46,39 @@ cr.define('extension_test_util', function() {
expectEquals(opt_expected, element.textContent, selector);
}
+ /**
+ * Creates an ExtensionInfo object.
+ * @param {Object=} opt_properties A set of properties that will be used on
+ * the resulting ExtensionInfo (otherwise defaults will be used).
+ * @return {chrome.developerPrivate.ExtensionInfo}
+ */
+ function createExtensionInfo(opt_properties) {
+ var id = opt_properties && opt_properties.hasOwnProperty('id') ?
+ opt_properties[id] : 'a'.repeat(32);
+ var baseUrl = 'chrome-extension://' + id + '/';
+ var data = {
+ description: 'This is an extension',
+ iconUrl: 'chrome://extension-icon/' + id + '/24/0',
+ id: id,
+ incognitoAccess: {isEnabled: true, isActive: false},
+ location: 'FROM_STORE',
+ name: 'Wonderful Extension',
+ state: 'ENABLED',
+ type: 'EXTENSION',
+ version: '2.0',
+ views: [{url: baseUrl + 'foo.html'}, {url: baseUrl + 'bar.html'}],
michaelpg 2015/11/18 09:08:46 not to nitpick, but if the caller passes {url: foo
Devlin 2015/11/18 17:16:59 It shouldn't be - views is the key on the object,
michaelpg 2015/11/18 20:01:17 Oh, baseUrl is generated from the id -- that was w
+ }
+ if (opt_properties) {
michaelpg 2015/11/18 09:08:46 Object.assign(data, opt_properties); // even work
Devlin 2015/11/18 17:17:00 Rad. Done.
+ Object.getOwnPropertyNames(opt_properties).forEach(function(name) {
+ data[name] = opt_properties[name];
+ });
+ }
+ return data;
+ }
+
return {
ClickMock: ClickMock,
testVisible: testVisible,
+ createExtensionInfo: createExtensionInfo,
};
});

Powered by Google App Engine
This is Rietveld 408576698