Index: chrome/test/data/extensions/platform_apps/sync_file_system/authorization_test/test.js |
diff --git a/chrome/test/data/extensions/platform_apps/sync_file_system/authorization_test/test.js b/chrome/test/data/extensions/platform_apps/sync_file_system/authorization_test/test.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c01c0b3ca0eb69c2c1aee569d582b8c1cdd2f278 |
--- /dev/null |
+++ b/chrome/test/data/extensions/platform_apps/sync_file_system/authorization_test/test.js |
@@ -0,0 +1,50 @@ |
+// Copyright 2014 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. |
+ |
+chrome.test.sendMessage("Launched"); |
+ |
+function requestSyncFS() { |
+ return new Promise(function(resolve, reject) { |
+ chrome.syncFileSystem.requestFileSystem(function(fs) { |
+ if (fs) { |
+ resolve(fs); |
+ } else { |
+ reject(chrome.runtime.lastError); |
+ } |
+ }); |
+ }); |
+} |
+ |
+function synchronizeToTestHarness(message) { |
+ return function() { return new Promise(function(resolve) { |
+ chrome.test.sendMessage('checkpoint: ' + message, resolve); |
+ }); |
+ }; |
+} |
+ |
+var fs = null; |
+requestSyncFS() |
+.then(function() { |
+ chrome.test.fail('Unexpected requestSyncFS success'); |
+}) |
+.catch(synchronizeToTestHarness('Failed to get syncfs')) |
+.then(requestSyncFS) |
+.then(function(fs_) { |
+ fs = fs_; |
+ return new Promise(function(resolve, reject) { |
+ fs.root.getFile('/foo', {create: true}, resolve, reject); |
+ }); |
+}) |
+.then(synchronizeToTestHarness('"/foo" created')) |
+.then(function() { |
+ return new Promise(function(resolve, reject) { |
+ fs.root.getFile('/bar', {create: true}, resolve, reject); |
+ }); |
+}) |
+.then(synchronizeToTestHarness('"/bar" created')) |
+.then(function() { |
+ chrome.test.succeed(); |
+}).catch(function() { |
+ chrome.test.fail(); |
+}); |