Revert "Add sbox tests related to warming up of locales."
[chromium-blink-merge.git] / ui / file_manager / integration_tests / testing_provider / background.js
blobfc356944239622d74801beabb6756354fc77c232
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 'use strict';
7 var dialogSettings = {};
9 function mountFileSystem(onSuccess, onError) {
10 chrome.fileSystemProvider.getAll(function(mounted) {
11 var index = mounted.length + 1;
12 chrome.fileSystemProvider.mount({
13 fileSystemId: 'test-fs-' + index,
14 displayName: 'Test (' + index + ')'
15 });
16 });
19 chrome.fileSystemProvider.onGetMetadataRequested.addListener(
20 function(options, onSuccess, onError) {
21 onSuccess({
22 isDirectory: true,
23 name: '',
24 size: 0,
25 modificationTime: new Date()
26 });
27 });
29 chrome.fileSystemProvider.onReadDirectoryRequested.addListener(
30 function(options, onSuccess, onError) {
31 onSuccess([], false /* hasMore */);
32 });
34 chrome.fileSystemProvider.onMountRequested.addListener(mountFileSystem);
36 chrome.fileSystemProvider.onUnmountRequested.addListener(
37 function(options, onSuccess, onError) {
38 chrome.fileSystemProvider.unmount(
40 fileSystemId: options.fileSystemId
42 function() {
43 if (chrome.runtime.lastError)
44 onError(chrome.runtime.lastError.message);
45 else
46 onSuccess();
47 });
48 });
50 // If the manifest for device or file source is used, then mount a fake file
51 // system on install.
52 if (chrome.runtime.getManifest().name === "Testing Provider Device" ||
53 chrome.runtime.getManifest().name === "Testing Provider File") {
54 chrome.runtime.onInstalled.addListener(mountFileSystem);