The goog.testing.fs Namespace

The goog.testing.fs.Blob Class

A mock Blob object. The data is stored as a string. … more

The goog.testing.fs.DirectoryEntry Class

A mock directory entry object. … more

The goog.testing.fs.Entry Class

A mock filesystem entry object. … more

The goog.testing.fs.File Class

A mock file object. … more

The goog.testing.fs.FileEntry Class

A mock file entry object. … more

The goog.testing.fs.FileReader Class

A mock FileReader object. This emits the same events as {@link goog.fs.FileReader}. … more

The goog.testing.fs.FileSystem Class

A mock filesystem object. … more

The goog.testing.fs.FileWriter Class

A mock FileWriter object. This emits the same events as {@link goog.fs.FileSaver} and {@link goog.fs.FileWriter}. … more

The goog.testing.fs.ProgressEvent Class

A mock progress event. … more

.blobToString(blob, opt_encoding)

Returns the string value of a fake blob.

blob {!goog.testing.fs.Blob}
The blob to convert to a string.
opt_encoding {string=}
Ignored.
returns {!goog.async.Deferred}
The deferred string value of the blob.

.createObjectUrl(blob)

Create a fake object URL for a given fake blob. This can be used as a real URL, and it can be created and revoked normally.

blob {!goog.testing.fs.Blob}
The blob for which to create the URL.
returns {string}
The URL.

.getBlob(var_args)

Concatenates one or more values together and converts them to a fake blob.

var_args {...(string|!goog.testing.fs.Blob)}
The values that will make up the resulting blob.
returns {!goog.testing.fs.Blob}
The blob.

.getPersistent(size)

Get a filesystem object. Since these are mocks, there's no difference between temporary and persistent filesystems.

size {number}
Ignored.
returns {!goog.async.Deferred}
The deferred {@link goog.testing.fs.FileSystem}.

.getTemporary(size)

Get a filesystem object. Since these are mocks, there's no difference between temporary and persistent filesystems.

size {number}
Ignored.
returns {!goog.async.Deferred}
The deferred {@link goog.testing.fs.FileSystem}.

.install(stubs)

Installs goog.testing.fs in place of the standard goog.fs. After calling this, code that uses goog.fs should work without issue using goog.testing.fs.

stubs {!goog.testing.PropertyReplacer}
The property replacer for stubbing out the original goog.fs functions.

.isObjectUrlGranted(blob)

Return whether or not a URL has been granted for the given blob.

blob {!goog.testing.fs.Blob}
The blob to check.
returns {boolean}
Whether a URL has been granted.

.revokeObjectUrl(url)

Remove a URL that was created for a fake blob.

url {string}
The URL to revoke.