Commit bae0b510 authored by Marijn Kruisselbrink's avatar Marijn Kruisselbrink Committed by Commit Bot

[NativeFS] Update web tests to use new writing API.

And remove tests for the old/soon to be removed writing API.

Bug: 853326
Change-Id: Ief44f98be8b59844976de26c90df9b4933041188
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2095564Reviewed-by: default avatarOlivier Yiptong <oyiptong@chromium.org>
Commit-Queue: Marijn Kruisselbrink <mek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#748758}
parent 17b7711e
This is a testharness.js-based test.
PASS User succesfully selected an empty directory.
PASS User granted write access.
PASS write() with an empty blob to an empty file
PASS write() a blob to an empty file
PASS write() called with a blob and a valid offset
FAIL write() called with an invalid offset assert_unreached: Should have rejected: undefined Reached unreachable code
PASS write() with an empty string to an empty file
PASS write() with a valid utf-8 string
PASS write() with a string with unix line ending preserved
PASS write() with a string with windows line ending preserved
PASS write() with an empty array buffer to an empty file
PASS write() with a valid typed array buffer
PASS truncate() to shrink a file
PASS truncate() to grow a file
PASS createWriter() fails when parent directory is removed
PASS write() fails when parent directory is removed
PASS truncate() fails when parent directory is removed
PASS atomic writes: close() fails when parent directory is removed
PASS atomic writes: writers make atomic changes on close
PASS atomic writes: write() after close() fails
PASS atomic writes: truncate() after close() fails
PASS atomic writes: close() after close() fails
PASS atomic writes: only one close() operation may succeed
PASS createWriter({keepExistingData: true}): atomic writer initialized with source contents
PASS createWriter({keepExistingData: false}): atomic writer initialized with empty file
PASS atomic writes: writer persists file on close, even if file is removed
Harness: the test ran to completion.
<!doctype html>
<meta charset=utf-8>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="resources/test-helpers.js"></script>
<script src="resources/native-fs-test-helpers.js"></script>
<script src="script-tests/FileSystemWriter.js"></script>
......@@ -73,8 +73,8 @@ async function createEmptyFile(test, name, parent) {
async function createFileWithContents(test, name, contents, parent) {
const handle = await createEmptyFile(test, name, parent);
const writer = await handle.createWriter();
await writer.write(0, new Blob([contents]));
const writer = await handle.createWritable();
await writer.write(new Blob([contents]));
await writer.close();
return handle;
}
......
// META: script=resources/test-helpers.js
// META: script=resources/sandboxed-fs-test-helpers.js
// META: script=script-tests/FileSystemWriter.js
......@@ -20,8 +20,8 @@ directory_test(async (t, root) => {
});
await timeout;
const writer = await handle.createWriter({keepExistingData: false});
await writer.write(0, new Blob(['foo']));
const writer = await handle.createWritable({keepExistingData: false});
await writer.write(new Blob(['foo']));
await writer.close();
file = await handle.getFile();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment