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

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

Issue 329483002: [fsp] Group arguments for API methods and events in dictionaries. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleaned up. Created 6 years, 6 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/read_directory/test.js
diff --git a/chrome/test/data/extensions/api_test/file_system_provider/read_directory/test.js b/chrome/test/data/extensions/api_test/file_system_provider/read_directory/test.js
index e66072d5eded67c26f2dd481e768b85af2f8e26a..1a4703cec2d583ff5bab8a8d045f658151c95d68 100644
--- a/chrome/test/data/extensions/api_test/file_system_provider/read_directory/test.js
+++ b/chrome/test/data/extensions/api_test/file_system_provider/read_directory/test.js
@@ -82,20 +82,18 @@ function getVolumeInfo(fileSystemId, callback) {
/**
* Returns entries in the requested directory.
*
- * @param {string} inFileSystemId ID of the file system.
- * @param {string} directoryPath Path of the directory.
+ * @param {ReadDirectoryRequestedOptions} options Options.
* @param {function(Array.<Object>, boolean)} onSuccess Success callback with
* a list of entries. May be called multiple times.
* @param {function(string)} onError Error callback with an error code.
*/
-function onReadDirectoryRequested(
- inFileSystemId, directoryPath, onSuccess, onError) {
- if (inFileSystemId != FILE_SYSTEM_ID) {
- onError('SECURITY_ERROR'); // enum ProviderError.
+function onReadDirectoryRequested(options, onSuccess, onError) {
+ if (options.fileSystemId != FILE_SYSTEM_ID) {
+ onError('SECURITY'); // enum ProviderError.
return;
}
- if (directoryPath != '/' + TESTING_HELLO_DIR.name) {
+ if (options.directoryPath != '/' + TESTING_HELLO_DIR.name) {
onError('NOT_FOUND'); // enum ProviderError.
return;
}
@@ -110,25 +108,23 @@ function onReadDirectoryRequested(
* To successfully acquire a DirectoryEntry, or even a DOMFileSystem, this event
* must be implemented and return correct values.
*
- * @param {string} inFileSystemId ID of the file system.
- * @param {string} entryPath Path of the requested entry.
+ * @param {GetMetadataRequestedOptions} options Options.
* @param {function(Object)} onSuccess Success callback with metadata passed
* an argument.
* @param {function(string)} onError Error callback with an error code.
*/
-function onGetMetadataRequested(
- inFileSystemId, entryPath, onSuccess, onError) {
- if (inFileSystemId != FILE_SYSTEM_ID) {
- onError('SECURITY_ERROR'); // enum ProviderError.
+function onGetMetadataRequested(options, onSuccess, onError) {
+ if (options.fileSystemId != FILE_SYSTEM_ID) {
+ onError('SECURITY'); // enum ProviderError.
return;
}
- if (entryPath == '/') {
+ if (options.entryPath == '/') {
onSuccess(TESTING_ROOT);
return;
}
- if (entryPath == '/' + TESTING_HELLO_DIR.name) {
+ if (options.entryPath == '/' + TESTING_HELLO_DIR.name) {
onSuccess(TESTING_HELLO_DIR);
return;
}
@@ -143,26 +139,31 @@ function onGetMetadataRequested(
* @param {function()} callback Success callback.
*/
function setUp(callback) {
- chrome.fileSystemProvider.mount(FILE_SYSTEM_ID, 'chocolate.zip', function() {
- chrome.fileSystemProvider.onReadDirectoryRequested.addListener(
- onReadDirectoryRequested);
- chrome.fileSystemProvider.onGetMetadataRequested.addListener(
- onGetMetadataRequested);
-
- getVolumeInfo(FILE_SYSTEM_ID, function(volumeInfo) {
- chrome.test.assertTrue(!!volumeInfo);
- chrome.fileBrowserPrivate.requestFileSystem(
- volumeInfo.volumeId,
- function(inFileSystem) {
- chrome.test.assertTrue(!!inFileSystem);
-
- fileSystem = inFileSystem;
- callback();
- });
- });
- }, function() {
- chrome.test.fail();
- });
+ chrome.fileSystemProvider.mount(
+ {
+ fileSystemId: FILE_SYSTEM_ID,
+ displayName: 'chocolate.zip'
+ },
+ function() {
+ chrome.fileSystemProvider.onReadDirectoryRequested.addListener(
+ onReadDirectoryRequested);
+ chrome.fileSystemProvider.onGetMetadataRequested.addListener(
+ onGetMetadataRequested);
+ getVolumeInfo(FILE_SYSTEM_ID, function(volumeInfo) {
+ chrome.test.assertTrue(!!volumeInfo);
+ chrome.fileBrowserPrivate.requestFileSystem(
+ volumeInfo.volumeId,
+ function(inFileSystem) {
+ chrome.test.assertTrue(!!inFileSystem);
+
+ fileSystem = inFileSystem;
+ callback();
+ });
+ });
+ },
+ function() {
+ chrome.test.fail();
+ });
}
/**

Powered by Google App Engine
This is Rietveld 408576698