mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Bug 1036851 - Part 3: Add test case for telephony.onready. r=hsiny,khuey
This commit is contained in:
parent
59bd7c20af
commit
fe8fbaeddd
@ -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]
|
||||
|
35
dom/telephony/test/marionette/test_ready.js
Normal file
35
dom/telephony/test/marionette/test_ready.js
Normal 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);
|
||||
};
|
Loading…
Reference in New Issue
Block a user