Update web-platform-tests to revision 8119bc10583682676a3db9806c82ed4044e88e13

This commit is contained in:
WPT Sync Bot 2019-07-09 10:22:34 +00:00
parent 56f1e7cbc5
commit 3c256580fa
189 changed files with 4341 additions and 1030 deletions

View file

@ -225,6 +225,8 @@ jobs:
- template: tools/ci/azure/update_manifest.yml
- script: python ./wpt run --yes --no-manifest-update --install-fonts --manifest MANIFEST.json --metadata infrastructure/metadata/ --log-tbpl - --log-tbpl-level info --channel dev edgechromium infrastructure/
displayName: 'Run tests (Edge Dev)'
- script: python ./wpt run --yes --no-manifest-update --install-fonts --manifest MANIFEST.json --metadata infrastructure/metadata/ --log-tbpl - --log-tbpl-level info --channel canary edgechromium infrastructure/
displayName: 'Run tests (Edge Canary)'
- task: PublishBuildArtifacts@1
displayName: 'Publish results'
inputs:
@ -258,6 +260,8 @@ jobs:
- template: tools/ci/azure/update_manifest.yml
- script: python ./wpt run --yes --no-manifest-update --no-restart-on-unexpected --no-fail-on-unexpected --install-fonts --this-chunk $(System.JobPositionInPhase) --total-chunks $(System.TotalJobsInPhase) --chunk-type hash --log-wptreport $(Build.ArtifactStagingDirectory)/wpt_report_$(System.JobPositionInPhase).json --log-wptscreenshot $(Build.ArtifactStagingDirectory)/wpt_screenshot_$(System.JobPositionInPhase).txt --log-tbpl - --log-tbpl-level info --channel dev edgechromium
displayName: 'Run tests (Edge Dev)'
- script: python ./wpt run --yes --no-manifest-update --no-restart-on-unexpected --no-fail-on-unexpected --install-fonts --this-chunk $(System.JobPositionInPhase) --total-chunks $(System.TotalJobsInPhase) --chunk-type hash --log-wptreport $(Build.ArtifactStagingDirectory)/wpt_report_$(System.JobPositionInPhase).json --log-wptscreenshot $(Build.ArtifactStagingDirectory)/wpt_screenshot_$(System.JobPositionInPhase).txt --log-tbpl - --log-tbpl-level info --channel canary edgechromium
displayName: 'Run tests (Edge Canary)'
- task: PublishBuildArtifacts@1
displayName: 'Publish results'
inputs:

View file

@ -24,9 +24,9 @@ infrastructure.
[Web Bluetooth Testing API]: https://docs.google.com/document/d/1Nhv_oVDCodd1pEH_jj9k8gF4rPGb_84VYaZ9IG8M_WY/
# Generated gen-* files from generator.py
# Generated gen-* files from generate.py
`generator.py` builds `gen-*.html` tests using templates in
`generate.py` builds `gen-*.html` tests using templates in
`script-tests/*/*.js`.
The subdirectory structure in `bluetooth/script-test/*` is recreated into

View file

@ -1,29 +0,0 @@
<!DOCTYPE html>
<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="/bluetooth/resources/bluetooth-helpers.js"></script>
<script>
'use strict';
const test_desc = 'HeartRate device properties';
bluetooth_test(
() => getHealthThermometerService()
.then(({service}) => Promise.all([
service.getCharacteristic('temperature_measurement'),
service.getCharacteristic('measurement_interval')
]))
.then(([temperature_measurement, measurement_interval]) => {
let tm_expected_properties =
new TestCharacteristicProperties(['indicate']);
assert_properties_equal(
temperature_measurement.properties, tm_expected_properties);
let mi_expected_properties = new TestCharacteristicProperties(
['read', 'write', 'indicate']);
assert_properties_equal(
measurement_interval.properties, mi_expected_properties);
}),
test_desc);
</script>

View file

@ -0,0 +1,23 @@
// META: script=/resources/testharness.js
// META: script=/resources/testharnessreport.js
// META: script=/resources/testdriver.js
// META: script=/resources/testdriver-vendor.js
// META: script=/bluetooth/resources/bluetooth-helpers.js
'use strict';
const test_desc = 'HeartRate device properties';
bluetooth_test(async () => {
const {service} = await getHealthThermometerService()
const [temperature_measurement, measurement_interval] = await Promise.all([
service.getCharacteristic('temperature_measurement'),
service.getCharacteristic('measurement_interval')
]);
const tm_expected_properties = new TestCharacteristicProperties(['indicate']);
assert_properties_equal(
temperature_measurement.properties, tm_expected_properties);
const mi_expected_properties =
new TestCharacteristicProperties(['read', 'write', 'indicate']);
assert_properties_equal(
measurement_interval.properties, mi_expected_properties);
}, test_desc);

View file

@ -1,22 +0,0 @@
<!DOCTYPE html>
<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="/bluetooth/resources/bluetooth-helpers.js"></script>
<script>
'use strict';
const test_desc = 'Characteristic is removed. Reject with InvalidStateError.';
const expected = new DOMException('GATT Characteristic no longer exists.',
'InvalidStateError');
let characteristic, fake_characteristic;
bluetooth_test(() => getMeasurementIntervalCharacteristic()
.then(_ => ({characteristic, fake_characteristic} = _))
.then(() => fake_characteristic.remove())
.then(() => assert_promise_rejects_with_message(
characteristic.startNotifications(),
expected,
'Characteristic got removed.')),
test_desc);
</script>

View file

@ -0,0 +1,18 @@
// META: script=/resources/testharness.js
// META: script=/resources/testharnessreport.js
// META: script=/resources/testdriver.js
// META: script=/resources/testdriver-vendor.js
// META: script=/bluetooth/resources/bluetooth-helpers.js
'use strict';
const test_desc = 'Characteristic is removed. Reject with InvalidStateError.';
const expected = new DOMException(
'GATT Characteristic no longer exists.', 'InvalidStateError');
bluetooth_test(async () => {
const {characteristic, fake_characteristic} =
await getMeasurementIntervalCharacteristic();
await fake_characteristic.remove();
await assert_promise_rejects_with_message(
characteristic.startNotifications(), expected,
'Characteristic got removed.');
}, test_desc);

View file

@ -1,23 +0,0 @@
<!DOCTYPE html>
<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="/bluetooth/resources/bluetooth-helpers.js"></script>
<script>
'use strict';
const test_desc = 'Service is removed. Reject with InvalidStateError.';
const expected = new DOMException('GATT Service no longer exists.',
'InvalidStateError');
let characteristic, fake_peripheral, fake_service;
bluetooth_test(() => getMeasurementIntervalCharacteristic()
.then(_ => ({characteristic, fake_peripheral, fake_service} = _))
.then(() => fake_service.remove())
.then(() => fake_peripheral.simulateGATTServicesChanged())
.then(() => assert_promise_rejects_with_message(
characteristic.startNotifications(),
expected,
'Service got removed.')),
test_desc);
</script>

View file

@ -0,0 +1,18 @@
// META: script=/resources/testharness.js
// META: script=/resources/testharnessreport.js
// META: script=/resources/testdriver.js
// META: script=/resources/testdriver-vendor.js
// META: script=/bluetooth/resources/bluetooth-helpers.js
'use strict';
const test_desc = 'Service is removed. Reject with InvalidStateError.';
const expected =
new DOMException('GATT Service no longer exists.', 'InvalidStateError');
bluetooth_test(async () => {
const {characteristic, fake_peripheral, fake_service} =
await getMeasurementIntervalCharacteristic();
await fake_service.remove();
await fake_peripheral.simulateGATTServicesChanged();
await assert_promise_rejects_with_message(
characteristic.startNotifications(), expected, 'Service got removed.');
}, test_desc);

View file

@ -1,28 +0,0 @@
<!DOCTYPE html>
<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="/bluetooth/resources/bluetooth-helpers.js"></script>
<script>
'use strict';
const test_desc = 'Add multiple event listeners then readValue().';
let characteristic, fake_characteristic;
bluetooth_test(() => getMeasurementIntervalCharacteristic()
.then(_ => ({characteristic, fake_characteristic} = _))
.then(() => fake_characteristic.setNextReadResponse(GATT_SUCCESS, [0,1,2]))
.then(() => assert_promise_resolves_after_event(
characteristic,
'readValue',
'characteristicvaluechanged',
3 /* attach 3 listeners */))
.then(results => {
let read_value = new Uint8Array(results[0].buffer);
let event_values = results.slice(1).map(v => new Uint8Array(v.buffer));
for (let event_value of event_values) {
assert_equals(event_value.buffer, read_value.buffer);
assert_array_equals(event_value, read_value);
}
}), test_desc);
</script>

View file

@ -0,0 +1,26 @@
// META: script=/resources/testharness.js
// META: script=/resources/testharnessreport.js
// META: script=/resources/testdriver.js
// META: script=/resources/testdriver-vendor.js
// META: script=/bluetooth/resources/bluetooth-helpers.js
'use strict';
const test_desc = 'Add multiple event listeners then readValue().';
bluetooth_test(async () => {
const {characteristic, fake_characteristic} =
await getMeasurementIntervalCharacteristic();
await fake_characteristic.setNextReadResponse(GATT_SUCCESS, [0, 1, 2]);
// Make sure that |characteristic.readValue()| resolves after
// |characteristicvaluechanged| is fired |3| times.
const results = await assert_promise_resolves_after_event(
characteristic /* object */, 'readValue' /* func */,
'characteristicvaluechanged' /* event */, 3 /* num_listeners */);
const read_value = new Uint8Array(results[0].buffer);
const event_values = results.slice(1).map(v => new Uint8Array(v.buffer));
for (const event_value of event_values) {
assert_equals(event_value.buffer, read_value.buffer);
assert_array_equals(event_value, read_value);
}
}, test_desc);

View file

@ -1,22 +0,0 @@
<!DOCTYPE html>
<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="/bluetooth/resources/bluetooth-helpers.js"></script>
<script>
'use strict';
const test_desc = 'Characteristic gets removed. Reject with InvalidStateError.';
const expected = new DOMException('GATT Characteristic no longer exists.',
'InvalidStateError');
let characteristic, fake_characteristic;
bluetooth_test(() => getMeasurementIntervalCharacteristic()
.then(_ => ({characteristic, fake_characteristic} = _))
.then(() => fake_characteristic.remove())
.then(() => assert_promise_rejects_with_message(
characteristic.readValue(),
expected,
'Characteristic got removed.')),
test_desc);
</script>

View file

@ -0,0 +1,17 @@
// META: script=/resources/testharness.js
// META: script=/resources/testharnessreport.js
// META: script=/resources/testdriver.js
// META: script=/resources/testdriver-vendor.js
// META: script=/bluetooth/resources/bluetooth-helpers.js
'use strict';
const test_desc = 'Characteristic gets removed. Reject with InvalidStateError.';
const expected = new DOMException(
'GATT Characteristic no longer exists.', 'InvalidStateError');
bluetooth_test(async () => {
const {characteristic, fake_characteristic} =
await getMeasurementIntervalCharacteristic();
await fake_characteristic.remove();
await assert_promise_rejects_with_message(
characteristic.readValue(), expected, 'Characteristic got removed.');
}, test_desc);

View file

@ -1,27 +0,0 @@
<!DOCTYPE html>
<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="/bluetooth/resources/bluetooth-helpers.js"></script>
<script>
'use strict';
const test_desc = 'Reading a characteristic should fire an event.';
let characteristic, fake_characteristic;
bluetooth_test(() => getMeasurementIntervalCharacteristic()
.then(_ => ({characteristic, fake_characteristic} = _))
.then(() => fake_characteristic.setNextReadResponse(
GATT_SUCCESS, [0, 1, 2]))
.then(() => assert_promise_resolves_after_event(
characteristic,
'readValue',
'characteristicvaluechanged'))
.then(results => new Promise(resolve => {
let read_value = new Uint8Array(results[0].buffer);
let event_value = new Uint8Array(results[1].buffer);
assert_equals(event_value.buffer, read_value.buffer);
assert_array_equals(event_value, read_value);
resolve();
})), test_desc);
</script>

View file

@ -0,0 +1,24 @@
// META: script=/resources/testharness.js
// META: script=/resources/testharnessreport.js
// META: script=/resources/testdriver.js
// META: script=/resources/testdriver-vendor.js
// META: script=/bluetooth/resources/bluetooth-helpers.js
'use strict';
const test_desc = 'Reading a characteristic should fire an event.';
bluetooth_test(async () => {
const {characteristic, fake_characteristic} =
await getMeasurementIntervalCharacteristic();
await fake_characteristic.setNextReadResponse(GATT_SUCCESS, [0, 1, 2]);
// Make sure that |characteristic.readValue()| resolves after
// |characteristicvaluechanged| is fired.
const results = await assert_promise_resolves_after_event(
characteristic /* object */, 'readValue' /* func */,
'characteristicvaluechanged' /* event */);
const read_value = new Uint8Array(results[0].buffer);
const event_value = new Uint8Array(results[1].buffer);
assert_equals(event_value.buffer, read_value.buffer);
assert_array_equals(event_value, read_value);
}, test_desc);

View file

@ -1,24 +0,0 @@
<!DOCTYPE html>
<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="/bluetooth/resources/bluetooth-helpers.js"></script>
<script>
'use strict';
const test_desc = 'A read request succeeds and returns the characteristic\'s ' +
'value.';
const EXPECTED_VALUE = [0, 1, 2];
let characteristic, fake_characteristic;
bluetooth_test(() => getMeasurementIntervalCharacteristic()
.then(_ => ({characteristic, fake_characteristic} = _))
.then(() => fake_characteristic.setNextReadResponse(
GATT_SUCCESS,
EXPECTED_VALUE))
.then(() => characteristic.readValue())
.then(value => assert_array_equals(
new Uint8Array(value.buffer),
EXPECTED_VALUE)),
test_desc);
</script>

View file

@ -0,0 +1,17 @@
// META: script=/resources/testharness.js
// META: script=/resources/testharnessreport.js
// META: script=/resources/testdriver.js
// META: script=/resources/testdriver-vendor.js
// META: script=/bluetooth/resources/bluetooth-helpers.js
'use strict';
const test_desc = 'A read request succeeds and returns the characteristic\'s ' +
'value.';
const EXPECTED_VALUE = [0, 1, 2];
bluetooth_test(async () => {
const {characteristic, fake_characteristic} =
await getMeasurementIntervalCharacteristic();
await fake_characteristic.setNextReadResponse(GATT_SUCCESS, EXPECTED_VALUE);
const value = await characteristic.readValue();
assert_array_equals(new Uint8Array(value.buffer), EXPECTED_VALUE)
}, test_desc);

View file

@ -1,23 +0,0 @@
<!DOCTYPE html>
<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="/bluetooth/resources/bluetooth-helpers.js"></script>
<script>
'use strict';
const test_desc = 'Succesful read should update characteristic.value';
const EXPECTED_VALUE = [0, 1, 2];
let characteristic, fake_characteristic;
bluetooth_test(() => getMeasurementIntervalCharacteristic()
.then(_ => ({characteristic, fake_characteristic} = _))
.then(() => assert_equals(characteristic.value, null))
.then(() => fake_characteristic.setNextReadResponse(
GATT_SUCCESS, EXPECTED_VALUE))
.then(() => characteristic.readValue())
.then(() => assert_array_equals(
new Uint8Array(characteristic.value.buffer),
EXPECTED_VALUE)),
test_desc);
</script>

View file

@ -0,0 +1,18 @@
// META: script=/resources/testharness.js
// META: script=/resources/testharnessreport.js
// META: script=/resources/testdriver.js
// META: script=/resources/testdriver-vendor.js
// META: script=/bluetooth/resources/bluetooth-helpers.js
const test_desc = 'Succesful read should update characteristic.value';
const EXPECTED_VALUE = [0, 1, 2];
bluetooth_test(async () => {
const {characteristic, fake_characteristic} =
await getMeasurementIntervalCharacteristic();
assert_equals(characteristic.value, null);
await fake_characteristic.setNextReadResponse(GATT_SUCCESS, EXPECTED_VALUE);
await characteristic.readValue();
assert_array_equals(
new Uint8Array(characteristic.value.buffer), EXPECTED_VALUE)
}, test_desc);

View file

@ -1,23 +0,0 @@
<!DOCTYPE html>
<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="/bluetooth/resources/bluetooth-helpers.js"></script>
<script>
'use strict';
const test_desc = 'Service gets removed. Reject with InvalidStateError.';
const expected = new DOMException('GATT Service no longer exists.',
'InvalidStateError');
let characteristic, fake_peripheral, fake_service;
bluetooth_test(() => getMeasurementIntervalCharacteristic()
.then(_ => ({characteristic, fake_peripheral, fake_service} = _))
.then(() => fake_service.remove())
.then(() => fake_peripheral.simulateGATTServicesChanged())
.then(() => assert_promise_rejects_with_message(
characteristic.readValue(),
expected,
'Service got removed.')),
test_desc);
</script>

View file

@ -0,0 +1,18 @@
// META: script=/resources/testharness.js
// META: script=/resources/testharnessreport.js
// META: script=/resources/testdriver.js
// META: script=/resources/testdriver-vendor.js
// META: script=/bluetooth/resources/bluetooth-helpers.js
'use strict';
const test_desc = 'Service gets removed. Reject with InvalidStateError.';
const expected =
new DOMException('GATT Service no longer exists.', 'InvalidStateError');
bluetooth_test(async () => {
const {characteristic, fake_peripheral, fake_service} =
await getMeasurementIntervalCharacteristic();
await fake_service.remove();
await fake_peripheral.simulateGATTServicesChanged();
await assert_promise_rejects_with_message(
characteristic.readValue(), expected, 'Service got removed.')
}, test_desc);

View file

@ -1,21 +0,0 @@
<!DOCTYPE html>
<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="/bluetooth/resources/bluetooth-helpers.js"></script>
<script>
'use strict';
const test_desc = 'Same parent service returned from multiple characteristics.';
bluetooth_test(
() => getHealthThermometerService()
.then(({service}) => Promise.all([
service.getCharacteristic('measurement_interval'),
service.getCharacteristic('temperature_measurement')
]))
.then(
characteristics => assert_equals(
characteristics[0].service, characteristics[1].service)),
test_desc);
</script>

View file

@ -0,0 +1,16 @@
// META: script=/resources/testharness.js
// META: script=/resources/testharnessreport.js
// META: script=/resources/testdriver.js
// META: script=/resources/testdriver-vendor.js
// META: script=/bluetooth/resources/bluetooth-helpers.js
'use strict';
const test_desc = 'Same parent service returned from multiple characteristics.';
bluetooth_test(async () => {
const {service} = await getHealthThermometerService();
const characteristics = await Promise.all([
service.getCharacteristic('measurement_interval'),
service.getCharacteristic('temperature_measurement')
]);
assert_equals(characteristics[0].service, characteristics[1].service);
}, test_desc);

View file

@ -1,17 +0,0 @@
<!DOCTYPE html>
<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="/bluetooth/resources/bluetooth-helpers.js"></script>
<script>
'use strict';
const test_desc = '[SameObject] test for BluetoothRemoteGATTCharacteristic ' +
'service.';
bluetooth_test(
() => getMeasurementIntervalCharacteristic().then(
({characteristic}) =>
assert_equals(characteristic.service, characteristic.service)),
test_desc);
</script>

View file

@ -0,0 +1,13 @@
// META: script=/resources/testharness.js
// META: script=/resources/testharnessreport.js
// META: script=/resources/testdriver.js
// META: script=/resources/testdriver-vendor.js
// META: script=/bluetooth/resources/bluetooth-helpers.js
'use strict';
const test_desc = '[SameObject] test for BluetoothRemoteGATTCharacteristic ' +
'service.';
bluetooth_test(async () => {
const {characteristic} = await getMeasurementIntervalCharacteristic();
assert_equals(characteristic.service, characteristic.service);
}, test_desc);

View file

@ -1,28 +0,0 @@
<!DOCTYPE html>
<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="/bluetooth/resources/bluetooth-helpers.js"></script>
<script>
'use strict';
function detachBuffer(buffer) {
window.postMessage('', '*', [buffer]);
}
bluetooth_test(async (t) => {
let {characteristic, fake_characteristic} =
await getMeasurementIntervalCharacteristic();
let typed_array = Uint8Array.of(1, 2);
detachBuffer(typed_array.buffer);
await promise_rejects(
t, 'InvalidStateError', characteristic.writeValue(typed_array));
let array_buffer = Uint8Array.of(3, 4).buffer;
detachBuffer(array_buffer);
await promise_rejects(
t, 'InvalidStateError', characteristic.writeValue(array_buffer));
}, 'writeValue() fails when passed a detached buffer');
</script>

View file

@ -0,0 +1,25 @@
// META: script=/resources/testharness.js
// META: script=/resources/testharnessreport.js
// META: script=/resources/testdriver.js
// META: script=/resources/testdriver-vendor.js
// META: script=/bluetooth/resources/bluetooth-helpers.js
'use strict';
const test_desc = 'writeValue() fails when passed a detached buffer';
function detachBuffer(buffer) {
window.postMessage('', '*', [buffer]);
}
bluetooth_test(async (t) => {
const {characteristic} = await getMeasurementIntervalCharacteristic();
const typed_array = Uint8Array.of(1, 2);
detachBuffer(typed_array.buffer);
await promise_rejects(
t, 'InvalidStateError', characteristic.writeValue(typed_array));
const array_buffer = Uint8Array.of(3, 4).buffer;
detachBuffer(array_buffer);
await promise_rejects(
t, 'InvalidStateError', characteristic.writeValue(array_buffer));
}, test_desc);

View file

@ -1,22 +0,0 @@
<!DOCTYPE html>
<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="/bluetooth/resources/bluetooth-helpers.js"></script>
<script>
'use strict';
const test_desc = 'Characteristic gets removed. Reject with InvalidStateError.';
const expected = new DOMException('GATT Characteristic no longer exists.',
'InvalidStateError');
let characteristic, fake_characteristic;
bluetooth_test(() => getMeasurementIntervalCharacteristic()
.then(_ => ({characteristic, fake_characteristic} = _))
.then(() => fake_characteristic.remove())
.then(() => assert_promise_rejects_with_message(
characteristic.writeValue(new ArrayBuffer(1 /* length */)),
expected,
'Characteristic got removed.')),
test_desc);
</script>

View file

@ -0,0 +1,18 @@
// META: script=/resources/testharness.js
// META: script=/resources/testharnessreport.js
// META: script=/resources/testdriver.js
// META: script=/resources/testdriver-vendor.js
// META: script=/bluetooth/resources/bluetooth-helpers.js
'use strict';
const test_desc = 'Characteristic gets removed. Reject with InvalidStateError.';
const expected = new DOMException(
'GATT Characteristic no longer exists.', 'InvalidStateError');
bluetooth_test(async () => {
const {characteristic, fake_characteristic} =
await getMeasurementIntervalCharacteristic();
await fake_characteristic.remove();
await assert_promise_rejects_with_message(
characteristic.writeValue(new ArrayBuffer(1 /* length */)), expected,
'Characteristic got removed.');
}, test_desc);

View file

@ -1,23 +0,0 @@
<!DOCTYPE html>
<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="/bluetooth/resources/bluetooth-helpers.js"></script>
<script>
'use strict';
const test_desc = 'Service gets removed. Reject with InvalidStateError.';
const expected = new DOMException('GATT Service no longer exists.',
'InvalidStateError');
let characteristic, fake_peripheral, fake_service;
bluetooth_test(() => getMeasurementIntervalCharacteristic()
.then(_ => ({characteristic, fake_peripheral, fake_service} = _))
.then(() => fake_service.remove())
.then(() => fake_peripheral.simulateGATTServicesChanged())
.then(() => assert_promise_rejects_with_message(
characteristic.writeValue(new ArrayBuffer(1 /* length */)),
expected,
'Service got removed.')),
test_desc);
</script>

View file

@ -0,0 +1,19 @@
// META: script=/resources/testharness.js
// META: script=/resources/testharnessreport.js
// META: script=/resources/testdriver.js
// META: script=/resources/testdriver-vendor.js
// META: script=/bluetooth/resources/bluetooth-helpers.js
'use strict';
const test_desc = 'Service gets removed. Reject with InvalidStateError.';
const expected =
new DOMException('GATT Service no longer exists.', 'InvalidStateError');
bluetooth_test(async () => {
const {characteristic, fake_peripheral, fake_service} =
await getMeasurementIntervalCharacteristic();
await fake_service.remove();
await fake_peripheral.simulateGATTServicesChanged();
await assert_promise_rejects_with_message(
characteristic.writeValue(new ArrayBuffer(1 /* length */)), expected,
'Service got removed.');
}, test_desc);

View file

@ -1,41 +0,0 @@
<!DOCTYPE html>
<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="/bluetooth/resources/bluetooth-helpers.js"></script>
<script>
'use strict';
const test_desc = 'A regular write request to a writable characteristic ' +
'should succeed.';
let typed_array = Uint8Array.of(1, 2);
let array_buffer = Uint8Array.of(3, 4).buffer;
let data_view = new DataView(new ArrayBuffer(2));
let characteristic, fake_characteristic;
bluetooth_test(() => getMeasurementIntervalCharacteristic()
.then(_ => ({characteristic, fake_characteristic} = _))
.then(() => new Promise(resolve => {
data_view.setUint8(0, 5);
data_view.setUint8(1, 6);
resolve();
}))
.then(() => fake_characteristic.getLastWrittenValue())
.then(last_value => assert_true(last_value === null))
.then(() => fake_characteristic.setNextWriteResponse(GATT_SUCCESS))
.then(() => characteristic.writeValue(typed_array))
.then(() => fake_characteristic.getLastWrittenValue())
.then(last_value => assert_array_equals(last_value, [1, 2]))
.then(() => fake_characteristic.setNextWriteResponse(GATT_SUCCESS))
.then(() => characteristic.writeValue(array_buffer))
.then(() => fake_characteristic.getLastWrittenValue())
.then(last_value => assert_array_equals(last_value, [3, 4]))
.then(() => fake_characteristic.setNextWriteResponse(GATT_SUCCESS))
.then(() => characteristic.writeValue(data_view))
.then(() => fake_characteristic.getLastWrittenValue())
.then(last_value => assert_array_equals(last_value, [5, 6])),
test_desc);
</script>

View file

@ -0,0 +1,39 @@
// META: script=/resources/testharness.js
// META: script=/resources/testharnessreport.js
// META: script=/resources/testdriver.js
// META: script=/resources/testdriver-vendor.js
// META: script=/bluetooth/resources/bluetooth-helpers.js
'use strict';
const test_desc = 'A regular write request to a writable characteristic ' +
'should succeed.';
bluetooth_test(async () => {
const {characteristic, fake_characteristic} =
await getMeasurementIntervalCharacteristic();
let last_value = await fake_characteristic.getLastWrittenValue();
assert_equals(last_value, null);
await fake_characteristic.setNextWriteResponse(GATT_SUCCESS);
const typed_array = Uint8Array.of(1, 2);
await characteristic.writeValue(typed_array);
last_value = await fake_characteristic.getLastWrittenValue();
assert_array_equals(last_value, [1, 2]);
await fake_characteristic.setNextWriteResponse(GATT_SUCCESS);
const array_buffer = Uint8Array.of(3, 4).buffer;
await characteristic.writeValue(array_buffer);
last_value = await fake_characteristic.getLastWrittenValue();
assert_array_equals(last_value, [3, 4]);
await fake_characteristic.setNextWriteResponse(GATT_SUCCESS);
const data_view = new DataView(new ArrayBuffer(2));
data_view.setUint8(0, 5);
data_view.setUint8(1, 6);
await characteristic.writeValue(data_view);
last_value = await fake_characteristic.getLastWrittenValue();
assert_array_equals(last_value, [5, 6]);
}, test_desc);

View file

@ -0,0 +1,17 @@
<!DOCTYPE html>
<link rel="help" href="https://crbug.com/981602">
<link rel="author" href="mailto:kojii@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
.class6 { writing-mode: vertical-rl; }
</style>
<svg>
<radialGradient id="svgvar00004">
<pattern>
<foreignObject>
<pre class="class6">
<svg>
<polyline fill="url(#svgvar00004) red">
</svg>
<script>test(() => {});</script>

View file

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Backgrounds and Borders Module Level 3: getComputedStyle().boxShadow</title>
<link rel="help" href="https://drafts.csswg.org/css-backgrounds/#box-shadow">
<meta name="assert" content="box-shadow computes to none or a list.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/computed-testcommon.js"></script>
<style>
#target {
color: blue;
font-size: 20px;
}
</style>
</head>
<body>
<div id="target"></div>
<script>
'use strict';
const currentColor = 'rgb(0, 0, 255)';
test_computed_value('box-shadow', 'none');
test_computed_value('box-shadow', '1px 2px', currentColor + ' 1px 2px 0px 0px');
test_computed_value('box-shadow', 'currentcolor -1em -2em 3em -4em', currentColor + ' -20px -40px 60px -80px');
test_computed_value('box-shadow', 'rgb(0, 255, 0) 1px 2px 3px 4px inset');
</script>
</body>
</html>

View file

@ -6,7 +6,7 @@
<link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
<link rel="help" href="https://www.w3.org/TR/css-contain-1/#containment-style">
<link rel="match" href="reference/contain-style-counters-003-ref.html">
<link rel="match" href="reference/contain-style-counters-004-ref.html">
<meta name="flags" content="">
@ -63,8 +63,10 @@
<p> <span></span> <span></span> <span></span> <span></span>
<!-- 4 span inside the <p> -->
<!-- 4 span inside the <p>. However, since div isn't a sibling of spans,
it creates a new counter.
-->
<p>Test passes if there is the number 20.
<p>Test passes if there is the number 0.
<div></div>

View file

@ -0,0 +1,18 @@
<!DOCTYPE html>
<meta charset="UTF-8">
<title>CSS Reference Test</title>
<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org">
<style>
div
{
font-size: 3em;
}
</style>
<p>Test passes if there is the number 0.
<div>0</div>

View file

@ -0,0 +1,48 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Inheritance of CSS Fonts Level 3 properties</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#property-index">
<link rel="help" href="https://www.w3.org/TR/css-fonts-4/#font-stretch-prop">
<meta name="assert" content="Properties inherit according to the spec.">
<meta name="assert" content="Properties have initial values according to the spec.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/inheritance-testcommon.js"></script>
<style>
#box {
font: initial;
font-size: medium;
}
</style>
</head>
<body>
<div id="box"></div>
<div id="container">
<div id="target"></div>
</div>
<script>
'use strict';
const box = document.getElementById('box');
const initialFontFamily = getComputedStyle(box).fontFamily;
const mediumFontSize = getComputedStyle(box).fontSize;
assert_inherited('font-family', initialFontFamily, '"Not Initial!"');
assert_inherited('font-feature-settings', 'normal', '"smcp", "swsh" 2');
assert_inherited('font-kerning', 'auto', 'none');
assert_inherited('font-size', mediumFontSize /* medium */, '123px');
assert_inherited('font-size-adjust', 'none', '1.5');
assert_inherited('font-stretch', '100%' /* normal */, '75%');
assert_inherited('font-style', 'normal', 'italic');
assert_inherited('font-synthesis', 'weight style', 'none');
assert_inherited('font-variant', 'normal', 'none');
assert_inherited('font-variant-caps', 'normal', 'small-caps');
assert_inherited('font-variant-east-asian', 'normal', 'ruby');
assert_inherited('font-variant-ligatures', 'normal', 'none');
assert_inherited('font-variant-numeric', 'normal', 'ordinal');
assert_inherited('font-variant-position', 'normal', 'super');
assert_inherited('font-weight', '400' /* normal */, '900');
</script>
</body>
</html>

View file

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 3: getComputedValue().fontFamily</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-family-prop">
<meta name="assert" content="font-family computed value is as specified.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/computed-testcommon.js"></script>
</head>
<body>
<div id="target"></div>
<script>
test_computed_value('font-family', 'serif');
test_computed_value('font-family', 'sans-serif');
test_computed_value('font-family', 'cursive');
test_computed_value('font-family', 'fantasy');
test_computed_value('font-family', 'monospace');
test_computed_value('font-family', 'serif, sans-serif, cursive, fantasy, monospace');
test_computed_value('font-family', 'Helvetica, Verdana, sans-serif');
test_computed_value('font-family', '"New Century Schoolbook", serif');
test_computed_value('font-family', '"21st Century", fantasy');
test_computed_value('font-family', '"inherit", "serif"');
</script>
</body>
</html>

View file

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 3: parsing font-family with invalid values</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-family-prop">
<meta name="assert" content="font-family supports only the grammar '[ <family-name> | <generic-family> ] #'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value('font-family', 'cursive serif');
test_invalid_value('font-family', 'Red/Black, sans-serif');
test_invalid_value('font-family', '"Lucida" Grande, sans-serif');
test_invalid_value('font-family', 'Ahem!, sans-serif');
test_invalid_value('font-family', 'test@foo, sans-serif');
test_invalid_value('font-family', '#POUND, sans-serif');
test_invalid_value('font-family', 'Hawaii 5-0, sans-serif');
</script>
</body>
</html>

View file

@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 3: parsing font-family with valid values</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-family-prop">
<meta name="assert" content="font-family supports the full grammar '[ <family-name> | <generic-family> ] #'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value('font-family', 'Serif', 'serif');
test_valid_value('font-family', 'Sans-Serif', 'sans-serif');
test_valid_value('font-family', 'Cursive', 'cursive');
test_valid_value('font-family', 'Fantasy', 'fantasy');
test_valid_value('font-family', 'Monospace', 'monospace');
test_valid_value('font-family', 'serif, sans-serif, cursive, fantasy, monospace');
test_valid_value('font-family', 'Helvetica, Verdana, sans-serif');
test_valid_value('font-family', '"New Century Schoolbook", serif');
test_valid_value('font-family', "'21st Century', fantasy", '"21st Century", fantasy');
test_valid_value('font-family', '"inherit", "serif"');
</script>
</body>
</html>

View file

@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 3: getComputedValue().fontFeatureSettings</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-feature-settings-prop">
<meta name="assert" content="font-feature-settings computed value is as specified.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/computed-testcommon.js"></script>
</head>
<body>
<div id="target"></div>
<script>
test_computed_value('font-feature-settings', 'normal');
test_computed_value('font-feature-settings', '"dlig"');
test_computed_value('font-feature-settings', '"smcp"');
test_computed_value('font-feature-settings', '"c2sc"');
test_computed_value('font-feature-settings', '"liga" 0');
test_computed_value('font-feature-settings', '"tnum", "hist"');
test_computed_value('font-feature-settings', '"PKRN"');
test_computed_value('font-feature-settings', '"dlig", "smcp", "dlig" 0');
</script>
</body>
</html>

View file

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 3: parsing font-feature-settings with invalid values</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-feature-settings-prop">
<meta name="assert" content="font-feature-settings supports only the grammar 'normal | <feature-tag-value> #'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value('font-feature-settings', 'normal "dlig"');
test_invalid_value('font-feature-settings', '"c2sc", normal');
test_invalid_value('font-feature-settings', '"tnum" "hist"');
test_invalid_value('font-feature-settings', '"silly" off');
test_invalid_value('font-feature-settings', 'dlig');
</script>
</body>
</html>

View file

@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 3: parsing font-feature-settings with valid values</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-feature-settings-prop">
<meta name="assert" content="font-feature-settings supports the full grammar 'normal | <feature-tag-value> #'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value('font-feature-settings', 'normal');
// <feature-tag-value> = <string> [ <integer> | on | off ]?
test_valid_value('font-feature-settings', '"dlig" 1', '"dlig"');
test_valid_value('font-feature-settings', '"smcp" on', '"smcp"');
test_valid_value('font-feature-settings', "'c2sc'", '"c2sc"');
test_valid_value('font-feature-settings', '"liga" off', '"liga" 0');
test_valid_value('font-feature-settings', '"tnum", \'hist\'', '"tnum", "hist"');
test_valid_value('font-feature-settings', '"PKRN"');
test_valid_value('font-feature-settings', '"dlig" 1, "smcp" on, "dlig" 0', '"dlig", "smcp", "dlig" 0');
</script>
</body>
</html>

View file

@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 4: parsing font with invalid values</title>
<link rel="help" href="https://drafts.csswg.org/css-fonts-4/#font-prop">
<meta name="assert" content="font supports only the grammar '[ [ <'font-style'> || <font-variant-css2> || <'font-weight'> || <font-stretch-css3> ]? <'font-size'> [ / <'line-height'> ]? <'font-family'> ] | caption | icon | menu | message-box | small-caption | status-bar'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value('font', 'menu icon');
test_invalid_value('font', 'italic oblique xx-small serif');
test_invalid_value('font', 'small-caps small-caps medium/normal sans-serif');
test_invalid_value('font', 'bold bolder xx-large/1.2 cursive');
test_invalid_value('font', 'ultra-condensed extra-condensed larger/calc(120% + 1.2em) fantasy');
test_invalid_value('font', 'italic small-caps lighter condensed normal smaller monospace');
test_invalid_value('font', 'normal 100 semi-condensed oblique small-caps 10px/normal Menu');
test_invalid_value('font', 'normal normal normal normal normal 20%/1.2 \"FB Armada\"');
test_invalid_value('font', 'italic small-caps lighter condensed smaller');
test_invalid_value('font', 'normal 100 semi-condensed oblique small-caps Menu');
</script>
</body>
</html>

View file

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 3: getComputedValue().fontKerning</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-kerning-prop">
<meta name="assert" content="font-kerning computed value is as specified.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/computed-testcommon.js"></script>
</head>
<body>
<div id="target"></div>
<script>
test_computed_value('font-kerning', 'auto');
test_computed_value('font-kerning', 'normal');
test_computed_value('font-kerning', 'none');
</script>
</body>
</html>

View file

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 3: parsing font-kerning with invalid values</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-kerning-prop">
<meta name="assert" content="font-kerning supports only the grammar 'auto | normal | none'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value('font-kerning', 'normal auto');
test_invalid_value('font-kerning', 'none, auto');
</script>
</body>
</html>

View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 3: parsing font-kerning with valid values</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-kerning-prop">
<meta name="assert" content="font-kerning supports the full grammar 'auto | normal | none'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value('font-kerning', 'auto');
test_valid_value('font-kerning', 'normal');
test_valid_value('font-kerning', 'none');
</script>
</body>
</html>

View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 3: getComputedValue().fontSizeAdjust</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-size-adjust-prop">
<meta name="assert" content="font-size-adjust computed value is as specified.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/computed-testcommon.js"></script>
</head>
<body>
<div id="target"></div>
<script>
test_computed_value('font-size-adjust', 'none');
test_computed_value('font-size-adjust', '0.5');
</script>
</body>
</html>

View file

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 3: parsing font-size-adjust with invalid values</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-size-adjust-prop">
<meta name="assert" content="font-size-adjust supports only the grammar 'none | <number>'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value('font-size-adjust', 'auto');
test_invalid_value('font-size-adjust', '-10');
</script>
</body>
</html>

View file

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 3: parsing font-size-adjust with valid values</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-size-adjust-prop">
<meta name="assert" content="font-size-adjust supports the full grammar 'none | <number>'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value('font-size-adjust', 'none');
test_valid_value('font-size-adjust', '0.5');
</script>
</body>
</html>

View file

@ -0,0 +1,73 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 4: getComputedValue().fontSize</title>
<link rel="help" href="https://drafts.csswg.org/css-fonts-4/#font-size-prop">
<meta name="assert" content="font-size computed value is an absolute length.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/computed-testcommon.js"></script>
<style>
#container {
font-size: 40px;
}
</style>
</head>
<body>
<div id="container">
<div id="target"></div>
</div>
<font id="reference"></font>
<script>
function test_relative_size(first, second) {
test(() => {
const target = document.getElementById('target');
target.style.fontSize = first;
const firstResult = Number(getComputedStyle(target).fontSize.replace('px', ''));
target.style.fontSize = second;
const secondResult = Number(getComputedStyle(target).fontSize.replace('px', ''));
assert_less_than_equal(firstResult, secondResult);
}, first + ' <= ' + second);
}
test_relative_size('xx-small', 'x-small');
test_relative_size('x-small', 'small');
test_relative_size('small', 'medium');
test_relative_size('medium', 'large');
test_relative_size('large', 'x-large');
test_relative_size('x-large', 'xx-large');
// Added in Fonts level 4: https://github.com/w3c/csswg-drafts/issues/3907
test_relative_size('xx-large', 'xxx-large');
// <relative-size>
test_relative_size('inherit', 'larger');
test_relative_size('smaller', 'inherit');
// <length-percentage>
test_computed_value('font-size', '10px');
test_computed_value('font-size', '20%', '8px');
test_computed_value('font-size', 'calc(30% - 40px)', '0px');
test_computed_value('font-size', 'calc(30% + 40px)', '52px');
test_computed_value('font-size', 'calc(10px - 0.5em)', '0px');
test_computed_value('font-size', 'calc(10px + 0.5em)', '30px');
function test_font_size(attribute, keyword) {
test(() => {
const reference = document.getElementById('reference');
reference.setAttribute('size', attribute);
const target = document.getElementById('target');
target.style.fontSize = keyword;
assert_equals(getComputedStyle(target).fontSize, getComputedStyle(reference).fontSize);
}, '<font size="' + attribute + '"> is font-size: ' + keyword);
}
test_font_size('2', 'small');
test_font_size('3', 'medium');
test_font_size('4', 'large');
test_font_size('5', 'x-large');
test_font_size('6', 'xx-large');
test_font_size('7', 'xxx-large');
</script>
</body>
</html>

View file

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 3: parsing font-size with invalid values</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-size-prop">
<meta name="assert" content="font-size supports only the grammar '<absolute-size> | <relative-size> | <length-percentage>'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value('font-size', 'auto');
test_invalid_value('font-size', 'medium small');
test_invalid_value('font-size', '-10px');
test_invalid_value('font-size', '-20%');
</script>
</body>
</html>

View file

@ -0,0 +1,35 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 4: parsing font-size with valid values</title>
<link rel="help" href="https://drafts.csswg.org/css-fonts-4/#font-size-prop">
<meta name="assert" content="font-size supports the full grammar '<absolute-size> | <relative-size> | <length-percentage>'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
// <absolute-size>
test_valid_value('font-size', 'xx-small');
test_valid_value('font-size', 'x-small');
test_valid_value('font-size', 'small');
test_valid_value('font-size', 'medium');
test_valid_value('font-size', 'large');
test_valid_value('font-size', 'x-large');
test_valid_value('font-size', 'xx-large');
// Added in Fonts level 4: https://github.com/w3c/csswg-drafts/issues/3907
test_valid_value('font-size', 'xxx-large');
// <relative-size>
test_valid_value('font-size', 'larger');
test_valid_value('font-size', 'smaller');
// <length-percentage>
test_valid_value('font-size', '10px');
test_valid_value('font-size', '20%');
test_valid_value('font-size', 'calc(30% - 40px)');
</script>
</body>
</html>

View file

@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 4: getComputedValue().fontStretch</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-4/#font-stretch-prop">
<meta name="assert" content="font-stretch computed value is a percentage.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/computed-testcommon.js"></script>
</head>
<body>
<div id="target"></div>
<script>
test_computed_value('font-stretch', 'ultra-condensed', '50%');
test_computed_value('font-stretch', 'extra-condensed', '62.5%');
test_computed_value('font-stretch', 'condensed', '75%');
test_computed_value('font-stretch', 'semi-condensed', '87.5%');
test_computed_value('font-stretch', 'normal', '100%');
test_computed_value('font-stretch', 'semi-expanded', '112.5%');
test_computed_value('font-stretch', 'expanded', '125%');
test_computed_value('font-stretch', 'extra-expanded', '150%');
test_computed_value('font-stretch', 'ultra-expanded', '200%');
test_computed_value('font-stretch', '234.5%');
</script>
</body>
</html>

View file

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 4: parsing font-stretch with invalid values</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-4/#font-stretch-prop">
<meta name="assert" content="font-stretch supports only the grammar 'normal | <percentage> | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded'.">
<meta name="assert" content="Values less than 0% are invalid.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value('font-stretch', 'auto');
test_invalid_value('font-stretch', 'normal, ultra-condensed');
test_invalid_value('font-stretch', 'condensed expanded');
test_invalid_value('font-stretch', '-50%');
</script>
</body>
</html>

View file

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 4: parsing font-stretch with valid values</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-4/#font-stretch-prop">
<meta name="assert" content="font-stretch supports the full grammar 'normal | <percentage> | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value('font-stretch', 'normal');
test_valid_value('font-stretch', 'ultra-condensed');
test_valid_value('font-stretch', 'extra-condensed');
test_valid_value('font-stretch', 'condensed');
test_valid_value('font-stretch', 'semi-condensed');
test_valid_value('font-stretch', 'semi-expanded');
test_valid_value('font-stretch', 'expanded');
test_valid_value('font-stretch', 'extra-expanded');
test_valid_value('font-stretch', 'ultra-expanded');
test_valid_value('font-stretch', '234.5%');
</script>
</body>
</html>

View file

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 3: getComputedValue().fontStyle</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-style-prop">
<meta name="assert" content="font-style computed value is as specified.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/computed-testcommon.js"></script>
<style>
#target {
font-family: Ahem;
}
</style>
</head>
<body>
<div id="target"></div>
<script>
test_computed_value('font-style', 'normal');
test_computed_value('font-style', 'italic');
test_computed_value('font-style', 'oblique');
</script>
</body>
</html>

View file

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 3: parsing font-style with invalid values</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-style-prop">
<meta name="assert" content="font-style supports only the grammar 'normal | italic | oblique'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value('font-style', 'auto');
test_invalid_value('font-style', 'italic oblique');
</script>
</body>
</html>

View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 3: parsing font-style with valid values</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-style-prop">
<meta name="assert" content="font-style supports the full grammar 'normal | italic | oblique'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value('font-style', 'normal');
test_valid_value('font-style', 'italic');
test_valid_value('font-style', 'oblique');
</script>
</body>
</html>

View file

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 3: getComputedValue().fontSynthesis</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-synthesis-prop">
<meta name="assert" content="font-synthesis computed value is as specified.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/computed-testcommon.js"></script>
</head>
<body>
<div id="target"></div>
<script>
test_computed_value('font-synthesis', 'none');
test_computed_value('font-synthesis', 'weight');
test_computed_value('font-synthesis', 'style');
test_computed_value('font-synthesis', 'weight style');
</script>
</body>
</html>

View file

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 3: parsing font-synthesis with invalid values</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-synthesis-prop">
<meta name="assert" content="font-synthesis supports only the grammar 'none | [ weight || style ]'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value('font-synthesis', 'auto');
test_invalid_value('font-synthesis', 'none weight');
</script>
</body>
</html>

View file

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 3: parsing font-synthesis with valid values</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-synthesis-prop">
<meta name="assert" content="font-synthesis supports the full grammar 'none | [ weight || style ]'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value('font-synthesis', 'none');
test_valid_value('font-synthesis', 'weight');
test_valid_value('font-synthesis', 'style');
test_valid_value('font-synthesis', 'style weight', 'weight style');
</script>
</body>
</html>

View file

@ -0,0 +1,205 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 4: parsing font with valid values</title>
<link rel="help" href="https://drafts.csswg.org/css-fonts-4/#font-prop">
<meta name="assert" content="font supports the full grammar '[ [ <'font-style'> || <font-variant-css2> || <'font-weight'> || <font-stretch-css3> ]? <'font-size'> [ / <'line-height'> ]? <'font-family'> ] | caption | icon | menu | message-box | small-caption | status-bar'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<div id="target"></div>
<script>
'use strict';
// Firefox and Edge 18 serialize these as supplied.
// Blink and Safari have implementation-dependent or platform-dependent serializations.
function test_system_font(keyword) {
test(() => {
const target = document.getElementById('target');
const previousValue = 'italic xx-large/0px fantasy';
target.style.font = previousValue;
target.style.font = keyword;
const readValue = target.style.getPropertyValue('font');
assert_not_equals(readValue, '', 'font should be set');
assert_not_equals(readValue, previousValue, 'font should be updated');
target.style.font = previousValue;
target.style.font = readValue;
assert_equals(target.style.getPropertyValue('font'), readValue, "serialization should round-trip");
}, keyword + ' should be a supported system font.');
}
test_system_font('caption');
test_system_font('icon');
test_system_font('menu');
test_system_font('message-box');
test_system_font('small-caption');
test_system_font('status-bar');
// values other than normal
const generate_style = (() => {
const alternatives = [
'italic',
'oblique'
];
let counter = 0;
return () => alternatives[counter++ % alternatives.length];
})();
// value other than normal
const generate_variant = () => 'small-caps';
// values other than normal
const generate_weight = (() => {
const alternatives = [
'bold',
'bolder',
'lighter',
'100',
'900'
];
let counter = 0;
return () => alternatives[counter++ % alternatives.length];
})();
// values other than normal
const generate_stretch = (() => {
const alternatives = [
'ultra-condensed',
'extra-condensed',
'condensed',
'semi-condensed',
'semi-expanded',
'expanded',
'extra-expanded',
'ultra-expanded'
];
let counter = 0;
return () => alternatives[counter++ % alternatives.length];
})();
const generate_size = (() => {
const alternatives = [
// <absolute-size>
'xx-small',
'medium',
'xx-large',
// <relative-size>
'larger',
'smaller',
// <length-percentage>
'10px',
'20%',
'calc(30% - 40px)',
];
let counter = 0;
return () => alternatives[counter++ % alternatives.length];
})();
const generate_line_height = (() => {
const alternatives = [
null,
'normal',
'1.2',
'calc(120% + 1.2em)'
];
let counter = 0;
return () => alternatives[counter++ % alternatives.length];
})();
const generate_family = (() => {
const alternatives = [
'serif',
'sans-serif',
'cursive',
'fantasy',
'monospace',
'Menu',
'"FB Armada"'
];
let counter = 0;
return () => alternatives[counter++ % alternatives.length];
})();
function test_specific(prefix) {
let parts = [];
let canonical = [];
let style = null;
let variant = null;
let weight = null;
let stretch = null;
for (let entry of prefix) {
if (entry === 'style') {
style = generate_style();
parts.push(style);
} else if (entry === 'variant') {
variant = generate_variant();
parts.push(variant);
} else if (entry === 'weight') {
weight = generate_weight();
parts.push(weight);
} else if (entry === 'stretch') {
stretch = generate_stretch();
parts.push(stretch);
} else {
// normal
parts.push('normal');
}
}
if (style)
canonical.push(style);
if (variant)
canonical.push(variant);
if (weight)
canonical.push(weight);
if (stretch)
canonical.push(stretch);
const size = generate_size();
const lineHeight = generate_line_height();
if (lineHeight) {
parts.push(size + '/' + lineHeight);
if (lineHeight === 'normal')
canonical.push(size);
else
canonical.push(size + '/' + lineHeight);
} else {
parts.push(size);
canonical.push(size);
}
const family = generate_family();
parts.push(family);
canonical.push(family);
test_valid_value('font', parts.join(' '), canonical.join(' '));
}
function test_various(prefix) {
test_specific(prefix);
if (prefix.length === 4)
return;
const alternatives = [
'normal',
'style',
'variant',
'weight',
'stretch'
];
for (let alternative of alternatives) {
if (alternative === 'normal' || !prefix.includes(alternative))
test_various(prefix.concat(alternative));
// else we would have two styles or two variants, etc.
}
}
test_various([]);
</script>
</body>
</html>

View file

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 3: getComputedValue().fontVariantCaps</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-variant-caps-prop">
<meta name="assert" content="font-variant-caps computed value is as specified.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/computed-testcommon.js"></script>
</head>
<body>
<div id="target"></div>
<script>
test_computed_value('font-variant-caps', 'normal');
test_computed_value('font-variant-caps', 'small-caps');
test_computed_value('font-variant-caps', 'all-small-caps');
test_computed_value('font-variant-caps', 'petite-caps');
test_computed_value('font-variant-caps', 'all-petite-caps');
test_computed_value('font-variant-caps', 'unicase');
test_computed_value('font-variant-caps', 'titling-caps');
</script>
</body>
</html>

View file

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 3: parsing font-variant-caps with invalid values</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-variant-caps-prop">
<meta name="assert" content="font-variant-caps supports only the grammar 'normal | small-caps | all-small-caps | petite-caps | all-petite-caps | unicase | titling-caps'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value('font-variant-caps', 'auto');
test_invalid_value('font-variant-caps', 'normal unicase');
</script>
</body>
</html>

View file

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 3: parsing font-variant-caps with valid values</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-variant-caps-prop">
<meta name="assert" content="font-variant-caps supports the full grammar 'normal | small-caps | all-small-caps | petite-caps | all-petite-caps | unicase | titling-caps'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value('font-variant-caps', 'normal');
test_valid_value('font-variant-caps', 'small-caps');
test_valid_value('font-variant-caps', 'all-small-caps');
test_valid_value('font-variant-caps', 'petite-caps');
test_valid_value('font-variant-caps', 'all-petite-caps');
test_valid_value('font-variant-caps', 'unicase');
test_valid_value('font-variant-caps', 'titling-caps');
</script>
</body>
</html>

View file

@ -0,0 +1,35 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 3: getComputedValue().fontVariantEastAsian</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-variant-east-asian-prop">
<meta name="assert" content="font-variant-east-asian computed value is as specified.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/computed-testcommon.js"></script>
</head>
<body>
<div id="target"></div>
<script>
test_computed_value('font-variant-east-asian', 'normal');
// <east-asian-variant-values> = [ jis78 | jis83 | jis90 | jis04 | simplified | traditional ]
test_computed_value('font-variant-east-asian', 'jis78');
test_computed_value('font-variant-east-asian', 'jis83');
test_computed_value('font-variant-east-asian', 'jis90');
test_computed_value('font-variant-east-asian', 'jis04');
test_computed_value('font-variant-east-asian', 'simplified');
test_computed_value('font-variant-east-asian', 'traditional');
// <east-asian-width-values> = [ full-width | proportional-width ]
test_computed_value('font-variant-east-asian', 'full-width');
test_computed_value('font-variant-east-asian', 'proportional-width');
test_computed_value('font-variant-east-asian', 'ruby');
test_computed_value('font-variant-east-asian', 'jis78 proportional-width');
test_computed_value('font-variant-east-asian', 'simplified full-width ruby');
</script>
</body>
</html>

View file

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 3: parsing font-variant-east-asian with invalid values</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-variant-east-asian-prop">
<meta name="assert" content="font-variant-east-asian supports only the grammar 'normal | [ <east-asian-variant-values> || <east-asian-width-values> || ruby ]'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value('font-variant-east-asian', 'normal ruby');
test_invalid_value('font-variant-east-asian', 'jis78 jis83');
test_invalid_value('font-variant-east-asian', 'full-width proportional-width');
</script>
</body>
</html>

View file

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 3: parsing font-variant-east-asian with valid values</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-variant-east-asian-prop">
<meta name="assert" content="font-variant-east-asian supports the full grammar 'normal | [ <east-asian-variant-values> || <east-asian-width-values> || ruby ]'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value('font-variant-east-asian', 'normal');
// <east-asian-variant-values> = [ jis78 | jis83 | jis90 | jis04 | simplified | traditional ]
test_valid_value('font-variant-east-asian', 'jis78');
test_valid_value('font-variant-east-asian', 'jis83');
test_valid_value('font-variant-east-asian', 'jis90');
test_valid_value('font-variant-east-asian', 'jis04');
test_valid_value('font-variant-east-asian', 'simplified');
test_valid_value('font-variant-east-asian', 'traditional');
// <east-asian-width-values> = [ full-width | proportional-width ]
test_valid_value('font-variant-east-asian', 'full-width');
test_valid_value('font-variant-east-asian', 'proportional-width');
test_valid_value('font-variant-east-asian', 'ruby');
test_valid_value('font-variant-east-asian', 'jis78 proportional-width');
test_valid_value('font-variant-east-asian', 'ruby full-width simplified', 'simplified full-width ruby');
</script>
</body>
</html>

View file

@ -0,0 +1,35 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 3: getComputedValue().fontVariantLigatures</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-variant-ligatures-prop">
<meta name="assert" content="font-variant-ligatures computed value is as specified.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/computed-testcommon.js"></script>
</head>
<body>
<div id="target"></div>
<script>
test_computed_value('font-variant-ligatures', 'normal');
test_computed_value('font-variant-ligatures', 'none');
// <common-lig-values> = [ common-ligatures | no-common-ligatures ]
test_computed_value('font-variant-ligatures', 'common-ligatures');
test_computed_value('font-variant-ligatures', 'no-common-ligatures');
// <discretionary-lig-values> = [ discretionary-ligatures | no-discretionary-ligatures ]
test_computed_value('font-variant-ligatures', 'discretionary-ligatures');
test_computed_value('font-variant-ligatures', 'no-discretionary-ligatures');
// <historical-lig-values> = [ historical-ligatures | no-historical-ligatures ]
test_computed_value('font-variant-ligatures', 'historical-ligatures');
test_computed_value('font-variant-ligatures', 'no-historical-ligatures');
// <contextual-alt-values> = [ contextual | no-contextual ]
test_computed_value('font-variant-ligatures', 'contextual');
test_computed_value('font-variant-ligatures', 'no-contextual');
</script>
</body>
</html>

View file

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 3: parsing font-variant-ligatures with invalid values</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-variant-ligatures-prop">
<meta name="assert" content="font-variant-ligatures supports only the grammar 'normal | none | [ <common-lig-values> || <discretionary-lig-values> || <historical-lig-values> || <contextual-alt-values> ]'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value('font-variant-ligatures', 'none normal');
test_invalid_value('font-variant-ligatures', 'normal common-ligatures');
test_invalid_value('font-variant-ligatures', 'common-ligatures no-common-ligatures');
test_invalid_value('font-variant-ligatures', 'discretionary-ligatures no-discretionary-ligatures');
test_invalid_value('font-variant-ligatures', 'historical-ligatures no-historical-ligatures');
test_invalid_value('font-variant-ligatures', 'contextual no-contextual');
</script>
</body>
</html>

View file

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 3: parsing font-variant-ligatures with valid values</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-variant-ligatures-prop">
<meta name="assert" content="font-variant-ligatures supports the full grammar 'normal | none | [ <common-lig-values> || <discretionary-lig-values> || <historical-lig-values> || <contextual-alt-values> ]'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value('font-variant-ligatures', 'normal');
test_valid_value('font-variant-ligatures', 'none');
// <common-lig-values> = [ common-ligatures | no-common-ligatures ]
test_valid_value('font-variant-ligatures', 'common-ligatures');
test_valid_value('font-variant-ligatures', 'no-common-ligatures');
// <discretionary-lig-values> = [ discretionary-ligatures | no-discretionary-ligatures ]
test_valid_value('font-variant-ligatures', 'discretionary-ligatures');
test_valid_value('font-variant-ligatures', 'no-discretionary-ligatures');
// <historical-lig-values> = [ historical-ligatures | no-historical-ligatures ]
test_valid_value('font-variant-ligatures', 'historical-ligatures');
test_valid_value('font-variant-ligatures', 'no-historical-ligatures');
// <contextual-alt-values> = [ contextual | no-contextual ]
test_valid_value('font-variant-ligatures', 'contextual');
test_valid_value('font-variant-ligatures', 'no-contextual');
</script>
</body>
</html>

View file

@ -0,0 +1,38 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 3: getComputedValue().fontVariantNumeric</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-variant-numeric-prop">
<meta name="assert" content="font-variant-numeric computed value is as specified.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/computed-testcommon.js"></script>
</head>
<body>
<div id="target"></div>
<script>
test_computed_value('font-variant-numeric', 'normal');
// <numeric-figure-values> = [ lining-nums | oldstyle-nums ]
test_computed_value('font-variant-numeric', 'lining-nums');
test_computed_value('font-variant-numeric', 'oldstyle-nums');
// <numeric-spacing-values> = [ proportional-nums | tabular-nums ]
test_computed_value('font-variant-numeric', 'proportional-nums');
test_computed_value('font-variant-numeric', 'tabular-nums');
// <numeric-fraction-values> = [ diagonal-fractions | stacked-fractions ]
test_computed_value('font-variant-numeric', 'diagonal-fractions');
test_computed_value('font-variant-numeric', 'stacked-fractions');
test_computed_value('font-variant-numeric', 'ordinal');
test_computed_value('font-variant-numeric', 'slashed-zero');
test_computed_value('font-variant-numeric', 'oldstyle-nums tabular-nums diagonal-fractions');
test_computed_value('font-variant-numeric', 'lining-nums proportional-nums stacked-fractions ordinal slashed-zero');
</script>
</body>
</html>

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 3: parsing font-variant-numeric with invalid values</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-variant-numeric-prop">
<meta name="assert" content="font-variant-numeric supports only the grammar 'normal | [ <numeric-figure-values> || <numeric-spacing-values> || <numeric-fraction-values> || ordinal || slashed-zero ]'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value('font-variant-numeric', 'auto');
test_invalid_value('font-variant-numeric', 'normal lining-nums');
test_invalid_value('font-variant-numeric', 'lining-nums oldstyle-nums');
test_invalid_value('font-variant-numeric', 'proportional-nums normal');
test_invalid_value('font-variant-numeric', 'tabular-nums proportional-nums');
test_invalid_value('font-variant-numeric', 'normal diagonal-fractions');
test_invalid_value('font-variant-numeric', 'diagonal-fractions stacked-fractions');
test_invalid_value('font-variant-numeric', 'ordinal normal');
test_invalid_value('font-variant-numeric', 'normal slashed-zero');
</script>
</body>
</html>

View file

@ -0,0 +1,38 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 3: parsing font-variant-numeric with valid values</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-variant-numeric-prop">
<meta name="assert" content="font-variant-numeric supports the full grammar 'normal | [ <numeric-figure-values> || <numeric-spacing-values> || <numeric-fraction-values> || ordinal || slashed-zero ]'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value('font-variant-numeric', 'normal');
// <numeric-figure-values> = [ lining-nums | oldstyle-nums ]
test_valid_value('font-variant-numeric', 'lining-nums');
test_valid_value('font-variant-numeric', 'oldstyle-nums');
// <numeric-spacing-values> = [ proportional-nums | tabular-nums ]
test_valid_value('font-variant-numeric', 'proportional-nums');
test_valid_value('font-variant-numeric', 'tabular-nums');
// <numeric-fraction-values> = [ diagonal-fractions | stacked-fractions ]
test_valid_value('font-variant-numeric', 'diagonal-fractions');
test_valid_value('font-variant-numeric', 'stacked-fractions');
test_valid_value('font-variant-numeric', 'ordinal');
test_valid_value('font-variant-numeric', 'slashed-zero');
test_valid_value('font-variant-numeric', 'oldstyle-nums tabular-nums diagonal-fractions');
// Blink gives "slashed-zero ordinal stacked-fractions proportional-nums lining-nums".
test_valid_value('font-variant-numeric', 'slashed-zero ordinal stacked-fractions proportional-nums lining-nums', 'lining-nums proportional-nums stacked-fractions ordinal slashed-zero');
</script>
</body>
</html>

View file

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 3: getComputedValue().fontVariantPosition</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-variant-position-prop">
<meta name="assert" content="font-variant-position computed value is as specified.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/computed-testcommon.js"></script>
</head>
<body>
<div id="target"></div>
<script>
test_computed_value('font-variant-position', 'normal');
test_computed_value('font-variant-position', 'sub');
test_computed_value('font-variant-position', 'super');
</script>
</body>
</html>

View file

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 3: parsing font-variant-position with invalid values</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-variant-position-prop">
<meta name="assert" content="font-variant-position supports only the grammar 'normal | sub | super'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value('font-variant-position', 'auto');
test_invalid_value('font-variant-position', 'super sub');
</script>
</body>
</html>

View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 3: parsing font-variant-position with valid values</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-variant-position-prop">
<meta name="assert" content="font-variant-position supports the full grammar 'normal | sub | super'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value('font-variant-position', 'normal');
test_valid_value('font-variant-position', 'sub');
test_valid_value('font-variant-position', 'super');
</script>
</body>
</html>

View file

@ -0,0 +1,61 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 3: getComputedValue().fontWeight</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-weight-prop">
<meta name="assert" content="font-weight computed value is a number.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/computed-testcommon.js"></script>
</head>
<body>
<div id="container">
<div id="target"></div>
</div>
<script>
'use strict';
test_computed_value('font-weight', 'normal', '400');
test_computed_value('font-weight', 'bold', '700');
test_computed_value('font-weight', '100');
test_computed_value('font-weight', '200');
test_computed_value('font-weight', '300');
test_computed_value('font-weight', '400');
test_computed_value('font-weight', '500');
test_computed_value('font-weight', '600');
test_computed_value('font-weight', '700');
test_computed_value('font-weight', '800');
test_computed_value('font-weight', '900');
function test_relative(specified, inherited, computed) {
test(() => {
const container = document.getElementById('container');
const target = document.getElementById('target');
container.style.fontWeight = inherited;
target.style.fontWeight = specified;
assert_equals(getComputedStyle(target).fontWeight, computed);
}, inherited + ' made ' + specified + ' computes to ' + computed);
}
test_relative('bolder', '100', '400');
test_relative('bolder', '200', '400');
test_relative('bolder', '300', '400');
test_relative('bolder', '400', '700');
test_relative('bolder', '500', '700');
test_relative('bolder', '600', '900');
test_relative('bolder', '700', '900');
test_relative('bolder', '800', '900');
test_relative('bolder', '900', '900');
test_relative('lighter', '100', '100');
test_relative('lighter', '200', '100');
test_relative('lighter', '300', '100');
test_relative('lighter', '400', '100');
test_relative('lighter', '500', '100');
test_relative('lighter', '600', '400');
test_relative('lighter', '700', '400');
test_relative('lighter', '800', '700');
test_relative('lighter', '900', '700');
</script>
</body>
</html>

View file

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 3: parsing font-weight with invalid values</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-weight-prop">
<meta name="assert" content="font-weight supports only the grammar 'normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value('font-weight', 'auto');
test_invalid_value('font-weight', 'bold 900');
</script>
</body>
</html>

View file

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 3: parsing font-weight with valid values</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-weight-prop">
<meta name="assert" content="font-weight supports the full grammar 'normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value('font-weight', 'normal');
test_valid_value('font-weight', 'bold');
test_valid_value('font-weight', 'bolder');
test_valid_value('font-weight', 'lighter');
test_valid_value('font-weight', '100');
test_valid_value('font-weight', '200');
test_valid_value('font-weight', '300');
test_valid_value('font-weight', '400');
test_valid_value('font-weight', '500');
test_valid_value('font-weight', '600');
test_valid_value('font-weight', '700');
test_valid_value('font-weight', '800');
test_valid_value('font-weight', '900');
</script>
</body>
</html>

View file

@ -4,6 +4,7 @@
<meta charset="utf-8"/>
<title>text-transform math-auto</title>
<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/3745"/>
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#new-text-transform-values">
<link rel="match" href="text-transform-math-auto-002.tentative-ref.html"/>
<meta name="assert" content="Test 'text-transform: math-auto' for text nodes of different lengths">
<style>

View file

@ -56,6 +56,37 @@ promise_test(async t => {
assert_equals(getComputedStyle(div).left, '100px');
}, 'After setting a transition\'s effect to null, style is updated');
// This is a regression test for https://crbug.com/964113, where Chromium would
// crash if the running transition's effect was set to null and a new transition
// was started before the running one could finish.
promise_test(async t => {
const div = addDiv(t);
div.style.left = '0px';
div.style.transition = 'left 100s';
getComputedStyle(div).left;
div.style.left = '100px';
assert_equals(div.getAnimations().length, 1);
const transition = div.getAnimations()[0];
await transition.ready;
// Without yielding to the rendering loop, set the current transition's
// effect to null and start a new transition. This should work correctly.
transition.effect = null;
div.style.left = '150px';
// This will run style update.
assert_equals(div.getAnimations().length, 1);
const new_transition = div.getAnimations()[0];
await new_transition.ready;
assert_equals(getComputedStyle(div).left, '0px');
}, 'After setting a transition\'s effect to null, a new transition can be started');
promise_test(async t => {
const div = addDiv(t);
div.style.left = '0px';

View file

@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS UI Level 3: getComputedStyle().caretColor</title>
<link rel="help" href="https://drafts.csswg.org/css-ui-3/#caret-color">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/computed-testcommon.js"></script>
<style>
#target {
color: blue;
}
</style>
</head>
<body>
<div id="target"></div>
<script>
'use strict';
const currentColor = "rgb(0, 0, 255)";
test_computed_value("caret-color", "auto", currentColor);
test_computed_value("caret-color", "currentColor", currentColor);
test_computed_value("caret-color", "red", "rgb(255, 0, 0)");
</script>
</body>
</html>

View file

@ -0,0 +1,32 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS UI Level 3: getComputedStyle().outlineColor</title>
<link rel="help" href="https://drafts.csswg.org/css-ui-3/#outline-color">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/computed-testcommon.js"></script>
<style>
#target {
color: blue;
}
</style>
</head>
<body>
<div id="target"></div>
<script>
'use strict';
const currentColor = "rgb(0, 0, 255)";
test_computed_value("outline-color", "currentColor", currentColor);
test_computed_value("outline-color", "red", "rgb(255, 0, 0)");
test(() => {
const target = document.getElementById('target');
target.style.outlineColor = 'invert';
if (target.style.outlineColor === 'invert')
assert_equals(getComputedStyle(target).outlineColor, 'invert');
}, 'invert, if supported, computes to invert');
</script>
</body>
</html>

View file

@ -22,12 +22,15 @@ This function must return a value in one of the following four formats:
content
Above, `headers` is a list of (field name, value) pairs, and `content` is a
string or an iterable returning strings. The `main` function may also update
the response manually. For example, one may use `response.headers.set` to set a
response header, and only return the content. One may even use this kind of
handler, but manipulate the output socket directly, in which case the return
value of the function, and the properties of the response object, will be
ignored.
string or an iterable returning strings.
The `main` function may also update the response manually. For example, one may
use `response.headers.set` to set a response header, and only return the
content. One may even use this kind of handler, but manipulate the output
socket directly. The `writer` property of the response exposes a
`ResponseWriter` object that allows writing specific parts of the request or
direct access to the underlying socket. If used, the return value of the
`main` function and the properties of the `response` object will be ignored.
The wptserver implements a number of Python APIs for controlling traffic.

View file

@ -1,12 +1,31 @@
# Server Features
## Advanced Testing Features
For many tests, writing one or more static HTML files is
sufficient. However there are a large class of tests for which this
approach is insufficient, including:
Certain test scenarios require more than just static HTML
generation. This is supported through the
[wptserve](http://wptserve.readthedocs.io) server, and controlled by
[file name flags](file-names). Several scenarios in particular are common:
* Tests that require cross-domain access
* Tests that depend on setting specific headers or status codes
* Tests that need to inspect the browser-sent request
* Tests that require state to be stored on the server
* Tests that require precise timing of the response.
To make writing such tests possible, we are using a number of
server-side components designed to make it easy to manipulate the
precise details of the response:
* *wptserve*, a custom Python HTTP server.
* *pywebsocket*, an existing websockets server
wptserve is a Python-based web server. By default it serves static
files in the testsuite. For more sophisticated requirements, several
mechanisms are available to take control of the response. These are
outlined below.
### Tests Involving Multiple Origins
@ -90,14 +109,18 @@ the file e.g. `test.html.sub.headers`.
server-pipes
```
For full control over the request and response the server provides the
ability to write `.asis` files; these are served as literal HTTP
responses. It also provides the ability to write [Python
For full control over the request and response, the server provides the ability
to write `.asis` files; these are served as literal HTTP responses. In other
words, they are sent byte-for-byte to the server without adding an HTTP status
line, headers, or anything else. This makes them suitable for testing
situations where the precise bytes on the wire are static, and control over the
timing is unnecessary, but the response does not conform to HTTP requirements.
The server also provides the ability to write [Python
"handlers"](python-handlers/index)--Python scripts that have access to request
data and can manipulate the content and timing of the response. Responses are
also influenced by [the `pipe` query string parameter](server-pipes).
### Writing tests for HTTP/2.0
The server now has a prototype HTTP/2.0 server which gives you access to

View file

@ -1,5 +1,11 @@
# wptserve Pipes
Pipes are designed to allow simple manipulation of the way that
static files are sent without requiring any custom code. They are also
useful for cross-origin tests because they can be used to activate a
substitution mechanism which can fill in details of ports and server
names in the setup on which the tests are being run.
## Enabling
Pipes are functions that may be used when serving files to alter parts
@ -28,7 +34,9 @@ preventing the use of HTTP 1.1 keepalive.
### `sub`
Used to substitute variables from the server environment, or from the
request into the response.
request into the response. A typical use case is for testing
cross-domain since the exact domain name and ports of the servers are
generally unknown.
Substitutions are marked in a file using a block delimited by `{{`
and `}}`. Inside the block the following variables are available:

View file

@ -0,0 +1,42 @@
<!DOCTYPE HTML>
<meta charset=utf-8>
<title>Element Timing: observe element with buffered flag</title>
<body>
<style>
body {
margin: 0;
}
</style>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/element-timing-helpers.js"></script>
<script>
async_test(t => {
const beforeRender = performance.now();
const img = document.createElement('img');
if (!window.PerformanceElementTiming) {
assert_unreached("PerformanceElementTiming is not implemented");
}
// Initial observer used to know when entry has been dispatched
new PerformanceObserver(() => {
// Second observer should require buffered flag to receive the already-dispatched entry.
new PerformanceObserver(t.step_func_done(entryList => {
assert_equals(entryList.getEntries().length, 1);
const entry = entryList.getEntries()[0];
const pathname = window.location.origin + '/images/black-rectangle.png';
checkElement(entry, pathname, 'my_image', 'my_id', beforeRender, document.getElementById('my_id'));
// Test that viewport size is at least 100, so element is fully visible.
assert_greater_than_equal(document.documentElement.clientWidth, 100, 'Width should be >= 100');
assert_greater_than_equal(document.documentElement.clientHeight, 100, 'Height should be >= 100');
checkRect(entry, [0, 100, 0, 50]);
checkNaturalSize(entry, 100, 50);
})).observe({type: 'element', buffered: true});
}).observe({type: 'element'});
img.src = '/images/black-rectangle.png';
img.setAttribute('elementtiming', 'my_image');
img.setAttribute('id', 'my_id');
document.body.appendChild(img);
}, 'Element Timing entries are observable via buffered flag.');
</script>
</body>

View file

@ -0,0 +1,31 @@
<!DOCTYPE HTML>
<meta charset=utf-8>
<title>Element Timing: 'element' entries are not accessible via performance timeline</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/element-timing-helpers.js"></script>
<script>
let img;
async_test(function (t) {
if (!window.PerformanceElementTiming) {
assert_unreached("PerformanceElementTiming is not implemented");
}
const beforeRender = performance.now();
new PerformanceObserver(
t.step_func_done(function(entryList) {
assert_equals(entryList.getEntries().length, 1);
const entry = entryList.getEntries()[0];
assert_equals(entry.entryType, 'element');
assert_equals(entry.name, 'image-paint');
const entriesByName = performance.getEntriesByName('image-paint', 'element');
const entriesByType = performance.getEntriesByType('element');
const allEntries = performance.getEntries();
assert_equals(entriesByName.length, 0, 'Element Timing entry should not be retrievable by getEntriesByName');
assert_equals(entriesByType.length, 0, 'Element Timing entry should not be retrievable by getEntriesByType');
assert_equals(allEntries.filter(e => e.entryType === 'element').length, 0, 'Element Timing entry should not be retrievable by getEntries');
})
).observe({type: 'element', buffered: true});
}, 'Element Timing entries are not accessible via performance.getEntries*');
</script>
<img src='resources/square100.png' elementtiming='my_image' id='my_id'/>

View file

@ -17,7 +17,7 @@
PerformanceObserver is registered
Click 1
Click 2
PerformanceObserver should observe only one firstInput entry.
PerformanceObserver should observe only one first-input entry.
(Dispatch and Process Click 2 - not buffered)
*/
async_test(function(t) {
@ -43,7 +43,7 @@
new PerformanceObserver(function(entryList) {
assert_equals(entryList.getEntries().length, 1);
resolve();
}).observe({ type: 'firstInput' , buffered: true});
}).observe({ type: 'first-input' , buffered: true});
});
on_event(window, 'load', function(e) {
@ -57,7 +57,7 @@
});
});
},
"Event Timing: check firstInput after onload, observer, click, click."
"Event Timing: check first-input after onload, observer, click, click."
);
</script>
</html>

View file

@ -12,7 +12,7 @@
<script>
/* Test:
PerformanceObserver for firstInput is registered
PerformanceObserver for first-input is registered
Click 1
Click 2
Wait
@ -27,14 +27,14 @@
const observedEntries = entryList.getEntries().filter(
entry => entry.name === 'mousedown');
assert_equals(observedEntries.length, 1);
assert_equals(observedEntries[0].entryType, 'firstInput');
assert_equals(observedEntries[0].entryType, 'first-input');
assert_equals(observedEntries[0].name, 'mousedown');
})).observe({ entryTypes: ['firstInput'] });
})).observe({ entryTypes: ['first-input'] });
on_event(window, 'load', () => {
clickAndBlockMain('button').then(() => {
clickAndBlockMain('button').then(wait).then( () => {
// After some wait, the PerformanceObserver should have processed both clicks.
// One and only one firstInput entry should have been dispatched, so
// One and only one first-input entry should have been dispatched, so
// |hasObservedFirstInput| should be true.
t.step_timeout( () => {
assert_true(hasObservedFirstInput);
@ -44,7 +44,7 @@
});
});
},
"Event Timing: check firstInput for a PerformanceObserver observing only firstInput."
"Event Timing: check first-input for a PerformanceObserver observing only first-input."
);
</script>
</html>

View file

@ -27,7 +27,7 @@
// the one from the clickAndBlockMain() call.
assert_greater_than_equal(entry.processingStart, beforeClick);
// Check that the first input entry was also from the second click.
const firstInput = performance.getEntriesByType('firstInput');
const firstInput = performance.getEntriesByType('first-input');
assert_equals(firstInput.length, 1);
assert_greater_than_equal(firstInput[0].processingStart, beforeClick);
}));

View file

@ -24,7 +24,7 @@ function mainThreadBusy(duration) {
// This method should receive an entry of type 'event'. |is_first| is true only
// when the event also happens to correspond to the first event. In this case,
// the timings of the 'firstInput' entry should be equal to those of this entry.
// the timings of the 'first-input' entry should be equal to those of this entry.
function verifyClickEvent(entry, is_first=false) {
assert_true(entry.cancelable);
assert_equals(entry.name, 'mousedown');
@ -40,11 +40,11 @@ function verifyClickEvent(entry, is_first=false) {
assert_greater_than_equal(entry.duration + 4, entry.processingEnd - entry.startTime,
"The entry's duration must be at least as large as processingEnd - startTime.");
if (is_first) {
let firstInputs = performance.getEntriesByType('firstInput');
assert_equals(firstInputs.length, 1, 'There should be a single firstInput entry');
let firstInputs = performance.getEntriesByType('first-input');
assert_equals(firstInputs.length, 1, 'There should be a single first-input entry');
let firstInput = firstInputs[0];
assert_equals(firstInput.name, entry.name);
assert_equals(firstInput.entryType, 'firstInput');
assert_equals(firstInput.entryType, 'first-input');
assert_equals(firstInput.startTime, entry.startTime);
assert_equals(firstInput.duration, entry.duration);
assert_equals(firstInput.processingStart, entry.processingStart);

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<meta charset=utf-8>
<title>Event Timing: make sure event-timing entries are retrievable by existing perf APIs.</title>
<title>Event Timing: make sure 'event' entries are not retrievable by performance.getEntries* APIs.</title>
<meta name="timeout" content="long">
<button id='button'>Generate a 'click' event</button>
<script src=/resources/testharness.js></script>
@ -10,17 +10,15 @@
<script src=/resources/testdriver-vendor.js></script>
<script src=resources/event-timing-test-utils.js></script>
<img src=resources/slow-image.py>
<script>
function validateEntries() {
const entriesByName = performance.getEntriesByName('mousedown', 'event');
const entriesByType = performance.getEntriesByType('event');
const allEntries = performance.getEntries();
assert_equals(entriesByName.length, 1, 'event-timing entry should be retrievable by getEntriesByName');
const e = entriesByName[0];
assert_true(entriesByType.includes(e), 'event-timing entry should be retrievable by getEntries');
assert_true(allEntries.includes(e), 'event-timing entry should be retrievable by getEntriesByType');
assert_equals(entriesByName.length, 0, 'Event Timing entry should not be retrievable by getEntriesByName');
assert_equals(entriesByType.length, 0, 'Event Timing entry should not be retrievable by getEntriesByType');
assert_equals(allEntries.filter(e => e.entryType === 'event').length, 0, 'Event Timing entry should not be retrievable by getEntries');
}
/* Timeline:
@ -32,12 +30,15 @@
Validate entries
*/
async_test(function(t) {
clickAndBlockMain('button');
on_event(window, 'load', e => {
if (!window.PerformanceEventTiming) {
assert_unreached('PerformanceEventTiming is not implemented');
}
new PerformanceObserver(t.step_func_done(() => {
validateEntries();
t.done();
});
}, "Event Timing: make sure event-timing entries are retrievable by existing perf APIs.");
})).observe({entryTypes: ['event']});
clickAndBlockMain('button');
}, "Event Timing: make sure event-timing entries are not retrievable by performance.getEntries*.");
</script>
</html>

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<meta charset=utf-8 />
<title>Event Timing: firstInput entry should be buffered even without observer</title>
<title>Event Timing: first-input entry should be buffered even without observer</title>
<button id='button'>Generate a 'click' event</button>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
@ -14,22 +14,22 @@
async_test(function(t) {
function testEntries() {
// First callback is not ensured to have the entry.
if (performance.getEntriesByType('firstInput').length === 0) {
if (performance.getEntriesByType('first-input').length === 0) {
t.step_timeout(testEntries, 10);
return;
}
assert_equals(performance.getEntriesByType('firstInput').length, 1,
"There should be a firstInput entry in the performance timeline");
const entry = performance.getEntriesByType('firstInput')[0];
assert_equals(performance.getEntriesByType('first-input').length, 1,
"There should be a first-input entry in the performance timeline");
const entry = performance.getEntriesByType('first-input')[0];
assert_equals(entry.name, 'mousedown');
assert_equals(entry.entryType, 'firstInput');
assert_equals(entry.entryType, 'first-input');
assert_greater_than_equal(entry.duration, 104,
"The first input was a long one.");
t.done();
}
clickAndBlockMain('button').then(wait).then(t.step_func(testEntries));
},
"Event Timing: check firstInput after onload, observer, click, click."
"Event Timing: check first-input after onload, observer, click, click."
);
</script>
</html>

View file

@ -2,10 +2,10 @@ test(() => {
if (typeof PerformanceObserver.supportedEntryTypes === "undefined")
assert_unreached("supportedEntryTypes is not supported.");
const types = PerformanceObserver.supportedEntryTypes;
assert_true(types.includes("firstInput"),
"There should be 'firstInput' in PerformanceObserver.supportedEntryTypes");
assert_true(types.includes("first-input"),
"There should be 'first-input' in PerformanceObserver.supportedEntryTypes");
assert_true(types.includes("event"),
"There should be 'event' in PerformanceObserver.supportedEntryTypes");
assert_greater_than(types.indexOf("firstInput"), types.indexOf('event'),
"The 'firstInput' entry should appear after the 'event' entry");
}, "supportedEntryTypes contains 'event' and 'firstInput'.");
assert_greater_than(types.indexOf("first-input"), types.indexOf('event'),
"The 'first-input' entry should appear after the 'event' entry");
}, "supportedEntryTypes contains 'event' and 'first-input'.");

View file

@ -0,0 +1,8 @@
[actionsWithKeyPressed.html]
expected:
if product == "safari": ERROR
[TestDriver actions: actions with key pressed]
expected:
if product == "firefox": FAIL
if os == "mac" and product == "chrome": FAIL

View file

@ -0,0 +1,67 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>TestDriver actions: actions with key pressed</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-actions.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<style>
div#test1, div#test2 {
position: fixed;
top: 0;
left: 0;
width: 100px;
height: 100px;
background-color: blue;
}
div#test2 {
position: fixed;
top: 100px;
left: 0;
width: 100px;
height: 100px;
background-color: green;
}
</style>
<div id="test1">
</div>
<div id="test2">
</div>
<script>
let keys = [];
async_test(t => {
let test1 = document.getElementById("test1");
let test2 = document.getElementById("test2");
document.getElementById("test1").addEventListener("click",
e => {keys.push(e.getModifierState("Control"))});
document.getElementById("test2").addEventListener("click",
e => {keys.push(e.getModifierState("Control"))});
let actions = new test_driver.Actions()
.keyDown("\uE009")
.addTick()
.pointerMove(0, 0, {origin: test1})
.pointerDown()
.pointerUp()
.pointerMove(0, 0, {origin: test2})
.pointerDown()
.pointerUp()
.addTick()
.keyUp("\uE009")
.addTick()
.pointerMove(0, 0, {origin: test1})
.pointerDown()
.pointerUp();
actions.send()
.then(t.step_func_done(() => assert_array_equals(keys, [true, true, false])))
.catch(e => t.step_func(() => assert_unreached("Actions sequence failed " + e)));
});
</script>

View file

@ -13,7 +13,7 @@
t.step_func_done(function(entryList) {
assert_equals(entryList.getEntries().length, 1);
const entry = entryList.getEntries()[0];
assert_equals(entry.entryType, 'largestContentfulPaint');
assert_equals(entry.entryType, 'largest-contentful-paint');
assert_equals(entry.startTime, 0, 'The startTime value should be 0 for a cross origin image.');
assert_equals(entry.duration, 0);
// blue.png is 133 x 106.
@ -26,7 +26,7 @@
assert_equals(entry.element, document.getElementById('image_id'));
})
);
observer.observe({type: 'largestContentfulPaint', buffered: true});
observer.observe({type: 'largest-contentful-paint', buffered: true});
}, 'Cross-origin image is observable, with startTime equal to 0.');
</script>

Some files were not shown because too many files have changed in this diff Show more