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

Unified Diff: chrome/test/data/extensions/api_test/settings/test.html

Issue 7189029: Implement an initial extension settings API. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Make clang happy Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/data/extensions/api_test/settings/manifest.json ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/extensions/api_test/settings/test.html
diff --git a/chrome/test/data/extensions/api_test/settings/test.html b/chrome/test/data/extensions/api_test/settings/test.html
new file mode 100644
index 0000000000000000000000000000000000000000..91ac263307380aa24f21ee314afe480ce71b3221
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/settings/test.html
@@ -0,0 +1,206 @@
+<script>
+chrome.test.runTests([
+ function getWhenEmpty() {
+ function stage1(settings) {
+ chrome.test.assertEq({}, settings);
+ chrome.experimental.settings.get(['foo', 'bar'], stage2);
+ }
+ function stage2(settings) {
+ chrome.test.assertEq({}, settings);
+ chrome.experimental.settings.get(undefined, stage3);
+ }
+ function stage3(settings) {
+ chrome.test.assertEq({}, settings);
+ chrome.test.succeed();
+ }
+ chrome.experimental.settings.get('foo', stage1);
+ },
+
+ function getWhenNonempty() {
+ function stage1(settings) {
+ chrome.test.assertEq({
+ 'foo' : 'bar',
+ 'baz' : 'qux',
+ 'hello': 'world'
+ }, settings);
+ chrome.experimental.settings.get(['foo', 'baz'], stage2);
+ }
+ function stage2(settings) {
+ chrome.test.assertEq({
+ 'foo': 'bar',
+ 'baz': 'qux'
+ }, settings);
+ chrome.experimental.settings.get(
+ ['nothing', 'baz', 'hello', 'ignore'], stage3);
+ }
+ function stage3(settings) {
+ chrome.test.assertEq({
+ 'baz' : 'qux',
+ 'hello': 'world'
+ }, settings);
+ chrome.experimental.settings.get(null, stage4);
+ }
+ function stage4(settings) {
+ chrome.test.assertEq({
+ 'foo' : 'bar',
+ 'baz' : 'qux',
+ 'hello': 'world'
+ }, settings);
+ chrome.test.succeed();
+ }
+ chrome.experimental.settings.set({
+ 'foo' : 'bar',
+ 'baz' : 'qux',
+ 'hello': 'world'
+ }, stage1);
+ },
+
+ function removeWhenEmpty() {
+ function stage1(settings) {
+ chrome.test.assertEq(undefined, settings);
+ chrome.experimental.settings.remove(['foo', 'bar'], stage2);
+ }
+ function stage2(settings) {
+ chrome.test.assertEq(undefined, settings);
+ chrome.test.succeed();
+ }
+ chrome.experimental.settings.remove('foo', stage1);
+ },
+
+ function removeWhenNonempty() {
+ function stage1(settings) {
+ chrome.test.assertEq({
+ 'foo' : 'bar',
+ 'baz' : 'qux',
+ 'hello': 'world'
+ }, settings);
+ chrome.experimental.settings.remove('foo', stage2);
+ }
+ function stage2(settings) {
+ chrome.test.assertEq(undefined, settings);
+ chrome.experimental.settings.get(null, stage3);
+ }
+ function stage3(settings) {
+ chrome.test.assertEq({
+ 'baz' : 'qux',
+ 'hello': 'world'
+ }, settings);
+ chrome.experimental.settings.remove(['baz', 'nothing'], stage4);
+ }
+ function stage4(settings) {
+ chrome.test.assertEq(undefined, settings);
+ chrome.experimental.settings.get(null, stage5);
+ }
+ function stage5(settings) {
+ chrome.test.assertEq({
+ 'hello': 'world'
+ }, settings);
+ chrome.experimental.settings.remove('hello', stage6);
+ }
+ function stage6(settings) {
+ chrome.test.assertEq(undefined, settings);
+ chrome.experimental.settings.get(null, stage7);
+ }
+ function stage7(settings) {
+ chrome.test.assertEq({}, settings);
+ chrome.test.succeed();
+ }
+ chrome.experimental.settings.set({
+ 'foo' : 'bar',
+ 'baz' : 'qux',
+ 'hello': 'world'
+ }, stage1);
+ },
+
+ function setWhenOverwriting() {
+ function stage1(settings) {
+ chrome.test.assertEq({
+ 'foo' : 'bar',
+ 'baz' : 'qux',
+ 'hello': 'world'
+ }, settings);
+ chrome.experimental.settings.set({
+ 'foo' : 'otherBar',
+ 'baz' : 'otherQux'
+ }, stage2);
+ }
+ function stage2(settings) {
+ chrome.test.assertEq({
+ 'foo' : 'otherBar',
+ 'baz' : 'otherQux',
+ }, settings);
+ chrome.experimental.settings.get(null, stage3);
+ }
+ function stage3(settings) {
+ chrome.test.assertEq({
+ 'foo' : 'otherBar',
+ 'baz' : 'otherQux',
+ 'hello': 'world'
+ }, settings);
+ chrome.experimental.settings.set({
+ 'baz' : 'anotherQux',
+ 'hello': 'otherWorld',
+ 'some' : 'value'
+ }, stage4);
+ }
+ function stage4(settings) {
+ chrome.test.assertEq({
+ 'baz' : 'anotherQux',
+ 'hello': 'otherWorld',
+ 'some' : 'value'
+ }, settings);
+ chrome.experimental.settings.get(null, stage5);
+ }
+ function stage5(settings) {
+ chrome.test.assertEq({
+ 'foo' : 'otherBar',
+ 'baz' : 'anotherQux',
+ 'hello': 'otherWorld',
+ 'some' : 'value'
+ }, settings);
+ chrome.test.succeed();
+ }
+ chrome.experimental.settings.set({
+ 'foo' : 'bar',
+ 'baz' : 'qux',
+ 'hello': 'world'
+ }, stage1);
+ },
+
+ function clearWhenEmpty() {
+ function stage1(settings) {
+ chrome.test.assertEq(undefined, settings);
+ chrome.experimental.settings.get(null, stage2);
+ }
+ function stage2(settings) {
+ chrome.test.assertEq({}, settings);
+ chrome.test.succeed();
+ }
+ chrome.experimental.settings.clear(stage1);
+ },
+
+ function clearWhenNonempty() {
+ function stage1(settings) {
+ chrome.test.assertEq({
+ 'foo' : 'bar',
+ 'baz' : 'qux',
+ 'hello': 'world'
+ }, settings);
+ chrome.experimental.settings.clear(stage2);
+ }
+ function stage2(settings) {
+ chrome.test.assertEq(undefined, settings);
+ chrome.experimental.settings.get(null, stage3);
+ }
+ function stage3(settings) {
+ chrome.test.assertEq({}, settings);
+ chrome.test.succeed();
+ }
+ chrome.experimental.settings.set({
+ 'foo' : 'bar',
+ 'baz' : 'qux',
+ 'hello': 'world'
+ }, stage1);
+ }
+]);
+</script>
« no previous file with comments | « chrome/test/data/extensions/api_test/settings/manifest.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698