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

Unified Diff: chrome/test/data/extensions/api_test/developer/test/common.js

Issue 11428116: First few API implementation of AppsDebuggerPrivate. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fixing build on windows Created 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/extensions/api_test/developer/test/common.js
diff --git a/chrome/test/data/extensions/api_test/developer/test/common.js b/chrome/test/data/extensions/api_test/developer/test/common.js
new file mode 100644
index 0000000000000000000000000000000000000000..f2d1f62863dce17839be98f6fa24d8098f35f4fb
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/developer/test/common.js
@@ -0,0 +1,44 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+var assertEq = chrome.test.assertEq;
+var assertTrue = chrome.test.assertTrue;
+var fail = chrome.test.fail;
+var callback = chrome.test.callback;
+
+function getItemNamed(list, name) {
+ for (var i = 0; i < list.length; i++) {
+ if (list[i].name == name) {
+ return list[i];
+ }
+ }
+ fail("didn't find item with name: " + name);
+ return null;
+}
+
+// Verifies that the item's name, enabled, and type properties match |name|,
+// |enabled|, and |type|, and checks against any additional name/value
+// properties from |additional_properties|.
+function checkItem(item, name, enabled, type, additional_properties) {
+ assertTrue(item !== null);
+ assertEq(name, item.name);
+ assertEq(type, item.type);
+ assertEq(enabled, item.enabled);
+
+ for (var propname in additional_properties) {
+ var value = additional_properties[propname];
+ if (typeof value === 'string')
+ value = value.replace("<ID>", item.id);
+ assertTrue(propname in item);
+ assertEq(value, item[propname]);
+ }
+}
+
+// Gets an extension/app with |name| in |list|, verifies that its enabled
+// and type properties match |enabled| and |type|, and checks against any
+// additional name/value properties from |additional_properties|.
+function checkItemInList(list, name, enabled, type, additional_properties) {
+ var item = getItemNamed(list, name);
+ checkItem(item, name, enabled, type, additional_properties);
+}

Powered by Google App Engine
This is Rietveld 408576698