Revision b55e29597d92ab89063673f031151e2bdb4b9479 authored by Joe Downing on 22 March 2018, 07:35:35 UTC, committed by Chromium WPT Sync on 22 March 2018, 07:35:35 UTC
This change moves the KeyboardLock API methods to a 'keyboard' namespace on the Navigator object. We are doing this work now as there has been a request for additional keyboard functionality that would also be placed on the new keyboard object and we wanted to move the KeyboardLock methods there for consistency before we launch. KeyboardLock API Spec is here: https://w3c.github.io/keyboard-lock/#API Old calling pattern: Navigator.keyboardLock(); Navigator.keyboardUnlock(); New calling pattern: Navigator.keyboard.lock(); Navigator.keyboard.unlock(); Note: The main logic in the KeyboardLock.cpp class and tests is the same as it was, however the file changed enough that git does not recognize it as a file move. BUG=680809 Change-Id: I234b2ab12d5ecd44c894ed5103863fd96fd548d4 Reviewed-on: https://chromium-review.googlesource.com/969656 Reviewed-by: Philip Jägenstedt <foolip@chromium.org> Reviewed-by: Gary Kacmarcik <garykac@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Commit-Queue: Daniel Cheng <dcheng@chromium.org> Cr-Commit-Position: refs/heads/master@{#544996}
1 parent 1a8c195
simplecall.https.html
<!doctype html>
<!--
To run this test, you must have a webcam and a microphone or use
fake devices by specifying
--use-fake-device-for-media-stream --use-fake-ui-for-media-stream
for Chrome or by setting the
media.navigator.streams.fake
property to true in Firefox.
-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>RTCPeerConnection Connection Test</title>
</head>
<body>
<div id="log"></div>
<div>
<video id="local-view" autoplay="autoplay"></video>
<video id="remote-view" autoplay="autoplay"/>
</video>
</div>
<!-- These files are in place when executing on W3C. -->
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script type="text/javascript">
var test = async_test('Can set up a basic WebRTC call.', {timeout: 5000});
var gFirstConnection = null;
var gSecondConnection = null;
// if the remote video gets video data that implies the negotiation
// as well as the ICE and DTLS connection are up.
document.getElementById('remote-view')
.addEventListener('loadedmetadata', function() {
// Call negotiated: done.
test.done();
});
function getUserMediaOkCallback(localStream) {
gFirstConnection = new RTCPeerConnection(null);
gFirstConnection.onicecandidate = onIceCandidateToFirst;
localStream.getTracks().forEach(function(track) {
gFirstConnection.addTrack(track, localStream);
});
gFirstConnection.createOffer(onOfferCreated, failed('createOffer'));
var videoTag = document.getElementById('local-view');
videoTag.srcObject = localStream;
};
var onOfferCreated = test.step_func(function(offer) {
gFirstConnection.setLocalDescription(offer);
// This would normally go across the application's signaling solution.
// In our case, the "signaling" is to call this function.
receiveCall(offer.sdp);
});
function receiveCall(offerSdp) {
gSecondConnection = new RTCPeerConnection(null);
gSecondConnection.onicecandidate = onIceCandidateToSecond;
gSecondConnection.ontrack = onRemoteTrack;
var parsedOffer = new RTCSessionDescription({ type: 'offer',
sdp: offerSdp });
gSecondConnection.setRemoteDescription(parsedOffer);
gSecondConnection.createAnswer(onAnswerCreated,
failed('createAnswer'));
};
var onAnswerCreated = test.step_func(function(answer) {
gSecondConnection.setLocalDescription(answer);
// Similarly, this would go over the application's signaling solution.
handleAnswer(answer.sdp);
});
function handleAnswer(answerSdp) {
var parsedAnswer = new RTCSessionDescription({ type: 'answer',
sdp: answerSdp });
gFirstConnection.setRemoteDescription(parsedAnswer);
};
var onIceCandidateToFirst = test.step_func(function(event) {
// If event.candidate is null = no more candidates.
if (event.candidate) {
gSecondConnection.addIceCandidate(event.candidate);
}
});
var onIceCandidateToSecond = test.step_func(function(event) {
if (event.candidate) {
gFirstConnection.addIceCandidate(event.candidate);
}
});
var onRemoteTrack = test.step_func(function(event) {
var videoTag = document.getElementById('remote-view');
if (!videoTag.srcObject) {
videoTag.srcObject = event.streams[0];
}
});
// Returns a suitable error callback.
function failed(function_name) {
return test.unreached_func('WebRTC called error callback for ' + function_name);
}
// This function starts the test.
test.step(function() {
navigator.mediaDevices.getUserMedia({ video: true, audio: true })
.then(test.step_func(getUserMediaOkCallback), failed('getUserMedia'));
});
</script>
</body>
</html>
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...