Bug 751403 - Use window.navigator instead of just navigator in telephony tests, r=mdas, a=b2g-only, npotb

This commit is contained in:
Jonathan Griffin 2012-05-03 11:41:29 -07:00
parent fa7767fbca
commit f20a2d9e36
3 changed files with 11 additions and 11 deletions

View File

@ -17,12 +17,12 @@ class MultiEmulatorDialTest(MarionetteTestCase):
# a global variable when an incoming call is received.
receiver.set_context("chrome")
self.assertTrue(receiver.execute_script("""
return navigator.mozTelephony != undefined && navigator.mozTelephony != null;
return window.navigator.mozTelephony != undefined && window.navigator.mozTelephony != null;
"""))
receiver.execute_script("""
window.wrappedJSObject.incoming = null;
navigator.mozTelephony.addEventListener("incoming", function test_incoming(e) {
navigator.mozTelephony.removeEventListener("incoming", test_incoming);
window.navigator.mozTelephony.addEventListener("incoming", function test_incoming(e) {
window.navigator.mozTelephony.removeEventListener("incoming", test_incoming);
window.wrappedJSObject.incoming = e.call;
});
""")
@ -32,7 +32,7 @@ navigator.mozTelephony.addEventListener("incoming", function test_incoming(e) {
fromPhoneNumber = "1555521%d" % sender.emulator.port
sender.set_context("chrome")
sender.execute_script("""
window.wrappedJSObject.call = navigator.mozTelephony.dial("%s");
window.wrappedJSObject.call = window.navigator.mozTelephony.dial("%s");
""" % toPhoneNumber)
# On the receiver, wait up to 30s for an incoming call to be

View File

@ -17,11 +17,11 @@ class MultiEmulatorDialTest(MarionetteTestCase):
# a global variable when an incoming call is received.
receiver.set_context("chrome")
self.assertTrue(receiver.execute_script("""
return navigator.mozTelephony != undefined && navigator.mozTelephony != null;
return window.navigator.mozTelephony != undefined && window.navigator.mozTelephony != null;
"""))
receiver.execute_script("""
window.wrappedJSObject.incoming = "none";
navigator.mozTelephony.addEventListener("incoming", function(e) {
window.navigator.mozTelephony.addEventListener("incoming", function(e) {
window.wrappedJSObject.incoming = e.call.number;
});
""")
@ -31,7 +31,7 @@ navigator.mozTelephony.addEventListener("incoming", function(e) {
fromPhoneNumber = "1555521%d" % sender.emulator.port
sender.set_context("chrome")
sender.execute_script("""
navigator.mozTelephony.dial("%s");
window.navigator.mozTelephony.dial("%s");
""" % toPhoneNumber)
# On the receiver, wait up to 30s for an incoming call to be

View File

@ -22,12 +22,12 @@ class DialListenerTest(MarionetteTestCase):
# Setup the event listsener on the receiver, which should store
# a global variable when an incoming call is received.
self.assertTrue(receiver.execute_script("""
return navigator.mozTelephony != undefined && navigator.mozTelephony != null;
return window.navigator.mozTelephony != undefined && window.navigator.mozTelephony != null;
"""))
receiver.execute_script("""
window.wrappedJSObject.incoming = null;
navigator.mozTelephony.addEventListener("incoming", function test_incoming(e) {
navigator.mozTelephony.removeEventListener("incoming", test_incoming);
window.navigator.mozTelephony.addEventListener("incoming", function test_incoming(e) {
window.navigator.mozTelephony.removeEventListener("incoming", test_incoming);
window.wrappedJSObject.incoming = e.call;
});
""")
@ -35,7 +35,7 @@ navigator.mozTelephony.addEventListener("incoming", function test_incoming(e) {
# dial the receiver from the sender
sender.execute_script("""
window.wrappedJSObject.sender_state = [];
window.wrappedJSObject.sender_call = navigator.mozTelephony.dial("%s");
window.wrappedJSObject.sender_call = window.navigator.mozTelephony.dial("%s");
window.wrappedJSObject.sender_call.addEventListener("statechange", function test_sender_statechange(e) {
if (e.call.state == 'disconnected')
window.wrappedJSObject.sender_call.removeEventListener("statechange", test_sender_statechange);