| 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..8207e0b94ca55e0f47bfdd2d8cb57c8818779916
|
| --- /dev/null
|
| +++ b/chrome/test/data/extensions/platform_apps/sync_file_system/authorization_test/test.js
|
| @@ -0,0 +1,47 @@
|
| +
|
| +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();
|
| +});
|
|
|