forked from libapps/libapps-mirror
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchrome_mock_for_test.js
More file actions
46 lines (39 loc) · 1.45 KB
/
chrome_mock_for_test.js
File metadata and controls
46 lines (39 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright 2020 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// NB: This file is not loaded as a module because it modifies global scope.
'use strict';
/**
* @fileoverview Stub Chrome APIs for tests.
*/
/** @suppress {constantProperty} Allow tests in browsers. */
globalThis.chrome = globalThis.chrome || {};
class FspEventTarget {
/** @param {!Function} method */
addListener(method) {}
}
/** @suppress {checkTypes,constantProperty} */
chrome.fileSystemProvider = {
onCloseFileRequested: new FspEventTarget(),
onConfigureRequested: new FspEventTarget(),
onCopyEntryRequested: new FspEventTarget(),
onCreateDirectoryRequested: new FspEventTarget(),
onCreateFileRequested: new FspEventTarget(),
onDeleteEntryRequested: new FspEventTarget(),
onGetMetadataRequested: new FspEventTarget(),
onMountRequested: new FspEventTarget(),
onMoveEntryRequested: new FspEventTarget(),
onOpenFileRequested: new FspEventTarget(),
onReadDirectoryRequested: new FspEventTarget(),
onReadFileRequested: new FspEventTarget(),
onTruncateRequested: new FspEventTarget(),
onUnmountRequested: new FspEventTarget(),
onWriteFileRequested: new FspEventTarget(),
unmount: function(options, callback) {},
/** @type {!chrome.fileSystemProvider.ProviderError} */
ProviderError: {
FAILED: 'FAILED',
INVALID_OPERATION: 'INVALID_OPERATION',
NOT_FOUND: 'NOT_FOUND',
},
};