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

Unified Diff: chrome/test/data/extensions/api_test/file_system_provider/mount/test.js

Issue 294073007: [fsp] Let extensions decide about the file system id. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 6 years, 7 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/api_test/file_system_provider/mount/test.js
diff --git a/chrome/test/data/extensions/api_test/file_system_provider/mount/test.js b/chrome/test/data/extensions/api_test/file_system_provider/mount/test.js
index 3ab124164308a548518671241177f9a53cbafb54..3f12a029b1f8412d0c5eb160d2f4ef3084b54f10 100644
--- a/chrome/test/data/extensions/api_test/file_system_provider/mount/test.js
+++ b/chrome/test/data/extensions/api_test/file_system_provider/mount/test.js
@@ -10,56 +10,73 @@
chrome.test.runTests([
// Tests whether mounting succeeds, when a non-empty name is provided.
function goodDisplayName() {
- var onTestSuccess = chrome.test.callbackPass(function() {});
+ var onTestSuccess = chrome.test.callbackPass();
chrome.fileSystemProvider.mount(
- 'test file system',
- function(fileSystemId) {
- chrome.test.assertEq('number', typeof(fileSystemId));
- chrome.test.assertEq(1, fileSystemId);
- onTestSuccess();
- },
- function(error) {
- chrome.test.fail();
- }
- );
+ 'file-system-id',
+ 'File System Name',
+ function() {
+ onTestSuccess();
+ },
+ function(error) {
+ chrome.test.fail();
+ });
},
// Verifies that mounting fails, when an empty string is provided as a name.
function emptyDisplayName() {
- var onTestSuccess = chrome.test.callbackPass(function() {});
+ var onTestSuccess = chrome.test.callbackPass();
chrome.fileSystemProvider.mount(
- '',
- function(fileSystemId) {
- chrome.test.fail();
- },
- function(error) {
- chrome.test.assertEq('SecurityError', error.name);
- onTestSuccess();
- }
- );
+ 'file-system-id',
+ '',
+ function() {
+ chrome.test.fail();
+ },
+ function(error) {
+ chrome.test.assertEq('SecurityError', error.name);
+ onTestSuccess();
+ });
+ },
+ // Verifies that mounting fails, when an empty string is provided as an Id
+ function emptyFileSystemId() {
+ var onTestSuccess = chrome.test.callbackPass();
+ chrome.fileSystemProvider.mount(
+ '',
+ 'File System Name',
+ function() {
+ chrome.test.fail();
+ },
+ function(error) {
+ chrome.test.assertEq('SecurityError', error.name);
+ onTestSuccess();
+ }
+ );
},
// End to end test. Mounts a volume using fileSystemProvider.mount(), then
// checks if the mounted volume is added to VolumeManager, by querying
// fileBrowserPrivate.getVolumeMetadataList().
function successfulMount() {
- var onTestSuccess = chrome.test.callbackPass(function() {});
+ var onTestSuccess = chrome.test.callbackPass();
+ var fileSystemId = 'caramel-candy';
chrome.fileSystemProvider.mount(
- 'caramel-candy.zip',
- function(fileSystemId) {
- chrome.test.assertTrue(fileSystemId > 0);
- chrome.fileBrowserPrivate.getVolumeMetadataList(function(volumeList) {
- var found = volumeList.filter(function(volumeInfo) {
- return volumeInfo.volumeId ==
- 'provided:' + chrome.runtime.id + '-' + fileSystemId + '-user';
+ fileSystemId,
+ 'caramel-candy.zip',
+ function() {
+ chrome.fileBrowserPrivate.getVolumeMetadataList(function(volumeList) {
+ var found = false;
+ volumeList.forEach(function(volumeInfo) {
+ if (volumeInfo.extensionId == chrome.runtime.id &&
+ volumeInfo.fileSystemId == fileSystemId) {
+ found = true;
+ }
+ });
+ chrome.test.assertTrue(found);
+ onTestSuccess();
});
- chrome.test.assertEq(1, found.length);
- onTestSuccess();
+ },
+ function(error) {
+ chrome.test.fail();
});
- },
- function(error) {
- chrome.test.fail();
- });
},
// Checks is limit for mounted file systems per profile works correctly.
@@ -67,24 +84,30 @@ chrome.test.runTests([
// requests should succeed, except the last one which should fail with a
// security error.
function stressMountTest() {
- var onTestSuccess = chrome.test.callbackPass(function() {});
+ var onTestSuccess = chrome.test.callbackPass();
var ALREADY_MOUNTED_FILE_SYSTEMS = 2; // By previous tests.
var MAX_FILE_SYSTEMS = 16;
var index = 0;
var tryNextOne = function() {
index++;
if (index < MAX_FILE_SYSTEMS - ALREADY_MOUNTED_FILE_SYSTEMS + 1) {
+ var fileSystemId = index + '-stress-test';
chrome.fileSystemProvider.mount(
- index + 'th file system',
- function(fileSystemId) {
- chrome.test.assertTrue(fileSystemId > 0);
+ fileSystemId,
+ index + 'th File System',
+ function() {
tryNextOne();
},
- chrome.test.fail);
+ function(error) {
+ chrome.test.fail(error.name);
+ });
} else {
chrome.fileSystemProvider.mount(
- 'over the limit fs',
- chrome.test.fail,
+ 'over-the-limit-fs-id',
+ 'Over The Limit File System',
+ function() {
+ chrome.test.fail();
+ },
function(error) {
chrome.test.assertEq('SecurityError', error.name);
onTestSuccess();

Powered by Google App Engine
This is Rietveld 408576698