summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/fs/FileSystemSyncAccessHandle-getSize.https.tentative.worker.js
blob: 4b62b280b96044ea85d2e31fbd79829ce39b9c13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
importScripts("/resources/testharness.js");
importScripts('resources/sync-access-handle-test.js');

'use strict';

sync_access_handle_test((t, handle) => {
  assert_equals(handle.getSize(), 0);
  const bufferSize = 4;
  const writeBuffer = new Uint8Array(bufferSize);
  writeBuffer.set([96, 97, 98, 99]);
  handle.write(writeBuffer, {at: 0});
  assert_equals(handle.getSize(), bufferSize);
  let offset = 3;
  handle.write(writeBuffer, {at: offset});
  assert_equals(handle.getSize(), bufferSize + offset);
  offset = 10;
  handle.write(writeBuffer, {at: offset});
  assert_equals(handle.getSize(), bufferSize + offset);
}, 'test SyncAccessHandle.getSize after SyncAccessHandle.write');

done();