Bug 1036851 - Part 3: Add test case for telephony.onready. r=hsiny,khuey

This commit is contained in:
Szu-Yu Chen [:aknow] 2014-07-30 02:11:00 +02:00
parent 59bd7c20af
commit fe8fbaeddd
2 changed files with 36 additions and 0 deletions

View File

@ -4,6 +4,7 @@ browser = false
qemu = true
[test_crash_emulator.js]
[test_ready.js]
[test_incoming_answer_hangup.js]
[test_incoming_reject.js]
[test_outgoing_answer_hangup.js]

View File

@ -0,0 +1,35 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
MARIONETTE_TIMEOUT = 60000;
SpecialPowers.addPermission("telephony", true, document);
function cleanUp() {
SpecialPowers.removePermission("telephony", document);
finish();
}
let telephony = window.navigator.mozTelephony;
ok(telephony);
telephony.onready = function() {
log("Receive 'ready' event");
// Test registering 'ready' event in another window.
let iframe = document.createElement("iframe");
iframe.addEventListener("load", function load() {
iframe.removeEventListener("load", load);
let iframeTelephony = iframe.contentWindow.navigator.mozTelephony;
ok(iframeTelephony);
iframeTelephony.onready = function() {
log("Receive 'ready' event in iframe");
cleanUp();
};
});
document.body.appendChild(iframe);
};