Commit 04ad58d0 authored by foolip's avatar foolip Committed by Commit bot

Import wpt@bd99724e428dae78082983eab4675480c43f6234

Using update-w3c-deps in Chromium 3524bd79.

This is for rtcpeerconnection-constructor.html

BUG=658423

Review-Url: https://codereview.chromium.org/2448433002
Cr-Commit-Position: refs/heads/master@{#427069}
parent 78d60d3d
CONSOLE ERROR: line 21: Uncaught Error
CONSOLE ERROR: line 2443: Uncaught Error: assert_unreached: connectedCallback should not be invoked if constructor threw Reached unreachable code
CONSOLE ERROR: line 2444: Uncaught Error: assert_unreached: connectedCallback should not be invoked if constructor threw Reached unreachable code
This is a testharness.js-based test.
PASS Custom Elements: Custom Element State "Failed" in Upgrades
Harness: the test ran to completion.
......
set -e
export BUILD_HOME=$HOME/build
export WPT_HOME=$BUILD_HOME/w3c/web-platform-tests
hosts_fixup() {
echo "travis_fold:start:hosts_fixup"
echo "== /etc/hosts =="
cat /etc/hosts
echo "----------------"
......@@ -19,104 +17,16 @@ hosts_fixup() {
echo "== /etc/hosts =="
cat /etc/hosts
echo "----------------"
echo "travis_fold:end:hosts_fixup"
}
fetch_master() {
cd $WPT_HOME
git fetch https://github.com/w3c/web-platform-tests.git master:master
}
build_manifest() {
cd $WPT_HOME
python manifest
}
install_wptrunner() {
cd $BUILD_HOME
if [ ! -d w3c/wptrunner ]; then
git clone --depth 1 https://github.com/w3c/wptrunner.git w3c/wptrunner
cd w3c/wptrunner
else
cd w3c/wptrunner
git fetch https://github.com/w3c/wptrunner.git
fi
git reset --hard origin/master
git submodule update --init --recursive
pip install .
}
install_firefox() {
cd $BUILD_HOME
pip install -r w3c/wptrunner/requirements_firefox.txt
wget https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central/firefox-52.0a1.en-US.linux-x86_64.tar.bz2
tar -xf firefox-52.0a1.en-US.linux-x86_64.tar.bz2
if [ ! -d profiles ]; then
mkdir profiles
fi
cd profiles
wget https://hg.mozilla.org/mozilla-central/raw-file/tip/testing/profiles/prefs_general.js
}
install_geckodriver() {
cd $BUILD_HOME
local release_url
local tmpfile
local release_data
# Stupid hacky way of getting the release URL from the GitHub API
tmpfile=$(mktemp)
echo 'import json, sys
data = json.load(sys.stdin)
print (item["browser_download_url"] for item in data["assets"]
if "linux64" in item["browser_download_url"]).next()' > "$tmpfile"
release_data=$(curl -s https://api.github.com/repos/mozilla/geckodriver/releases/latest?access_token=$GH_TOKEN)
echo $RELEASE_DATA
release_url=$(echo $release_data | python $tmpfile)
rm "$tmpfile"
wget "$release_url"
tar xf geckodriver*.tar.gz
}
install_chrome() {
cd $BUILD_HOME
local latest
pip install -r w3c/wptrunner/requirements_chrome.txt
latest=$(curl https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Linux_x64%2FLAST_CHANGE?alt=media)
curl "https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Linux_x64%2F$latest%2Fchrome-linux.zip?alt=media" > chrome-linux64.zip
unzip -q chrome-linux64.zip
}
install_chromedriver() {
cd $BUILD_HOME
local latest
latest=$(curl http://chromedriver.storage.googleapis.com/LATEST_RELEASE)
wget "http://chromedriver.storage.googleapis.com/$latest/chromedriver_linux64.zip"
unzip -q chromedriver_linux64.zip
}
test_stability() {
cd $WPT_HOME
python check_stability.py --root $BUILD_HOME --comment-pr ${TRAVIS_PULL_REQUEST} --gh-token ${GH_TOKEN} $PRODUCT
python check_stability.py $PRODUCT
}
main() {
fetch_master
build_manifest
install_wptrunner
case "$PRODUCT" in
firefox)
install_firefox
install_geckodriver
;;
chrome)
hosts_fixup
install_chrome
install_chromedriver
;;
*)
echo "Unrecognised product $PRODUCT"
exit 1
esac
hosts_fixup
test_stability
}
......
......@@ -6,7 +6,7 @@ PASS add on DOMTokenList must not enqueue an attributeChanged reaction when addi
PASS add on DOMTokenList must enqueue exactly one attributeChanged reaction when adding multiple values to an attribute
PASS remove on DOMTokenList must enqueue an attributeChanged reaction when removing a value from an attribute
PASS remove on DOMTokenList must enqueue exactly one attributeChanged reaction when removing multiple values to an attribute
PASS remove on DOMTokenList must not enqueue an attributeChanged reaction when removing a non-existent value from an attribute
FAIL remove on DOMTokenList must enqueue an attributeChanged reaction even when removing a non-existent value from an attribute assert_array_equals: lengths differ, expected 1 got 0
PASS remove on DOMTokenList must not enqueue an attributeChanged reaction when removing a value from an unobserved attribute
PASS toggle on DOMTokenList must enqueue an attributeChanged reaction when adding a value to an attribute
PASS toggle on DOMTokenList must enqueue an attributeChanged reaction when removing a value from an attribute
......
......@@ -89,8 +89,10 @@ test(function () {
instance.setAttribute('class', 'hello world');
assert_array_equals(element.takeLog().types(), ['constructed', 'attributeChanged']);
instance.classList.remove('foo');
assert_array_equals(element.takeLog().types(), []);
}, 'remove on DOMTokenList must not enqueue an attributeChanged reaction when removing a non-existent value from an attribute');
var logEntries = element.takeLog();
assert_array_equals(logEntries.types(), ['attributeChanged']);
assert_attribute_log_entry(logEntries.last(), {name: 'class', oldValue: 'hello world', newValue: 'hello world', namespace: null});
}, 'remove on DOMTokenList must enqueue an attributeChanged reaction even when removing a non-existent value from an attribute');
test(function () {
var element = define_new_custom_element(['title']);
......
This is a testharness.js-based test.
FAIL importNode on Document must construct a new custom element when importing a custom element assert_array_equals: lengths differ, expected 1 got 0
PASS adoptNode on Document must enqueue an adopted reaction when importing a custom element
PASS execCommand on Document must enqueue a disconnected reaction when deleting a custom element from a contenteditable element
Harness: the test ran to completion.
......@@ -23,11 +23,17 @@ test(function () {
var newDoc = document.implementation.createHTMLDocument();
newDoc.importNode(instance);
var logEntries = element.takeLog();
assert_array_equals(logEntries.types(), ['constructed']);
assert_equals(logEntries.last().oldDocument, document);
assert_equals(logEntries.last().newDocument, newDoc);
}, 'importNode on Document must construct a new custom element when importing a custom element');
assert_array_equals(element.takeLog().types(), []);
}, 'importNode on Document must not construct a new custom element when importing a custom element into a window-less document');
test(function () {
var element = define_new_custom_element();
var template = document.createElement('template');
template.innerHTML = `<${element.name}></${element.name}>`;
assert_array_equals(element.takeLog().types(), []);
document.importNode(template.content, true);
assert_array_equals(element.takeLog().types(), ['constructed']);
}, 'importNode on Document must construct a new custom element when importing a custom element from a template');
test(function () {
var element = define_new_custom_element();
......
This is a testharness.js-based test.
PASS deleteContents on Range must enqueue a disconnected reaction
PASS extractContents on Range must enqueue a disconnected reaction
PASS cloneContents on Range must enqueue an attributeChanged reaction when cloning an element with an observed attribute
PASS cloneContents on Range must not enqueue an attributeChanged reaction when cloning an element with an unobserved attribute
PASS cloneContents on Range must enqueue an attributeChanged reaction when cloning an element only for observed attributes
PASS insertNode on Range must enqueue a connected reaction
PASS insertNode on Range must enqueue a disconnected reaction, an adopted reaction, and a connected reaction when the custom element was in another document
PASS surroundContents on Range must enqueue a connected reaction
PASS surroundContents on Range must enqueue a disconnected reaction, an adopted reaction, and a connected reaction when the custom element was in another document
FAIL createContextualFragment on Range must construct a custom element assert_equals: expected (function) function "class CustomElement extends HTMLElement {
constructor() {
super();
log.push({type: 'constructed', element: this});
}
attributeChangedCallback(...args) {
log.push(create_attribute_changed_callback_log(this, ...args));
}
connectedCallback() { log.push({type: 'connected', element: this}); }
disconnectedCallback() { log.push({type: 'disconnected', element: this}); }
adoptedCallback(oldDocument, newDocument) { log.push({type: 'adopted', element: this, oldDocument: oldDocument, newDocument: newDocument}); }
}" but got (object) object "[object HTMLElement]"
Harness: the test ran to completion.
......@@ -73,7 +73,7 @@ function testParsingMarkup(testFunction, name) {
var element = define_new_custom_element(['id']);
assert_array_equals(element.takeLog().types(), []);
var instance = testFunction(document, `<${element.name} id="hello" class="foo"></${element.name}>`);
assert_equals(Object.getPrototypeOf(instance.querySelector(element.name)), element.class);
assert_equals(Object.getPrototypeOf(instance.querySelector(element.name)), element.class.prototype);
var logEntries = element.takeLog();
assert_array_equals(logEntries.types(), ['constructed', 'attributeChanged']);
assert_attribute_log_entry(logEntries[1], {name: 'id', oldValue: null, newValue: 'hello', namespace: null});
......
......@@ -447,6 +447,14 @@ IdlArray.prototype.assert_type_is = function(value, type)
return;
}
if (type.generic === "Promise") {
assert_own_property(value, "then", "Attribute with a Promise type has a then property");
// TODO: Ideally, we would check on project fulfillment
// that we get the right type
// but that would require making the type check async
return;
}
type = type.idlType;
switch(type)
......
......@@ -1247,6 +1247,7 @@ policies and contribution forms [3].
ReadOnlyError: 0,
VersionError: 0,
OperationError: 0,
NotAllowedError: 0
};
if (!(name in name_code_map)) {
......@@ -2463,6 +2464,11 @@ policies and contribution forms [3].
}
}
// 'Error.stack' is not supported in all browsers/versions
if (!stack) {
return "(Stack trace unavailable)";
}
var lines = stack.split("\n");
// Create a pattern to match stack frames originating within testharness.js. These include the
......
<!doctype html>
<meta charset=utf-8>
<title>RTCPeerConnection constructor</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script>
test(function() {
assert_equals(RTCPeerConnection.length, 0);
}, 'RTCPeerConnection.length');
// These are used for string and number dictionary members to see if they are
// being accessed at all.
const toStringThrows = { toString: function() { throw new Error; } };
const toNumberThrows = Symbol();
// Test the first argument of the constructor. The key is the argument itself,
// and the value is the first argument for assert_throws, or false if no
// exception should be thrown.
const testArgs = {
// No argument or equivalent.
'': false,
'null': false,
'undefined': false,
'{}': false,
// iceServers
'{ iceServers: null }': new TypeError,
'{ iceServers: undefined }': false,
'{ iceServers: [] }': false,
'{ iceServers: [{}] }': new TypeError,
'{ iceServers: [null] }': new TypeError,
'{ iceServers: [undefined] }': new TypeError,
'{ iceServers: [{ urls: "stun:stun1.example.net" }] }': false,
'{ iceServers: [{ urls: [] }] }': false,
'{ iceServers: [{ urls: ["stun:stun1.example.net"] }] }': false,
'{ iceServers: [{ urls: ["stun:stun1.example.net", "stun:stun2.example.net"] }] }': false,
// username and password required for turn: and turns:
'{ iceServers: [{ urls: "turns:turn.example.org", username: "user", credential: "cred" }] }': false,
'{ iceServers: [{ urls: "turn:turn.example.net", username: "user", credential: "cred" }] }': false,
'{ iceServers: [{ urls: ["turns:turn.example.org", "turn:turn.example.net"], username: "user", credential: "cred" }] }': false,
'{ iceServers: [{ urls: "stun:stun1.example.net", credentialType: "password" }] }': false,
'{ iceServers: [{ urls: "stun:stun1.example.net", credentialType: "token" }] }': false,
'{ iceServers: [{ urls: "turn:turn.example.net" }] }': 'InvalidAccessError',
'{ iceServers: [{ urls: "turn:turn.example.net", username: "user" }] }': 'InvalidAccessError',
'{ iceServers: [{ urls: "turn:turn.example.net", credential: "cred" }] }': 'InvalidAccessError',
'{ iceServers: [{ urls: "turns:turn.example.org" }] }': 'InvalidAccessError',
'{ iceServers: [{ urls: "turns:turn.example.org", username: "user" }] }': 'InvalidAccessError',
'{ iceServers: [{ urls: "turns:turn.example.org", credential: "cred" }] }': 'InvalidAccessError',
'{ iceServers: [{ urls: "relative-url" }] }': 'SyntaxError',
'{ iceServers: [{ urls: "http://example.com" }] }': 'SyntaxError',
// credentialType
'{ iceServers: [{ urls: [] }] }': false,
'{ iceServers: [{ urls: [], credentialType: "password" }] }': false,
'{ iceServers: [{ urls: [], credentialType: "token" }] }': false,
'{ iceServers: [{ urls: [], credentialType: "invalid" }] }': new TypeError,
// Blink and Gecko fall back to url, but it's not in the spec.
'{ iceServers: [{ url: "stun:stun1.example.net" }] }': new TypeError,
// iceTransportPolicy
'{ iceTransportPolicy: null }': new TypeError,
'{ iceTransportPolicy: undefined }': false,
'{ iceTransportPolicy: "relay" }': false,
'{ iceTransportPolicy: "all" }': false,
'{ iceTransportPolicy: "invalid" }': new TypeError,
// "none" is in Blink and Gecko's IDL, but not in the spec.
'{ iceTransportPolicy: "none" }': new TypeError,
// iceTransportPolicy is called iceTransports in Blink.
'{ iceTransports: "invalid" }': false,
'{ iceTransports: "none" }': false,
// bundlePolicy
'{ bundlePolicy: null }': new TypeError,
'{ bundlePolicy: undefined }': false,
'{ bundlePolicy: "balanced" }': false,
'{ bundlePolicy: "max-compat" }': false,
'{ bundlePolicy: "max-bundle" }': false,
'{ bundlePolicy: "invalid" }': new TypeError,
// rtcpMuxPolicy
'{ rtcpMuxPolicy: null }': new TypeError,
'{ rtcpMuxPolicy: undefined }': false,
'{ rtcpMuxPolicy: "negotiate" }': false,
'{ rtcpMuxPolicy: "require" }': false,
'{ rtcpMuxPolicy: "invalid" }': new TypeError,
// peerIdentity
'{ peerIdentity: toStringThrows }': new Error,
// certificates
'{ certificates: null }': new TypeError,
'{ certificates: undefined }': false,
'{ certificates: [] }': false,
'{ certificates: [null] }': new TypeError,
'{ certificates: [undefined] }': new TypeError,
// iceCandidatePoolSize
'{ iceCandidatePoolSize: toNumberThrows }': new TypeError,
}
for (const arg in testArgs) {
const expr = 'new RTCPeerConnection(' + arg + ')';
test(function() {
const throws = testArgs[arg];
if (throws) {
assert_throws(throws, function() {
eval(expr);
});
} else {
eval(expr);
}
}, expr);
}
promise_test(function() {
return RTCPeerConnection.generateCertificate({ name: "ECDSA", namedCurve: "P-256" })
.then(certificate => new RTCPeerConnection({ certificates: [certificate] }));
}, 'new RTCPeerConnection({ certificates: [certificate] })');
promise_test(function() {
return RTCPeerConnection.generateCertificate({ name: "ECDSA", namedCurve: "P-256", expires: 0 })
.then(certificate => {
assert_less_than_equal(certificate.expires, Date.now());
assert_throws('InvalidAccessError', function() {
new RTCPeerConnection({ certificates: [certificate] });
});
});
}, 'new RTCPeerConnection({ certificates: [expiredCertificate] })');
// The initial values of attributes of RTCPeerConnection.
const initialState = {
'localDescription': null,
'currentLocalDescription': null,
'pendingLocalDescription': null,
'remoteDescription': null,
'currentRemoteDescription': null,
'pendingRemoteDescription': null,
'signalingState': 'stable',
'iceGatheringState': 'new',
'iceConnectionState': 'new',
'connectionState': 'new',
'canTrickleIceCandidates': null,
// TODO: defaultIceServers
};
for (const attr in initialState) {
test(function() {
// Use one RTCPeerConnection instance for all initial value tests.
if (!window.pc) {
window.pc = new RTCPeerConnection;
}
assert_equals(pc[attr], initialState[attr]);
}, attr + ' initial value');
}
</script>
......@@ -447,6 +447,14 @@ IdlArray.prototype.assert_type_is = function(value, type)
return;
}
if (type.generic === "Promise") {
assert_own_property(value, "then", "Attribute with a Promise type has a then property");
// TODO: Ideally, we would check on project fulfillment
// that we get the right type
// but that would require making the type check async
return;
}
type = type.idlType;
switch(type)
......
......@@ -1247,6 +1247,7 @@ policies and contribution forms [3].
ReadOnlyError: 0,
VersionError: 0,
OperationError: 0,
NotAllowedError: 0
};
if (!(name in name_code_map)) {
......@@ -2463,6 +2464,11 @@ policies and contribution forms [3].
}
}
// 'Error.stack' is not supported in all browsers/versions
if (!stack) {
return "(Stack trace unavailable)";
}
var lines = stack.split("\n");
// Create a pattern to match stack frames originating within testharness.js. These include the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment