| Index: chrome/test/data/extensions/api_test/file_system_provider/get_metadata/test.js
|
| diff --git a/chrome/test/data/extensions/api_test/file_system_provider/get_metadata/test.js b/chrome/test/data/extensions/api_test/file_system_provider/get_metadata/test.js
|
| index 2dd95a284a1d5c5b0f5cde724dc5d5b469c87085..99e1759a8f298006a30002c684dc5c0ed1000d20 100644
|
| --- a/chrome/test/data/extensions/api_test/file_system_provider/get_metadata/test.js
|
| +++ b/chrome/test/data/extensions/api_test/file_system_provider/get_metadata/test.js
|
| @@ -5,17 +5,6 @@
|
| 'use strict';
|
|
|
| /**
|
| - * @type {DOMFileSystem}
|
| - */
|
| -var fileSystem = null;
|
| -
|
| -/**
|
| - * @type {string}
|
| - * @const
|
| - */
|
| -var FILE_SYSTEM_ID = 'vanilla';
|
| -
|
| -/**
|
| * @type {Object}
|
| * @const
|
| */
|
| @@ -49,26 +38,6 @@ var TESTING_WRONG_TIME_FILE = Object.freeze({
|
| });
|
|
|
| /**
|
| - * Gets volume information for the provided file system.
|
| - *
|
| - * @param {string} fileSystemId Id of the provided file system.
|
| - * @param {function(Object)} callback Callback to be called on result, with the
|
| - * volume information object in case of success, or null if not found.
|
| - */
|
| -function getVolumeInfo(fileSystemId, callback) {
|
| - chrome.fileBrowserPrivate.getVolumeMetadataList(function(volumeList) {
|
| - for (var i = 0; i < volumeList.length; i++) {
|
| - if (volumeList[i].extensionId == chrome.runtime.id &&
|
| - volumeList[i].fileSystemId == fileSystemId) {
|
| - callback(volumeList[i]);
|
| - return;
|
| - }
|
| - }
|
| - callback(null);
|
| - });
|
| -}
|
| -
|
| -/**
|
| * Returns metadata for a requested entry.
|
| *
|
| * @param {GetMetadataRequestedOptions} options Options.
|
| @@ -77,7 +46,7 @@ function getVolumeInfo(fileSystemId, callback) {
|
| * @param {function(string)} onError Error callback with an error code.
|
| */
|
| function onGetMetadataRequested(options, onSuccess, onError) {
|
| - if (options.fileSystemId != FILE_SYSTEM_ID) {
|
| + if (options.fileSystemId != test_util.FILE_SYSTEM_ID) {
|
| onError('SECURITY'); // enum ProviderError.
|
| return;
|
| }
|
| @@ -107,27 +76,9 @@ function onGetMetadataRequested(options, onSuccess, onError) {
|
| * @param {function()} callback Success callback.
|
| */
|
| function setUp(callback) {
|
| - chrome.fileSystemProvider.mount(
|
| - {fileSystemId: FILE_SYSTEM_ID, displayName: 'chocolate.zip'},
|
| - function() {
|
| - 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.onGetMetadataRequested.addListener(
|
| + onGetMetadataRequested);
|
| + test_util.mountFileSystem(callback);
|
| }
|
|
|
| /**
|
| @@ -138,7 +89,7 @@ function runTests() {
|
| // Read metadata of the root.
|
| function getFileMetadataSuccess() {
|
| var onSuccess = chrome.test.callbackPass();
|
| - fileSystem.root.getMetadata(
|
| + test_util.fileSystem.root.getMetadata(
|
| function(metadata) {
|
| chrome.test.assertEq(TESTING_ROOT.size, metadata.size);
|
| chrome.test.assertEq(
|
| @@ -152,7 +103,7 @@ function runTests() {
|
| // Read metadata of an existing testing file.
|
| function getFileMetadataSuccess() {
|
| var onSuccess = chrome.test.callbackPass();
|
| - fileSystem.root.getFile(
|
| + test_util.fileSystem.root.getFile(
|
| TESTING_FILE.name,
|
| {create: false},
|
| function(fileEntry) {
|
| @@ -179,7 +130,7 @@ function runTests() {
|
| // easy way to verify an incorrect modification time at early stage.
|
| function getFileMetadataWrongTimeSuccess() {
|
| var onSuccess = chrome.test.callbackPass();
|
| - fileSystem.root.getFile(
|
| + test_util.fileSystem.root.getFile(
|
| TESTING_WRONG_TIME_FILE.name,
|
| {create: false},
|
| function(fileEntry) {
|
| @@ -199,7 +150,7 @@ function runTests() {
|
| // error. DirectoryEntry.getDirectory() causes fetching metadata.
|
| function getFileMetadataNotFound() {
|
| var onSuccess = chrome.test.callbackPass();
|
| - fileSystem.root.getDirectory(
|
| + test_util.fileSystem.root.getDirectory(
|
| 'cranberries',
|
| {create: false},
|
| function(dirEntry) {
|
| @@ -215,7 +166,7 @@ function runTests() {
|
| // fetching metadata.
|
| function getFileMetadataWrongType() {
|
| var onSuccess = chrome.test.callbackPass();
|
| - fileSystem.root.getDirectory(
|
| + test_util.fileSystem.root.getDirectory(
|
| TESTING_FILE.name,
|
| {create: false},
|
| function(fileEntry) {
|
|
|