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

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: fix license header 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
« no previous file with comments | « chrome/test/data/extensions/platform_apps/sync_file_system/authorization_test/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/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();
+});
« no previous file with comments | « chrome/test/data/extensions/platform_apps/sync_file_system/authorization_test/manifest.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698