OLD | NEW |
1 // Callback function to be used for a successful web intent call. | 1 // Callback function to be used for a successful web intent call. |
2 function onSuccess(data) { | 2 function onSuccess(data) { |
3 debug("* got reply: " + data); | 3 debug("* got reply: " + data); |
4 | 4 |
5 if (window.layoutTestController) { | 5 if (window.layoutTestController) { |
6 window.layoutTestController.notifyDone(); | 6 window.layoutTestController.notifyDone(); |
7 } | 7 } |
8 } | 8 } |
9 | 9 |
10 // Callback function to be used for a failed web intent call. | 10 // Callback function to be used for a failed web intent call. |
11 function onFailure(data) { | 11 function onFailure(data) { |
12 debug("* got failure: " + data); | 12 debug("* got failure: " + data); |
13 | 13 |
14 if (window.layoutTestController) { | 14 if (window.layoutTestController) { |
15 window.layoutTestController.notifyDone(); | 15 window.layoutTestController.notifyDone(); |
16 } | 16 } |
17 } | 17 } |
18 | 18 |
19 // Launch a web intent call with callbacks. | 19 // Launch a web intent call with callbacks. |
20 function startIntentWithCallbacks() { | 20 function startIntentWithCallbacks() { |
21 navigator.startActivity(new Intent("action1", "mime/type1", "test"), onSuccess
, onFailure); | 21 navigator.webkitStartActivity(new WebKitIntent("action1", "mime/type1", "test"
), onSuccess, onFailure); |
22 debug("* sent intent"); | 22 debug("* sent intent"); |
23 | 23 |
24 if (window.layoutTestController) { | 24 if (window.layoutTestController) { |
25 window.layoutTestController.waitUntilDone(); | 25 window.layoutTestController.waitUntilDone(); |
26 } else { | 26 } else { |
27 alert('This test needs to run in DRT'); | 27 alert('This test needs to run in DRT'); |
28 } | 28 } |
29 } | 29 } |
30 | 30 |
31 // This button press simulator sets the user gesture indicator that an intent | 31 // This button press simulator sets the user gesture indicator that an intent |
32 // requires to start. | 32 // requires to start. |
33 function simulateButtonPress() { | 33 function simulateButtonPress() { |
34 var button = document.getElementById("button"); | 34 var button = document.getElementById("button"); |
35 if (eventSender) { | 35 if (eventSender) { |
36 eventSender.mouseMoveTo(button.getBoundingClientRect().left + 2, button.getB
oundingClientRect().top + 12); | 36 eventSender.mouseMoveTo(button.getBoundingClientRect().left + 2, button.getB
oundingClientRect().top + 12); |
37 eventSender.mouseDown(); | 37 eventSender.mouseDown(); |
38 eventSender.mouseUp(); | 38 eventSender.mouseUp(); |
39 } | 39 } |
40 } | 40 } |
OLD | NEW |