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

Unified Diff: chrome/test/data/extensions/platform_apps/sync_file_system/authorization_test/test.js

Issue 493043002: [SyncFS] Add browser_tests to test authentication state of SyncFS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 3 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
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();
+});

Powered by Google App Engine
This is Rietveld 408576698