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
RTCPeerConnection-createOffer-offerToReceive.html
<!doctype html>
<meta charset=utf-8>
<title>Test legacy offerToReceiveAudio/Video options</title>
<link rel="help" href="https://w3c.github.io/webrtc-pc/#legacy-configuration-extensions">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="RTCPeerConnection-helper.js"></script>
<script>
'use strict';
// Run some tests for both audio and video kinds
['audio', 'video'].forEach((kind) => {
const capsKind = kind[0].toUpperCase() + kind.slice(1);
const offerToReceiveTrue = {};
offerToReceiveTrue[`offerToReceive${capsKind}`] = true;
const offerToReceiveFalse = {};
offerToReceiveFalse[`offerToReceive${capsKind}`] = false;
// Start testing
promise_test(t => {
const pc = new RTCPeerConnection();
const dummy = pc.createDataChannel('foo'); // Just to have something to offer
return pc.createOffer(offerToReceiveFalse)
.then(() => {
assert_equals(pc.getTransceivers().length, 0,
'Expect pc to have no transceivers');
});
}, `createOffer() with offerToReceive${capsKind} set to false should not create a transceiver`);
promise_test(t => {
const pc = new RTCPeerConnection();
return pc.createOffer(offerToReceiveTrue)
.then(() => {
assert_equals(pc.getTransceivers().length, 1,
'Expect pc to have one transceiver');
const transceiver = pc.getTransceivers()[0];
assert_equals(transceiver.direction, 'recvonly',
'Expect transceiver to have "recvonly" direction');
});
}, `createOffer() with offerToReceive${capsKind} should create a "recvonly" transceiver`);
promise_test(t => {
const pc = new RTCPeerConnection();
return pc.createOffer(offerToReceiveTrue)
.then(() => {
assert_equals(pc.getTransceivers().length, 1,
'Expect pc to have one transceiver');
const transceiver = pc.getTransceivers()[0];
assert_equals(transceiver.direction, 'recvonly',
'Expect transceiver to have "recvonly" direction');
})
.then(() => pc.createOffer(offerToReceiveTrue))
.then(() => {
assert_equals(pc.getTransceivers().length, 1,
'Expect pc to still have only one transceiver');
})
;
}, `offerToReceive${capsKind} option should be ignored if a non-stopped "recvonly" transceiver exists`);
promise_test(t => {
const pc = new RTCPeerConnection();
return getTrackFromUserMedia(kind)
.then(([track, stream]) => {
pc.addTrack(track, stream);
return pc.createOffer();
})
.then(() => {
assert_equals(pc.getTransceivers().length, 1,
'Expect pc to have one transceiver');
const transceiver = pc.getTransceivers()[0];
assert_equals(transceiver.direction, 'sendrecv',
'Expect transceiver to have "sendrecv" direction');
})
.then(() => pc.createOffer(offerToReceiveTrue))
.then(() => {
assert_equals(pc.getTransceivers().length, 1,
'Expect pc to still have only one transceiver');
})
;
}, `offerToReceive${capsKind} option should be ignored if a non-stopped "sendrecv" transceiver exists`);
promise_test(t => {
const pc = new RTCPeerConnection();
return getTrackFromUserMedia(kind)
.then(([track, stream]) => {
pc.addTrack(track, stream);
return pc.createOffer(offerToReceiveFalse);
})
.then(() => {
assert_equals(pc.getTransceivers().length, 1,
'Expect pc to have one transceiver');
const transceiver = pc.getTransceivers()[0];
assert_equals(transceiver.direction, 'sendonly',
'Expect transceiver to have "sendonly" direction');
})
;
}, `offerToReceive${capsKind} set to false with a track should create a "sendonly" transceiver`);
promise_test(t => {
const pc = new RTCPeerConnection();
pc.addTransceiver(kind, {direction: 'recvonly'});
return pc.createOffer(offerToReceiveFalse)
.then(() => {
assert_equals(pc.getTransceivers().length, 1,
'Expect pc to have one transceiver');
const transceiver = pc.getTransceivers()[0];
assert_equals(transceiver.direction, 'inactive',
'Expect transceiver to have "inactive" direction');
})
;
}, `offerToReceive${capsKind} set to false with a "recvonly" transceiver should change the direction to "inactive"`);
promise_test(t => {
const pc = new RTCPeerConnection();
const pc2 = new RTCPeerConnection();
return getTrackFromUserMedia(kind)
.then(([track, stream]) => {
pc.addTrack(track, stream);
return pc.createOffer();
})
.then((offer) => pc.setLocalDescription(offer))
.then(() => pc2.setRemoteDescription(pc.localDescription))
.then(() => pc2.createAnswer())
.then((answer) => pc2.setLocalDescription(answer))
.then(() => pc.setRemoteDescription(pc2.localDescription))
.then(() => pc.createOffer(offerToReceiveFalse))
.then((offer) => {
assert_equals(pc.getTransceivers().length, 1,
'Expect pc to have one transceiver');
const transceiver = pc.getTransceivers()[0];
assert_equals(transceiver.direction, 'sendonly',
'Expect transceiver to have "sendonly" direction');
})
;
}, `subsequent offerToReceive${capsKind} set to false with a track should change the direction to "sendonly"`);
});
promise_test(t => {
const pc = new RTCPeerConnection();
return pc.createOffer({ offerToReceiveAudio: true, offerToReceiveVideo: true })
.then(() => {
assert_equals(pc.getTransceivers().length, 2,
'Expect pc to have two transceivers');
assert_equals(pc.getTransceivers()[0].direction, 'recvonly',
'Expect first transceiver to have "recvonly" direction');
assert_equals(pc.getTransceivers()[1].direction, 'recvonly',
'Expect second transceiver to have "recvonly" direction');
});
}, 'offerToReceiveAudio and Video should create two "recvonly" transceivers');
</script>
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...