Update web-platform-tests to revision 20424e735a5e6ac7a474ae35d86c714272aea0e8

This commit is contained in:
WPT Sync Bot 2019-04-17 21:57:51 -04:00
parent eac2607a06
commit 39f4d8b931
94 changed files with 1332 additions and 233 deletions

View file

@ -21,5 +21,25 @@
return getComputedStyle(target).opacity != '1';
});
assert_equals(getComputedStyle(target).opacity, "0.5");
}, "Simple worklet animation should output values at specified local time");
</script>
animation.cancel();
}, "A running worklet animation should output values at specified local time.");
promise_test(async t => {
await registerConstantLocalTimeAnimator(500);
const effect = new KeyframeEffect(target, [{ opacity: 0 }], { duration: 1000 });
const animation = new WorkletAnimation('constant_time', effect);
animation.play();
await waitForAnimationFrameWithCondition(_=> {
return animation.playState == "running"
});
const prevCurrentTime = animation.currentTime;
animation.play();
assert_equals(animation.playState, "running");
assert_equals(animation.currentTime, prevCurrentTime)
animation.cancel();
}, "Playing a running animation should be a no-op.");
</script>

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Clipboard IDL test</title>
<link rel='help' href='https://w3c.github.io/clipboard-apis/'>
<link rel='help' href='https://w3c.github.io/clipboard-apis/#async-clipboard-api'>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/WebIDLParser.js"></script>

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Async Clipboard input type validation tests</title>
<link rel="help" href="https://w3c.github.io/clipboard-apis/#async-clipboard-api">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
@ -13,29 +14,28 @@ test(() => {
promise_test(async () => {
const blob = new Blob(['hello'], {type: 'text/plain'});
await navigator.clipboard.write({'text/plain': blob});
}, 'navigator.clipboard.write({string : text/plain Blob}) succeeds');
const item = new ClipboardItem({'text/plain': blob});
await navigator.clipboard.write([item]);
}, 'navigator.clipboard.write([text/plain ClipboardItem]) succeeds');
promise_test(async t => {
await promise_rejects(t, new TypeError(),
navigator.clipboard.write());
}, 'navigator.clipboard.write() fails (expect {string : Blob})');
await promise_rejects(t, new TypeError(), navigator.clipboard.write());
}, 'navigator.clipboard.write() fails (expect [ClipboardItem])');
promise_test(async t => {
await promise_rejects(t, new TypeError(),
navigator.clipboard.write(null));
}, 'navigator.clipboard.write(null) fails (expect {string : Blob})');
await promise_rejects(t, new TypeError(), navigator.clipboard.write(null));
}, 'navigator.clipboard.write(null) fails (expect [ClipboardItem])');
promise_test(async t => {
await promise_rejects(t, new TypeError(),
navigator.clipboard.write('Bad string'));
}, 'navigator.clipboard.write(DOMString) fails (expect {string : Blob})');
}, 'navigator.clipboard.write(DOMString) fails (expect [ClipboardItem])');
promise_test(async t => {
const blob = new Blob(['hello'], {type: 'text/plain'});
await promise_rejects(t, 'NotAllowedError',
navigator.clipboard.write(blob));
}, 'navigator.clipboard.write(Blob) fails (expect {string : Blob})');
await promise_rejects(t, new TypeError(), navigator.clipboard.write(blob));
}, 'navigator.clipboard.write(Blob) fails (expect [ClipboardItem])');
promise_test(async () => {
await navigator.clipboard.writeText('New clipboard text');
@ -50,13 +50,15 @@ promise_test(async () => {
const fetched = await fetch(
'http://localhost:8001/clipboard-apis/resources/greenbox.png');
const image = await fetched.blob();
const item = new ClipboardItem({'image/png': image});
await navigator.clipboard.write({'image/png' : image});
await navigator.clipboard.write([item]);
}, 'navigator.clipboard.write({string : image/png Blob}) succeeds');
promise_test(async () => {
const result = await navigator.clipboard.read();
assert_true(result instanceof Object);
assert_true(result[0] instanceof ClipboardItem);
}, 'navigator.clipboard.read() succeeds');
promise_test(async () => {

View file

@ -3,6 +3,7 @@
<title>
Async Clipboard write blobs -> read blobs tests
</title>
<link rel="help" href="https://w3c.github.io/clipboard-apis/#async-clipboard-api">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
@ -19,14 +20,22 @@ promise_test(async t => {
assert_equals(blobText.type, 'text/plain');
assert_equals(blobImage.type, 'image/png');
await navigator.clipboard.write(
const clipboardItemInput = new ClipboardItem(
{'text/plain' : blobText, 'image/png' : blobImage});
const output = await navigator.clipboard.read();
assert_equals(Object.keys(output).length, 2);
assert_equals(output['text/plain'].type, 'text/plain');
assert_equals(output['image/png'].type, 'image/png');
}, 'Verify write and read clipboard (multiple blobs)');
await navigator.clipboard.write([clipboardItemInput]);
const clipboardItems = await navigator.clipboard.read();
assert_equals(clipboardItems.length, 1);
const clipboardItem = clipboardItems[0];
assert_true(clipboardItem instanceof ClipboardItem);
assert_equals(clipboardItem.types.length, 2);
const blobTextOutput = await clipboardItem.getType('text/plain');
const blobImageOutput = await clipboardItem.getType('image/png');
assert_equals(blobTextOutput.type, 'text/plain');
assert_equals(blobImageOutput.type, 'image/png');
}, 'Verify write and read clipboard (multiple types)');
</script>
<p>
Note: This is a manual test because it writes/reads to the shared system

View file

@ -1,19 +1,25 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>
Async Clipboard write ([text/plain Blob]) -> read ([text/plain Blob]) tests
Async Clipboard write ([text/plain ClipboardItem]) ->
read ([text/plain ClipboardItem]) tests
</title>
<link rel="help" href="https://w3c.github.io/clipboard-apis/#async-clipboard-api">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
async function readWriteTest(textInput) {
promise_test(async t => {
const blobInput = new Blob([textInput], {type: 'text/plain'});
const clipboardItemInput = new ClipboardItem({'text/plain': blobInput});
await navigator.clipboard.write({'text/plain': blobInput});
const blobsOutput = await navigator.clipboard.read();
assert_equals(Object.keys(blobsOutput).length, 1);
const blobOutput = blobsOutput['text/plain'];
await navigator.clipboard.write([clipboardItemInput]);
const clipboardItems = await navigator.clipboard.read();
assert_equals(clipboardItems.length, 1);
const clipboardItemOutput = clipboardItems[0];
assert_true(clipboardItemOutput instanceof ClipboardItem);
assert_equals(clipboardItemOutput.types.length, 1);
const blobOutput = await clipboardItemOutput.getType('text/plain');
assert_equals(blobOutput.type, 'text/plain');
const textOutput = await (new Response(blobOutput)).text();
@ -21,7 +27,7 @@ async function readWriteTest(textInput) {
}, 'Verify write and read clipboard given text: ' + textInput);
}
readWriteTest('Clipboard write ([text/plain Blob]) -> read ([text/plain Blob]) test');
readWriteTest('Clipboard write ([text/plain ClipboardItem]) -> read ([text/plain ClipboardItem]) test');
readWriteTest('non-Latin1 text encoding test データ');
</script>
<p>

View file

@ -1,21 +1,25 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Async Clipboard write ([text/plain Blob]) -> readText tests</title>
<title>
Async Clipboard write ([text/plain ClipboardItem]) -> readText tests
</title>
<link rel="help" href="https://w3c.github.io/clipboard-apis/#async-clipboard-api">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
async function readWriteTest(textInput) {
promise_test(async t => {
const blobInput = new Blob([textInput], {type: 'text/plain'});
const clipboardItem = new ClipboardItem({'text/plain': blobInput});
await navigator.clipboard.write({'text/plain': blobInput});
await navigator.clipboard.write([clipboardItem]);
const textOutput = await navigator.clipboard.readText();
assert_equals(textOutput, textInput);
}, 'Verify write and read clipboard given text: ' + textInput);
}
readWriteTest('Clipboard write ([text/plain Blob]) -> read text test');
readWriteTest('Clipboard write ([text/plain ClipboardItem) -> read text test');
readWriteTest('non-Latin1 text encoding test データ');
</script>
<p>

View file

@ -1,8 +1,10 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>
Async Clipboard write [image/png Blob] -> read [image/png Blob] tests
Async Clipboard write [image/png ClipboardItem] ->
read [image/png ClipboardItem] tests
</title>
<link rel="help" href="https://w3c.github.io/clipboard-apis/#async-clipboard-api">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
@ -40,10 +42,15 @@ promise_test(async t => {
const blobInput = await loadBlob('resources/greenbox.png');
assert_equals(blobInput.type, 'image/png');
await navigator.clipboard.write({'image/png' : blobInput});
const blobsOutput = await navigator.clipboard.read();
assert_equals(Object.keys(blobsOutput).length, 1);
const blobOutput = blobsOutput['image/png'];
const clipboardItemInput = new ClipboardItem({'image/png' : blobInput});
await navigator.clipboard.write([clipboardItemInput]);
const clipboardItems = await navigator.clipboard.read();
assert_equals(clipboardItems.length, 1);
const clipboardItem = clipboardItems[0];
assert_true(clipboardItem instanceof ClipboardItem);
assert_equals(clipboardItem.types.length, 1);
const blobOutput = await clipboardItem.getType('image/png');
assert_equals(blobOutput.type, 'image/png');
document.getElementById('image-on-clipboard').src =
@ -53,7 +60,7 @@ promise_test(async t => {
const comparableOutput = await getBitmapString(blobOutput);
assert_equals(comparableOutput, comparableInput);
}, 'Verify write and read clipboard ([image/png Blob])');
}, 'Verify write and read clipboard [image/png Blob]');
</script>
<p>
Note: This is a manual test because it writes/reads to the shared system

View file

@ -1,15 +1,21 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Async Clipboard writeText -> read ([text/plain Blob]) tests</title>
<title>
Async Clipboard writeText -> read ([text/plain ClipboardItem]) tests
</title>
<link rel="help" href="https://w3c.github.io/clipboard-apis/#async-clipboard-api">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
async function readWriteTest(textInput) {
promise_test(async t => {
await navigator.clipboard.writeText(textInput);
const blobsOutput = await navigator.clipboard.read();
assert_equals(Object.keys(blobsOutput).length, 1);
const blobOutput = blobsOutput['text/plain'];
const clipboardItems = await navigator.clipboard.read();
assert_equals(clipboardItems.length, 1);
const clipboardItem = clipboardItems[0];
assert_true(clipboardItem instanceof ClipboardItem);
assert_equals(clipboardItem.types.length, 1);
const blobOutput = await clipboardItem.getType('text/plain');
assert_equals(blobOutput.type, 'text/plain');
const textOutput = await (new Response(blobOutput)).text();
@ -17,7 +23,7 @@ async function readWriteTest(textInput) {
}, 'Verify write and read clipboard given text: ' + textInput);
}
readWriteTest('Clipboard write text -> read ([text/plain Blob]) test');
readWriteTest('Clipboard write text -> read ([text/plain ClipboardItem]) test');
readWriteTest('non-Latin1 text encoding test データ');
</script>
<p>

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Async Clipboard writeText -> readText tests</title>
<link rel="help" href="https://w3c.github.io/clipboard-apis/#async-clipboard-api">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>

View file

@ -0,0 +1,78 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>ClipboardItem tests</title>
<link rel="help" href="https://w3c.github.io/clipboard-apis/#async-clipboard-api">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
const blob = new Blob(['hello'], {type: 'text/plain'});
const blob2 = new Blob(['this should work'], {type: 'not a/real type'});
test(() => {
new ClipboardItem({'text/plain': blob});
new ClipboardItem({'text/plain': blob, 'not a/real type': blob2});
}, "ClipboardItem({string, Blob}) succeeds with different types");
test(() => {
new ClipboardItem({'text/plain': blob}, {});
}, "ClipboardItem() succeeds with empty options");
test(() => {
assert_throws(new TypeError(), () => {new ClipboardItem({});});
}, "ClipboardItem({}) fails with empty dictionary input");
test(() => {
assert_throws(new TypeError(), () => {new ClipboardItem(blob);});
}, "ClipboardItem(Blob) fails");
test(() => {
assert_throws(new TypeError(), () => {new ClipboardItem(null);});
}, "ClipboardItem() fails with null input");
test(() => {
assert_throws(new TypeError(), () => {new ClipboardItem();});
}, "ClipboardItem() fails with no input");
test(() => {
const item = new ClipboardItem({'text/plain': blob});
const types = item.types;
assert_equals(types.length, 1);
assert_equals(types[0], 'text/plain');
const item2 =
new ClipboardItem({'text/plain': blob, 'not a/real type': blob2});
const types2 = item2.types;
assert_equals(types2.length, 2);
assert_equals(types2[0], 'text/plain');
assert_equals(types2[1], 'not a/real type');
}, "types() returns correct values");
promise_test(async () => {
const item =
new ClipboardItem({'text/plain': blob, 'not a/real type': blob2});
const blobOutput = await item.getType('text/plain');
assert_true(blobOutput.type.includes('text/plain'));
const text = await (new Response(blobOutput)).text();
assert_equals('hello', text);
}, "getType(DOMString valid type) succeeds with correct output");
promise_test(async () => {
const item =
new ClipboardItem({'text/plain': blob, 'not a/real type': blob2});
const blobOutput = await item.getType('not a/real type');
assert_true(blobOutput.type.includes('not a/real type'));
const text = await (new Response(blobOutput)).text();
assert_equals('this should work', text);
}, "getType(DOMString invalid type) succeeds with correct output");
promise_test(async t => {
const item =
new ClipboardItem({'text/plain': blob, 'not a/real type': blob2});
promise_rejects(t, "NotFoundError", item.getType('type not in item'));
promise_rejects(t, "NotFoundError", item.getType('text/plain:subtype'));
}, "getType(DOMString type) rejects correctly when querying for missing type");
</script>

View file

@ -3,9 +3,12 @@ function get_host_info() {
var HTTP_PORT = '{{ports[http][0]}}';
var HTTP_PORT2 = '{{ports[http][1]}}';
var HTTPS_PORT = '{{ports[https][0]}}';
var PROTOCOL = window.location.protocol;
var IS_HTTPS = (PROTOCOL == "https:");
var HTTP_PORT_ELIDED = HTTP_PORT == "80" ? "" : (":" + HTTP_PORT);
var HTTP_PORT2_ELIDED = HTTP_PORT2 == "80" ? "" : (":" + HTTP_PORT2);
var HTTPS_PORT_ELIDED = HTTPS_PORT == "443" ? "" : (":" + HTTPS_PORT);
var PORT_ELIDED = IS_HTTPS ? HTTPS_PORT_ELIDED : HTTP_PORT_ELIDED;
var ORIGINAL_HOST = '{{host}}';
var REMOTE_HOST = (ORIGINAL_HOST === 'localhost') ? '127.0.0.1' : ('www1.' + ORIGINAL_HOST);
var OTHER_HOST = '{{domains[www2]}}';
@ -18,10 +21,12 @@ function get_host_info() {
ORIGINAL_HOST: ORIGINAL_HOST,
REMOTE_HOST: REMOTE_HOST,
ORIGIN: PROTOCOL + "//" + ORIGINAL_HOST + PORT_ELIDED,
HTTP_ORIGIN: 'http://' + ORIGINAL_HOST + HTTP_PORT_ELIDED,
HTTPS_ORIGIN: 'https://' + ORIGINAL_HOST + HTTPS_PORT_ELIDED,
HTTPS_ORIGIN_WITH_CREDS: 'https://foo:bar@' + ORIGINAL_HOST + HTTPS_PORT_ELIDED,
HTTP_ORIGIN_WITH_DIFFERENT_PORT: 'http://' + ORIGINAL_HOST + HTTP_PORT2_ELIDED,
REMOTE_ORIGIN: PROTOCOL + "//" + REMOTE_HOST + PORT_ELIDED,
HTTP_REMOTE_ORIGIN: 'http://' + REMOTE_HOST + HTTP_PORT_ELIDED,
HTTP_NOTSAMESITE_ORIGIN: 'http://' + NOTSAMESITE_HOST + HTTP_PORT_ELIDED,
HTTP_REMOTE_ORIGIN_WITH_DIFFERENT_PORT: 'http://' + REMOTE_HOST + HTTP_PORT2_ELIDED,

View file

@ -0,0 +1,22 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Text level 3 Test: overflow-wrap:break-word and grapheme clusters</title>
<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
<link rel="help" href="https://www.w3.org/TR/css-text-3/#overflow-wrap-property">
<link rel="match" href="reference/overflow-wrap-cluster-001-ref.html">
<meta name="assert" content="grapheme clusters must stay together as one unit when a line is broken by overflow-wrap:break-word">
<style>
div {
font-size: 4em;
margin: 1rem;
width: 4em;
}
#test {
overflow-wrap: break-word;
width: 0;
}
</style>
<p>Test passes if there are four identical lines of text below.
<div lang=hi id=ref>&#x0937;&#x093F;<br>&#x0937;&#x093F;</div>
<div lang=hi id=test>&#x0937;&#x093F;&#x0937;&#x093F;</div>

View file

@ -0,0 +1,22 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Text level 3 Test: overflow-wrap:anywhere and grapheme clusters</title>
<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
<link rel="help" href="https://www.w3.org/TR/css-text-3/#overflow-wrap-property">
<link rel="match" href="reference/overflow-wrap-cluster-001-ref.html">
<meta name="assert" content="grapheme clusters must stay together as one unit when a line is broken by overflow-wrap:break-word">
<style>
div {
font-size: 4em;
margin: 1rem;
width: 4em;
}
#test {
overflow-wrap: anywhere;
width: 0;
}
</style>
<p>Test passes if there are four identical lines of text below.
<div lang=hi id=ref>&#x0937;&#x093F;<br>&#x0937;&#x093F;</div>
<div lang=hi id=test>&#x0937;&#x093F;&#x0937;&#x093F;</div>

View file

@ -0,0 +1,18 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Text level 3 Test: word-break-keep-all and overflow-wrap:normal</title>
<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
<link rel="help" href="https://www.w3.org/TR/css-text-3/#overflow-wrap-property">
<link rel="match" href="reference/overflow-wrap-normal-keep-all-001-ref.html">
<meta name="flags" content="may">
<meta name="assert" content="with overflow-wrap:normal, the restrictions introduced by word-break:keep-all may be relaxed to match word-break:normal if there are no otherwise-acceptable break points in the line.">
<style>
div {
overflow-wrap: normal;
word-break: keep-all;
width: 0;
}
</style>
<p>Test passes if there is a column of 文 characters on top of eachother below.
<div lang=ja>文文文文文文文文</div>

View file

@ -0,0 +1,17 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Text level 3 Test reference</title>
<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
<style>
div {
font-size: 4em;
margin: 1rem;
width: 4em;
}
</style>
<p>Test passes if there are four identical lines of text below.
<div lang=hi>&#x0937;&#x093F;</div>
<div lang=hi>&#x0937;&#x093F;</div>
<div lang=hi>&#x0937;&#x093F;</div>
<div lang=hi>&#x0937;&#x093F;</div>

View file

@ -0,0 +1,7 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Text level 3 Test reference</title>
<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/">
<p>Test passes if there is a column of 文 characters on top of eachother below.
<div lang=ja><br><br><br><br><br><br><br></div>

View file

@ -7,8 +7,8 @@ const ignore_features_for_auxilary_context = ["popups", "scripts"];
// Feature-policies that represent specific sandbox flags.
const sandbox_features = [
"forms", "modals", "orientation-lock", "pointer-lock", "popups",
"presentation", "scripts", "top-navigation"];
"downloads-without-user-activation", "forms", "modals", "orientation-lock",
"pointer-lock", "popups", "presentation", "scripts", "top-navigation"];
// TODO(ekaramad): Figure out different inheritance requirements for different
// policies.

View file

@ -11,16 +11,13 @@ enum WakeLockType { "screen", "system" };
[Constructor(WakeLockType type), SecureContext, Exposed=(DedicatedWorker,Window)]
interface WakeLock : EventTarget {
[Exposed=Window] static Promise<PermissionState> requestPermission(WakeLockType type);
readonly attribute WakeLockType type;
readonly attribute boolean active;
attribute EventHandler onactivechange;
Promise<void> request(optional WakeLockRequestOptions options);
Promise<void> request();
void abort();
static sequence<WakeLock> query(optional WakeLockQueryFilter filter);
[Exposed=Window] static Promise<PermissionState> requestPermission(WakeLockType type);
};
dictionary WakeLockRequestOptions {
AbortSignal? signal;
};
dictionary WakeLockQueryFilter {

View file

@ -10,12 +10,18 @@ partial interface Navigator {
[SecureContext, Exposed=Window] interface XR : EventTarget {
// Methods
Promise<void> supportsSessionMode(XRSessionMode mode);
Promise<XRSession> requestSession(optional XRSessionCreationOptions parameters);
Promise<XRSession> requestSession(XRSessionMode mode);
// Events
attribute EventHandler ondevicechange;
};
enum XRSessionMode {
"inline",
"immersive-vr",
"immersive-ar"
};
enum XREnvironmentBlendMode {
"opaque",
"additive",
@ -50,19 +56,10 @@ enum XREnvironmentBlendMode {
attribute EventHandler onselectend;
};
enum XRSessionMode {
"inline",
"immersive-vr",
"immersive-ar"
};
dictionary XRSessionCreationOptions {
XRSessionMode mode = "inline";
};
dictionary XRRenderStateInit {
double depthNear;
double depthFar;
double inlineVerticalFieldOfView;
XRLayer? baseLayer;
XRPresentationContext? outputContext;
};
@ -70,6 +67,7 @@ dictionary XRRenderStateInit {
[SecureContext, Exposed=Window] interface XRRenderState {
readonly attribute double depthNear;
readonly attribute double depthFar;
readonly attribute double? inlineVerticalFieldOfView;
readonly attribute XRLayer? baseLayer;
readonly attribute XRPresentationContext? outputContext;
};

View file

@ -13,7 +13,7 @@
<p>The test passes if the arrow has a leading space of 100px, which is as wide as the black block to the left,
and a trailing space of 200px, which is as wide as the black block to the right.</p>
<mth>
<math>
<mspace width="100px" height="10px" depth="10px" style="background: black"></mspace>
<mo lspace="100px" rspace="200px"></mo>
<mspace width="200px" height="10px" depth="10px" style="background: black"></mspace>

View file

@ -1,12 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>SVG requiredExtensions</title>
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#dom">
<meta name="assert" content="Verify whether the MathML namespace is recognized as a required extensions of SVG foreignObject when using the hasExtension javascript function.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(function() {
assert_true(document.createElementNS("http://www.w3.org/2000/svg", "foreignObject").hasExtension("http://www.w3.org/1998/Math/MathML"))
}, "Testing foreignObject.hasExtension('http://www.w3.org/1998/Math/MathML')");
</script>

View file

@ -0,0 +1,72 @@
// META: script=resources/test-helpers.js
promise_test(async t => cleanupSandboxedFileSystem(),
'Cleanup to setup test environment');
promise_test(async t => {
const old_handle = await createFileWithContents(t, 'old-file', '12345');
const dir = await old_handle.getParent();
const new_handle = await old_handle.copyTo(dir, 'new-name');
t.add_cleanup(() => new_handle.remove());
// Verify new file.
assert_true(new_handle.isFile);
assert_false(new_handle.isDirectory);
assert_equals(new_handle.name, 'new-name');
assert_equals(await getFileContents(new_handle), '12345');
// And verify old file is still around as well.
assert_equals(await getFileContents(old_handle), '12345');
// Verify directory entries.
assert_array_equals(await getSortedDirectoryEntries(dir), ['new-name', 'old-file']);
}, 'copyTo() into the same parent directory');
promise_test(async t => {
const dir = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
const old_handle = await createFileWithContents(t, 'old-file', '12345');
const target_dir = await dir.getDirectory('dir-name', { create: true });
t.add_cleanup(() => target_dir.removeRecursively());
const new_handle = await old_handle.copyTo(target_dir);
// Verify new file.
assert_true(new_handle.isFile);
assert_false(new_handle.isDirectory);
assert_equals(new_handle.name, 'old-file');
assert_equals(await getFileContents(new_handle), '12345');
// And verify old file is still around as well.
assert_equals(await getFileContents(old_handle), '12345');
// Verify directory entries.
assert_array_equals(await getSortedDirectoryEntries(dir), ['dir-name/', 'old-file']);
assert_array_equals(await getSortedDirectoryEntries(target_dir), ['old-file']);
}, 'copyTo() to copy a file into a sub-directory');
promise_test(async t => {
const handle = await createFileWithContents(t, 'old-file', '12345');
const dir = await handle.getParent();
await promise_rejects(t, 'InvalidModificationError', handle.copyTo(dir));
await promise_rejects(t, 'InvalidModificationError', handle.copyTo(dir, handle.name));
// Verify file still exists.
assert_equals(await getFileContents(handle), '12345');
assert_array_equals(await getSortedDirectoryEntries(dir), ['old-file']);
}, 'copyTo() with existing name and parent should fail');
promise_test(async t => {
const handle = await createFileWithContents(t, 'old-file', '12345');
const target_handle = await createFileWithContents(t, 'target', 'abc');
const dir = await handle.getParent();
await handle.copyTo(dir, target_handle.name);
// Verify state of files.
assert_equals(await getFileContents(handle), '12345');
assert_equals(await getFileContents(target_handle), '12345');
assert_array_equals(await getSortedDirectoryEntries(dir), ['old-file', 'target']);
}, 'copyTo() when target file already exists should overwrite target');
// TODO(mek): Tests to copy directories.

View file

@ -0,0 +1,72 @@
// META: script=resources/test-helpers.js
promise_test(async t => cleanupSandboxedFileSystem(),
'Cleanup to setup test environment');
promise_test(async t => {
const old_handle = await createFileWithContents(t, 'old-file', '12345');
const dir = await old_handle.getParent();
const new_handle = await old_handle.moveTo(dir, 'new-name');
t.add_cleanup(() => new_handle.remove());
// Verify new file.
assert_true(new_handle.isFile);
assert_false(new_handle.isDirectory);
assert_equals(new_handle.name, 'new-name');
assert_equals(await getFileContents(new_handle), '12345');
// And verify old file is gone.
await promise_rejects(t, 'NotFoundError', getFileContents(old_handle));
// Verify directory entries.
assert_array_equals(await getSortedDirectoryEntries(dir), ['new-name']);
}, 'moveTo() to rename a file');
promise_test(async t => {
const dir = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
const old_handle = await createFileWithContents(t, 'old-file', '12345');
const target_dir = await dir.getDirectory('dir-name', { create: true });
t.add_cleanup(() => target_dir.removeRecursively());
const new_handle = await old_handle.moveTo(target_dir);
// Verify new file.
assert_true(new_handle.isFile);
assert_false(new_handle.isDirectory);
assert_equals(new_handle.name, 'old-file');
assert_equals(await getFileContents(new_handle), '12345');
// And verify old file is gone.
await promise_rejects(t, 'NotFoundError', getFileContents(old_handle));
// Verify directory entries.
assert_array_equals(await getSortedDirectoryEntries(dir), ['dir-name/']);
assert_array_equals(await getSortedDirectoryEntries(target_dir), ['old-file']);
}, 'moveTo() to move a file into a sub-directory');
promise_test(async t => {
const handle = await createFileWithContents(t, 'old-file', '12345');
const dir = await handle.getParent();
await promise_rejects(t, 'InvalidModificationError', handle.moveTo(dir));
await promise_rejects(t, 'InvalidModificationError', handle.moveTo(dir, handle.name));
// Verify file still exists.
assert_equals(await getFileContents(handle), '12345');
assert_array_equals(await getSortedDirectoryEntries(dir), ['old-file']);
}, 'moveTo() with existing name and parent should fail');
promise_test(async t => {
const handle = await createFileWithContents(t, 'old-file', '12345');
const target_handle = await createFileWithContents(t, 'target', 'abc');
const dir = await handle.getParent();
await handle.moveTo(dir, target_handle.name);
// Verify state of files.
await promise_rejects(t, 'NotFoundError', getFileContents(handle));
assert_equals(await getFileContents(target_handle), '12345');
assert_array_equals(await getSortedDirectoryEntries(dir), ['target']);
}, 'moveTo() when target file already exists should overwrite target');
// TODO(mek): Tests to move directories.

View file

@ -0,0 +1,41 @@
// META: script=resources/test-helpers.js
promise_test(async t => cleanupSandboxedFileSystem(),
'Cleanup to setup test environment');
promise_test(async t => {
const handle = await createFileWithContents(t, 'file-to-remove', '12345');
const dir = await handle.getParent();
await createFileWithContents(t, 'file-to-keep', 'abc');
await handle.remove();
assert_array_equals(await getSortedDirectoryEntries(dir), ['file-to-keep']);
await promise_rejects(t, 'NotFoundError', getFileContents(handle));
}, 'remove() to remove a file');
promise_test(async t => {
const handle = await createFileWithContents(t, 'file-to-remove', '12345');
await handle.remove();
await promise_rejects(t, 'NotFoundError', handle.remove());
}, 'remove() on an already removed file should fail');
promise_test(async t => {
const root = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
const dir = await root.getDirectory('dir-to-remove', { create: true });
await createFileWithContents(t, 'file-to-keep', 'abc');
await dir.remove();
assert_array_equals(await getSortedDirectoryEntries(root), ['file-to-keep']);
await promise_rejects(t, 'NotFoundError', getSortedDirectoryEntries(dir));
}, 'remove() to remove an empty directory');
promise_test(async t => {
const root = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
const dir = await root.getDirectory('dir-to-remove', { create: true });
t.add_cleanup(() => dir.removeRecursively());
await createEmptyFile(t, 'file-in-dir', dir);
await promise_rejects(t, 'InvalidModificationError', dir.remove());
assert_array_equals(await getSortedDirectoryEntries(root), ['dir-to-remove/']);
assert_array_equals(await getSortedDirectoryEntries(dir), ['file-in-dir']);
}, 'remove() on a non-empty directory should fail');

View file

@ -0,0 +1,57 @@
// META: script=resources/test-helpers.js
promise_test(async t => cleanupSandboxedFileSystem(),
'Cleanup to setup test environment');
promise_test(async t => {
const root = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
await promise_rejects(t, 'NotFoundError', root.getDirectory('non-existing-dir'));
}, 'getDirectory(create=false) rejects for non-existing directories');
promise_test(async t => {
const root = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
const handle = await root.getDirectory('non-existing-dir', { create: true });
t.add_cleanup(() => handle.removeRecursively());
assert_false(handle.isFile);
assert_true(handle.isDirectory);
assert_equals(handle.name, 'non-existing-dir');
assert_equals(await getDirectoryEntryCount(handle), 0);
assert_array_equals(await getSortedDirectoryEntries(root), ['non-existing-dir/']);
}, 'getDirectory(create=true) creates an empty directory');
promise_test(async t => {
const root = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
const existing_handle = await root.getDirectory('dir-with-contents', { create: true });
t.add_cleanup(() => existing_handle.removeRecursively());
const file_handle = await createEmptyFile(t, 'test-file', existing_handle);
const handle = await root.getDirectory('dir-with-contents', { create: false });
assert_false(handle.isFile);
assert_true(handle.isDirectory);
assert_equals(handle.name, 'dir-with-contents');
assert_array_equals(await getSortedDirectoryEntries(handle), ['test-file']);
}, 'getDirectory(create=false) returns existing directories');
promise_test(async t => {
const root = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
const existing_handle = await root.getDirectory('dir-with-contents', { create: true });
t.add_cleanup(() => existing_handle.removeRecursively());
const file_handle = await existing_handle.getFile('test-file', { create: true });
const handle = await root.getDirectory('dir-with-contents', { create: true });
assert_false(handle.isFile);
assert_true(handle.isDirectory);
assert_equals(handle.name, 'dir-with-contents');
assert_array_equals(await getSortedDirectoryEntries(handle), ['test-file']);
}, 'getDirectory(create=true) returns existing directories without erasing');
promise_test(async t => {
const root = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
await createEmptyFile(t, 'file-name');
await promise_rejects(t, 'TypeMismatchError', root.getDirectory('file-name'));
await promise_rejects(t, 'TypeMismatchError', root.getDirectory('file-name', { create: false }));
await promise_rejects(t, 'TypeMismatchError', root.getDirectory('file-name', { create: true }));
}, 'getDirectory() when a file already exists with the same name');

View file

@ -0,0 +1,62 @@
// META: script=resources/test-helpers.js
promise_test(async t => cleanupSandboxedFileSystem(),
'Cleanup to setup test environment');
promise_test(async t => {
const dir = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
await promise_rejects(t, 'NotFoundError', dir.getFile('non-existing-file'));
}, 'getFile(create=false) rejects for non-existing files');
promise_test(async t => {
const dir = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
const handle = await dir.getFile('non-existing-file', { create: true });
t.add_cleanup(() => handle.remove());
assert_true(handle.isFile);
assert_false(handle.isDirectory);
assert_equals(handle.name, 'non-existing-file');
assert_equals(await getFileSize(handle), 0);
assert_equals(await getFileContents(handle), '');
}, 'getFile(create=true) creates an empty file for non-existing files');
promise_test(async t => {
const existing_handle = await createFileWithContents(t, 'existing-file', '1234567890');
const dir = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
const handle = await dir.getFile('existing-file');
assert_true(handle.isFile);
assert_false(handle.isDirectory);
assert_equals(handle.name, 'existing-file');
assert_equals(await getFileSize(handle), 10);
assert_equals(await getFileContents(handle), '1234567890');
}, 'getFile(create=false) returns existing files');
promise_test(async t => {
const existing_handle = await createFileWithContents(t, 'file-with-contents', '1234567890');
const dir = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
const handle = await dir.getFile('file-with-contents', { create: true });
assert_true(handle.isFile);
assert_false(handle.isDirectory);
assert_equals(handle.name, 'file-with-contents');
assert_equals(await getFileSize(handle), 10);
assert_equals(await getFileContents(handle), '1234567890');
}, 'getFile(create=true) returns existing files without erasing');
promise_test(async t => {
const dir = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
const dir_handle = await dir.getDirectory('dir-name', { create: true });
t.add_cleanup(() => dir_handle.removeRecursively());
await promise_rejects(t, 'TypeMismatchError', dir.getFile('dir-name'));
}, 'getFile(create=false) when a directory already exists with the same name');
promise_test(async t => {
const dir = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
const dir_handle = await dir.getDirectory('dir-name', { create: true });
t.add_cleanup(() => dir_handle.removeRecursively());
await promise_rejects(t, 'TypeMismatchError', dir.getFile('dir-name', { create: true }));
}, 'getFile(create=true) when a directory already exists with the same name');

View file

@ -0,0 +1,96 @@
// META: script=resources/test-helpers.js
promise_test(async t => cleanupSandboxedFileSystem(),
'Cleanup to setup test environment');
promise_test(async t => {
const handle = await createEmptyFile(t, 'empty_blob');
const writer = await handle.createWriter();
await writer.write(0, new Blob([]));
assert_equals(await getFileContents(handle), '');
assert_equals(await getFileSize(handle), 0);
}, 'write() with an empty blob to an empty file');
promise_test(async t => {
const handle = await createEmptyFile(t, 'valid_blob');
const writer = await handle.createWriter();
await writer.write(0, new Blob(['1234567890']));
assert_equals(await getFileContents(handle), '1234567890');
assert_equals(await getFileSize(handle), 10);
}, 'write() a blob to an empty file');
promise_test(async t => {
const handle = await createEmptyFile(t, 'blob_with_offset');
const writer = await handle.createWriter();
await writer.write(0, new Blob(['1234567890']));
await writer.write(4, new Blob(['abc']));
assert_equals(await getFileContents(handle), '1234abc890');
assert_equals(await getFileSize(handle), 10);
}, 'write() called with a blob and a valid offset');
promise_test(async t => {
const handle = await createEmptyFile(t, 'bad_offset');
const writer = await handle.createWriter();
await promise_rejects(t, 'InvalidStateError', writer.write(4, new Blob(['abc'])));
assert_equals(await getFileContents(handle), '');
assert_equals(await getFileSize(handle), 0);
}, 'write() called with an invalid offset');
promise_test(async t => {
const handle = await createEmptyFile(t, 'trunc_shrink');
const writer = await handle.createWriter();
await writer.write(0, new Blob(['1234567890']));
await writer.truncate(5);
assert_equals(await getFileContents(handle), '12345');
assert_equals(await getFileSize(handle), 5);
}, 'truncate() to shrink a file');
promise_test(async t => {
const handle = await createEmptyFile(t, 'trunc_grow');
const writer = await handle.createWriter();
await writer.write(0, new Blob(['abc']));
await writer.truncate(5);
assert_equals(await getFileContents(handle), 'abc\0\0');
assert_equals(await getFileSize(handle), 5);
}, 'truncate() to grow a file');
promise_test(async t => {
const handle = await createEmptyFile(t, 'write_stream');
const writer = await handle.createWriter();
const stream = new Response('1234567890').body;
await writer.write(0, stream);
assert_equals(await getFileContents(handle), '1234567890');
assert_equals(await getFileSize(handle), 10);
}, 'write() called with a ReadableStream');
promise_test(async t => {
const handle = await createEmptyFile(t, 'write_stream');
const handle_writer = await handle.createWriter();
const { writable, readable } = new TransformStream();
const write_result = handle_writer.write(0, readable);
const stream_writer = writable.getWriter();
stream_writer.write(new Uint8Array([0x73, 0x74, 0x72, 0x65, 0x61, 0x6D, 0x73, 0x21]));
garbageCollect();
stream_writer.write(new Uint8Array([0x21, 0x21]));
stream_writer.close();
await write_result;
assert_equals(await getFileContents(handle), 'streams!!!');
assert_equals(await getFileSize(handle), 10);
}, 'Using a WritableStream writer to write');

View file

@ -0,0 +1,2 @@
This directory contains (tentative) tests for the
[Native File System](https://wicg.github.io/native-file-system/) specification.

View file

@ -0,0 +1,67 @@
async function cleanupSandboxedFileSystem() {
const dir = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
for await (let entry of dir.getEntries()) {
if (entry.isDirectory)
await entry.removeRecursively();
else
await entry.remove();
}
}
async function getFileSize(handle) {
const file = await handle.getFile();
return file.size;
}
async function getFileContents(handle) {
const file = await handle.getFile();
return new Response(file).text();
}
async function getDirectoryEntryCount(handle) {
let result = 0;
for await (let entry of handle.getEntries()) {
result++;
}
return result;
}
async function getSortedDirectoryEntries(handle) {
let result = [];
for await (let entry of handle.getEntries()) {
if (entry.isDirectory)
result.push(entry.name + '/');
else
result.push(entry.name);
}
result.sort();
return result;
}
async function createEmptyFile(test, name, parent) {
const dir = parent ? parent : await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
const handle = await dir.getFile(name, { create: true });
test.add_cleanup(async () => {
try {
await handle.remove();
} catch (e) {
// Ignore any errors when removing files, as tests might already remove the file.
}
});
// Make sure the file is empty.
assert_equals(await getFileSize(handle), 0);
return handle;
}
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]));
return handle;
}
function garbageCollect() {
// TODO(https://github.com/web-platform-tests/wpt/issues/7899): Change to
// some sort of cross-browser GC trigger.
if (self.gc) self.gc();
};

View file

@ -0,0 +1,46 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<title>This test validates resource timing information for a same-origin=>cross-origin=>same-origin redirect chain with Timing-Allow-Origin.</title>
<link rel="help" href="http://www.w3.org/TR/resource-timing/#performanceresourcetiming"/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="resources/webperftestharness.js"></script>
<script src="resources/webperftestharnessextension.js"></script>
<script>
setup({explicit_done: true});
test_namespace('getEntriesByName');
const pageOrigin = get_host_info()['ORIGIN'];
const crossOrigin = get_host_info()['REMOTE_ORIGIN'];
function onload_test()
{
const entries = performance.getEntriesByName(document.getElementById('frameContext').src, 'resource');
test_equals(entries.length, 1, 'There should be one entry.');
const entry = entries[0];
test_greater_than(entry.redirectStart, 0, 'redirectStart > 0 in cross-origin redirect with Timing-Allow-Origin.');
test_greater_than(entry.redirectEnd, 0, 'redirectEnd > 0 in cross-origin redirect with Timing-Allow-Origin.');
test_greater_than(entry.fetchStart, 0, 'fetchStart > 0 in cross-origin redirect.');
test_greater_than(entry.fetchStart, entry.startTime, 'startTime < fetchStart in cross-origin redirect with Timing-Allow-Origin.');
done();
}
</script>
</head>
<body>
<iframe id="frameContext" src="" style="width: 250px; height: 250px;"></iframe>
<script>
let destUrl = pageOrigin + '/resource-timing/resources/multi_redirect.py?';
destUrl += 'page_origin=' + pageOrigin;
destUrl += '&timing_allow=1';
destUrl += '&cross_origin=' + crossOrigin;
const frameContext = document.getElementById('frameContext');
frameContext.onload = onload_test;
frameContext.src = destUrl;
</script>
</body>
</html>

View file

@ -0,0 +1,45 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<title>This test validates resource timing information for a same-origin=>cross-origin=>same-origin redirect chain without Timing-Allow-Origin.</title>
<link rel="help" href="http://www.w3.org/TR/resource-timing/#performanceresourcetiming"/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="resources/webperftestharness.js"></script>
<script src="resources/webperftestharnessextension.js"></script>
<script>
setup({explicit_done: true});
test_namespace('getEntriesByName');
const pageOrigin = get_host_info()['ORIGIN'];
const crossOrigin = get_host_info()['REMOTE_ORIGIN'];
function onload_test()
{
const entries = performance.getEntriesByName(document.getElementById('frameContext').src, 'resource');
test_equals(entries.length, 1, 'There should be one entry.');
const entry = entries[0];
test_equals(entry.redirectStart, 0, 'redirectStart == 0 in cross-origin redirect with no Timing-Allow-Origin.');
test_equals(entry.redirectEnd, 0, 'redirectEnd == 0 in cross-origin redirect with no Timing-Allow-Origin.');
test_greater_than(entry.fetchStart, 0, 'fetchStart > 0 in cross-origin redirect.');
test_equals(entry.fetchStart, entry.startTime, 'startTime == fetchStart in cross-origin redirect with no Timing-Allow-Origin.');
done();
}
</script>
</head>
<body>
<iframe id="frameContext" src="" style="width: 250px; height: 250px;"></iframe>
<script>
let destUrl = pageOrigin + '/resource-timing/resources/multi_redirect.py?';
destUrl += 'page_origin=' + pageOrigin;
destUrl += '&cross_origin=' + crossOrigin;
const frameContext = document.getElementById('frameContext');
frameContext.onload = onload_test;
frameContext.src = destUrl;
</script>
</body>
</html>

View file

@ -13,27 +13,31 @@ def main(request, response):
except ValueError:
pass
origin = request.url_parts.scheme + "://" + request.url_parts.hostname + ":" + str(request.url_parts.port)
page_origin = request.GET.first("page_origin")
cross_origin = request.GET.first("cross_origin")
timing_allow = "0"
if "timing_allow" in request.GET:
timing_allow = request.GET.first("timing_allow")
redirect_url = "/resource-timing/resources/multi_redirect.py?"
redirect_url += "page_origin=" + page_origin
redirect_url += "&cross_origin=" + cross_origin
redirect_url += "&timing_allow=" + timing_allow
redirect_url += "&step="
redirect_url_path = "/resource-timing/resources/multi_redirect.py?"
redirect_url_path += "page_origin=" + page_origin
redirect_url_path += "&cross_origin=" + cross_origin
redirect_url_path += "&timing_allow=" + timing_allow
redirect_url_path += "&step="
if step == 1:
redirect_url = cross_origin + redirect_url + "2"
if timing_allow != "0":
# On the first request, redirect to a cross origin URL
redirect_url = cross_origin + redirect_url_path + "2"
if timing_allow != "0" and origin != page_origin:
response.headers.set("timing-allow-origin", page_origin)
elif step == 2:
redirect_url = page_origin + redirect_url + "3"
# On the second request, redirect to a same origin URL
redirect_url = page_origin + redirect_url_path + "3"
if timing_allow != "0":
response.headers.set("timing-allow-origin", page_origin)
else:
# On the third request, redirect to a static response
redirect_url = page_origin + "/resource-timing/resources/blank_page_green.htm"
response.status = 302

View file

@ -434,7 +434,7 @@
return err;
var kVersionSizes = [
{version: 0, numBytes: 16}
{version: 0, numBytes: 24}
];
err = messageValidator.validateStructVersion(offset, kVersionSizes);
if (err !== validator.validationError.NONE)
@ -445,15 +445,15 @@
return validator.validationError.NONE;
};
Point2D.encodedSize = codec.kStructHeaderSize + 8;
Point2D.encodedSize = codec.kStructHeaderSize + 16;
Point2D.decode = function(decoder) {
var packed;
var val = new Point2D();
var numberOfBytes = decoder.readUint32();
var version = decoder.readUint32();
val.x = decoder.decodeStruct(codec.Float);
val.y = decoder.decodeStruct(codec.Float);
val.x = decoder.decodeStruct(codec.Double);
val.y = decoder.decodeStruct(codec.Double);
return val;
};
@ -461,8 +461,8 @@
var packed;
encoder.writeUint32(Point2D.encodedSize);
encoder.writeUint32(0);
encoder.encodeStruct(codec.Float, val.x);
encoder.encodeStruct(codec.Float, val.y);
encoder.encodeStruct(codec.Double, val.x);
encoder.encodeStruct(codec.Double, val.y);
};
function PhotoSettings(values) {
this.initDefaults_();

View file

@ -3,6 +3,6 @@ mozinfo==1.1.0
mozlog==4.0
mozdebug==0.1.1
pillow==6.0.0
urllib3[secure]==1.24.1
urllib3[secure]==1.24.2
requests==2.21.0
six>=1.8

View file

@ -9,6 +9,6 @@
"Tests requestSession resolves when supported",
(session) => {
assert_not_equals(session, null);
}, { supportsImmersive:true }, { mode: 'immersive-vr' });
}, { supportsImmersive:true }, 'immersive-vr');
</script>
</body>

View file

@ -9,7 +9,7 @@
(t) => {
return XRTest.simulateDeviceConnection({ supportsImmersive:true })
.then( (controller) => promise_rejects(
t, 'SecurityError', navigator.xr.requestSession({ mode: 'immersive-vr' })));
t, 'SecurityError', navigator.xr.requestSession('immersive-vr')));
});
</script>
</body>

View file

@ -13,7 +13,7 @@
resolve(promise_rejects(
t,
"NotSupportedError",
navigator.xr.requestSession({ mode: 'immersive-vr' })
navigator.xr.requestSession('immersive-vr')
))
});
}));

View file

@ -0,0 +1,22 @@
<!DOCTYPE html>
<body>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="resources/webxr_util.js"></script>
<script>
xr_promise_test(
"Requesting a session with no mode rejects",
(t) => {
return XRTest.simulateDeviceConnection({ supportsImmersive:false })
.then( (controller) => new Promise((resolve) => {
XRTest.simulateUserActivation( () => {
resolve(promise_rejects(
t,
new TypeError(),
navigator.xr.requestSession()
))
});
}));
});
</script>
</body>

View file

@ -8,9 +8,7 @@
"Requesting non-immersive session outside of a user gesture succeeds",
(t) => {
return XRTest.simulateDeviceConnection({ supportsImmersive:false })
.then( (controller) => navigator.xr.requestSession({
mode: 'inline'
}))
.then( (controller) => navigator.xr.requestSession('inline'))
.then( (session) => { assert_not_equals(session, null); });
});
</script>

View file

@ -12,8 +12,6 @@ let immersiveTestName = "XRFrame.getPose works for immersive sessions";
let nonImmersiveTestName = "XRFrame.getPose works for non-immersive sessions";
let fakeDeviceInitParams = { supportsImmersive:true };
let immersiveSessionOptions = { mode: 'immersive-vr' };
let nonImmersiveSessionOptions = { outputContext: getOutputContext() };
let testFunction = function(session, fakeDeviceController, t) {
// Need to have a valid pose or input events don't process.
@ -88,8 +86,8 @@ let testFunction = function(session, fakeDeviceController, t) {
};
xr_session_promise_test(immersiveTestName, testFunction,
fakeDeviceInitParams, immersiveSessionOptions);
fakeDeviceInitParams, 'immersive-vr');
xr_session_promise_test(nonImmersiveTestName, testFunction,
fakeDeviceInitParams, nonImmersiveSessionOptions);
fakeDeviceInitParams, 'inline');
</script>

View file

@ -13,9 +13,6 @@
let fakeDeviceInitParams = { supportsImmersive:true };
let immersiveSessionOptions = { mode: 'immersive-vr' };
let nonImmersiveSessionOptions = { outputContext: getOutputContext() };
let testFunction = (testSession, testController, t) => new Promise((resolve) => {
let staleFrame = null;
let currentReferenceSpace = null;
@ -48,9 +45,9 @@
});
xr_session_promise_test(immersiveTestName, testFunction,
fakeDeviceInitParams, immersiveSessionOptions);
fakeDeviceInitParams, 'immersive-vr');
xr_session_promise_test(nonImmersiveTestName, testFunction,
fakeDeviceInitParams, nonImmersiveSessionOptions);
fakeDeviceInitParams, 'inline');
</script>
</body>

View file

@ -9,7 +9,6 @@
let testName = "XRRigidTransform constructor works";
let fakeDeviceInitParams = { supportsImmersive: true };
let requestSessionOptions = { mode: 'immersive-vr' };
let testFunction =
(session, fakeDeviceController, t) => new Promise((resolve, reject) => {
@ -108,6 +107,6 @@ let testFunction =
});
xr_session_promise_test(testName, testFunction, fakeDeviceInitParams,
requestSessionOptions);
'immersive-vr');
</script>

View file

@ -9,7 +9,6 @@
let testName = "XRRigidTransform inverse works";
let fakeDeviceInitParams = { supportsImmersive: true };
let requestSessionOptions = { mode: 'immersive-vr' };
let testFunction =
(session, fakeDeviceController, t) => new Promise((resolve, reject) => {
@ -103,6 +102,6 @@ let testFunction =
});
xr_session_promise_test(testName, testFunction, fakeDeviceInitParams,
requestSessionOptions);
'immersive-vr');
</script>

View file

@ -13,9 +13,6 @@
let fakeDeviceInitParams = { supportsImmersive:true };
let immersiveSessionOptions = { mode: 'immersive-vr' };
let nonImmersiveSessionOptions = { mode: 'inline' };
let testFunction = (session) => new Promise((resolve, reject) => {
// Schedule and immediately cancel animation frame
@ -49,9 +46,9 @@
});
xr_session_promise_test(immersiveTestName, testFunction,
fakeDeviceInitParams, immersiveSessionOptions);
fakeDeviceInitParams, 'immersive-vr');
xr_session_promise_test(nonImmersiveTestName, testFunction,
fakeDeviceInitParams, nonImmersiveSessionOptions);
fakeDeviceInitParams, 'inline');
</script>
</body>

View file

@ -12,9 +12,6 @@
let fakeDeviceInitParams = { supportsImmersive:true };
let immersiveSessionOptions = { mode: 'immersive-vr' };
let nonImmersiveSessionOptions = { mode: 'inline' };
let testFunction = (testSession) => new Promise((resolve) => {
let counter = 0;
@ -37,9 +34,9 @@
});
xr_session_promise_test(
immersiveTestName, testFunction, fakeDeviceInitParams, immersiveSessionOptions);
immersiveTestName, testFunction, fakeDeviceInitParams, 'immersive-vr');
xr_session_promise_test(
nonImmersiveTestName, testFunction, fakeDeviceInitParams, nonImmersiveSessionOptions);
nonImmersiveTestName, testFunction, fakeDeviceInitParams, 'inline');
</script>
</body>

View file

@ -11,9 +11,6 @@
let watcherDone = new Event("watcherdone");
const fakeDeviceInitParams = { supportsImmersive:true };
const immersiveSessionOptions = { mode: 'immersive-vr' };
const nonImmersiveSessionOptions = { mode: 'inline' };
let testFunction = function(session, testDeviceController, t) {
let eventWatcher = new EventWatcher(t, session, ["end", "watcherdone"]);
let eventPromise = eventWatcher.wait_for(["end", "watcherdone"]);
@ -31,8 +28,8 @@
};
xr_session_promise_test(immersivetestName, testFunction,
fakeDeviceInitParams, immersiveSessionOptions);
fakeDeviceInitParams, 'immersive-vr');
xr_session_promise_test(nonimmersiveTestName, testFunction,
fakeDeviceInitParams, nonImmersiveSessionOptions);
fakeDeviceInitParams, 'inline');
</script>
</body>

View file

@ -14,9 +14,6 @@
let fakeDeviceInitParams = { supportsImmersive: true };
let immersiveSessionOptions = { mode: 'immersive-vr' };
let inlineSessionOptions = { mode: 'inline' };
const identityMatrix = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
// Valid matrices for when we don't care about specific values
@ -80,9 +77,9 @@
};
xr_session_promise_test(inlineTestName, testFunction,
fakeDeviceInitParams, inlineSessionOptions);
fakeDeviceInitParams, 'inline');
xr_session_promise_test(immersiveTestName, testFunction,
fakeDeviceInitParams, immersiveSessionOptions);
fakeDeviceInitParams, 'immersive-vr');
</script>
</body>

View file

@ -11,7 +11,7 @@
return XRTest.simulateDeviceConnection({ supportsImmersive:true })
.then( (controller) => new Promise((resolve) => {
XRTest.simulateUserActivation( () => {
resolve(navigator.xr.requestSession({ mode: 'immersive-vr' }).then( (session) => {
resolve(navigator.xr.requestSession('immersive-vr').then( (session) => {
assert_equals(session.mode, 'immersive-vr');
}));
});

View file

@ -12,7 +12,7 @@
return XRTest.simulateDeviceConnection({ supportsImmersive:true })
.then( (controller) => new Promise((resolve) => {
XRTest.simulateUserActivation( () => {
resolve(navigator.xr.requestSession({ mode: 'immersive-vr' })
resolve(navigator.xr.requestSession('immersive-vr')
.then( (session) => new Promise((resolve) => {
XRTest.simulateUserActivation( () => {
// Requesting a second immersive session when another immersive
@ -22,13 +22,13 @@
resolve(promise_rejects(
t,
"InvalidStateError",
navigator.xr.requestSession({ mode: 'immersive-vr' })
navigator.xr.requestSession('immersive-vr')
).then( () => {
// End the immersive session and try again. Now the immersive
// session creation should succeed.
return session.end().then( () => new Promise((resolve) => {
XRTest.simulateUserActivation( () => {
resolve(navigator.xr.requestSession({ mode: 'immersive-vr' }));
resolve(navigator.xr.requestSession('immersive-vr'));
});
}));
}));

View file

@ -13,9 +13,6 @@
let fakeDeviceInitParams = { supportsImmersive:true };
let immersiveSessionOptions = { mode: 'immersive-vr' };
let nonImmersiveSessionOptions = { mode: 'inline' };
let testFunction = (testSession) => new Promise((resolve) => {
function onFrame(time, xrFrame) {
assert_true(xrFrame instanceof XRFrame);
@ -27,9 +24,9 @@
});
xr_session_promise_test(immersiveTestName, testFunction,
fakeDeviceInitParams, immersiveSessionOptions);
fakeDeviceInitParams, 'immersive-vr');
xr_session_promise_test(nonImmersiveTestName, testFunction,
fakeDeviceInitParams, nonImmersiveSessionOptions);
fakeDeviceInitParams, 'inline');
</script>
</body>

View file

@ -28,7 +28,6 @@
};
const fakeDeviceInitOptions = { supportsImmersive:true };
const sessionOptions = { mode: 'immersive-vr' };
let testSession;
@ -77,6 +76,6 @@
}
xr_session_promise_test(
testName, testFunction, fakeDeviceInitOptions, sessionOptions);
testName, testFunction, fakeDeviceInitOptions, 'immersive-vr');
</script>
</body>

View file

@ -14,9 +14,6 @@
let fakeDeviceInitParams = { supportsImmersive: true };
let immersiveSessionOptions = { mode: 'immersive-vr' };
let nonImmersiveSessionOptions = { mode: 'inline' };
// Valid matrices for when we don't care about specific values
const validPoseMatrix = [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1];
const validProjectionMatrix = [1, 0, 0, 0, 0, 1, 0, 0, 3, 2, -1, -1, 0, 0, -0.2, 0];
@ -71,9 +68,9 @@
};
xr_session_promise_test(nonImmersiveTestName, testFunction,
fakeDeviceInitParams, nonImmersiveSessionOptions);
fakeDeviceInitParams, 'inline');
xr_session_promise_test(immersiveTestName, testFunction,
fakeDeviceInitParams, immersiveSessionOptions);
fakeDeviceInitParams, 'immersive-vr');
</script>
</body>

View file

@ -13,9 +13,6 @@
let fakeDeviceInitParams = { supportsImmersive: true };
let immersiveSessionOptions = { mode: 'immersive-vr' };
let nonImmersiveSessionOptions = { mode: 'inline' };
let testFunction = function(session, fakeDeviceController, t) {
return promise_rejects(t, new TypeError(), session.requestReferenceSpace({ type: "foo" }))
.then(() => promise_rejects(t, "NotSupportedError", session.requestReferenceSpace({ type: "stationary" })))
@ -75,9 +72,9 @@
};
xr_session_promise_test(
immersiveTestName, testFunction, fakeDeviceInitParams, immersiveSessionOptions);
immersiveTestName, testFunction, fakeDeviceInitParams, 'immersive-vr');
xr_session_promise_test(
nonImmersiveTestName, testFunction, fakeDeviceInitParams, nonImmersiveSessionOptions);
nonImmersiveTestName, testFunction, fakeDeviceInitParams, 'inline');
</script>
</body>

View file

@ -11,8 +11,8 @@
return XRTest.simulateDeviceConnection({ supportsImmersive:false })
.then( (controller) => {
return Promise.all([
navigator.xr.requestSession({ mode: 'inline'}),
navigator.xr.requestSession({ mode: 'inline'})
navigator.xr.requestSession('inline'),
navigator.xr.requestSession('inline')
]).then((sessions) => {
t.step(() => {
assert_not_equals(sessions[0], null);