summaryrefslogtreecommitdiffstats
path: root/chrome/test
diff options
context:
space:
mode:
authoraltimofeev@chromium.org <altimofeev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-24 09:03:10 +0000
committeraltimofeev@chromium.org <altimofeev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-24 09:03:10 +0000
commit61b55b61f077b9c7ef39cf988c53c971569f186f (patch)
tree9d49191cb300732ea9cf8f64da37293727c0eef8 /chrome/test
parenta7f845b2c1ab77bf730c8dac5e2e4436108f4860 (diff)
downloadchromium_src-61b55b61f077b9c7ef39cf988c53c971569f186f.zip
chromium_src-61b55b61f077b9c7ef39cf988c53c971569f186f.tar.gz
chromium_src-61b55b61f077b9c7ef39cf988c53c971569f186f.tar.bz2
Added extensions API to provide customization values.
This CL adds API that could be used only by component extensions. Currently, API only returns device's HWID. BUG=chromium-os:13076 TEST=browser_tests Review URL: http://codereview.chromium.org/6681038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79264 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r--chrome/test/data/extensions/api_test/chromeos_info_private/background.html46
-rw-r--r--chrome/test/data/extensions/api_test/chromeos_info_private/manifest.json8
2 files changed, 54 insertions, 0 deletions
diff --git a/chrome/test/data/extensions/api_test/chromeos_info_private/background.html b/chrome/test/data/extensions/api_test/chromeos_info_private/background.html
new file mode 100644
index 0000000..41ff3e7
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/chromeos_info_private/background.html
@@ -0,0 +1,46 @@
+<script>
+ var pass = chrome.test.callbackPass;
+ var fail = chrome.test.callbackFail;
+
+ function getTestFunctionFor(keys, fails) {
+ return function generatedTest () {
+ // Debug.
+ console.log("keys: " + keys + ", fails: " + fails);
+
+ chrome.chromeosInfoPrivate.get(
+ keys,
+ pass(function(values) {
+ // Debug
+ console.log("values: ", values);
+ for (var i = 0; i < keys.length; ++i)
+ chrome.test.assertEq(!(i in fails), keys[i] in values);
+ }));
+ }
+ }
+
+ // Automatically generates tests for the given possible keys. Note, this
+ // tests do not check return value, only the fact that it is presented.
+ function generateTestsForKeys(keys) {
+ var tests = [];
+ // Test with all the keys at one.
+ tests.push(getTestFunctionFor(keys, []));
+ // Tests with key which hasn't corresponding value.
+ var noValueKey = "no-value-for-this-key";
+ tests.push(getTestFunctionFor([noValueKey], [0]));
+
+ if (keys.length > 1) {
+ // Tests with the separate keys.
+ for (var i = 0; i < keys.length; ++i) {
+ tests.push(getTestFunctionFor([keys[i]], []));
+ }
+ }
+ if (keys.length > 2) {
+ tests.push(getTestFunctionFor([keys[0], keys[1]], []));
+ tests.push(getTestFunctionFor([keys[0], noValueKey, keys[1]], [1]));
+ }
+ return tests;
+ }
+
+ var tests = generateTestsForKeys(["hwid"])
+ chrome.test.runTests(tests);
+</script>
diff --git a/chrome/test/data/extensions/api_test/chromeos_info_private/manifest.json b/chrome/test/data/extensions/api_test/chromeos_info_private/manifest.json
new file mode 100644
index 0000000..7169138
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/chromeos_info_private/manifest.json
@@ -0,0 +1,8 @@
+{
+ "key": "MIGdMA0GCSqGSIb3DQEBAQUAA4GLADCBhwKBgQDFFBqmJf6+xgNeQhSwunB7Vdi+peXwR6uf09DKBmStju73Cjhggl3x+i7jfeRvGguJA1nnxK45dHktx5ppyy2w16nFKFcfIAN9dP6RrfPWuHVxw1AzNCRm/VutRLje1e9Kk3xtXAw9Vj3N0/txZ3u8HOr62YUDIyFcS87+Yo/a9QIBIw==",
+ "name": "chrome.chromeosInfoPrivate",
+ "version": "0.1",
+ "description": "Test for chromeosInfoPrivate.get",
+ "background_page": "background.html",
+ "permissions": ["chromeosInfoPrivate"]
+}