| Index: chrome/test/data/apptest/basic.html
|
| diff --git a/chrome/test/data/apptest/basic.html b/chrome/test/data/apptest/basic.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..2bce17470bd66748169bc584b7e11b1f7c110237
|
| --- /dev/null
|
| +++ b/chrome/test/data/apptest/basic.html
|
| @@ -0,0 +1,74 @@
|
| +<!DOCTYPE html>
|
| +<!-- This is an example app used by chrome/functional/apptest.py to demonstrate
|
| + use of the Automation Event Queue for testing webapps.
|
| +
|
| + This example webapp uses explicitly raised events in a simulated
|
| + asyncronous login flow. -->
|
| +<html>
|
| +
|
| + <head>
|
| + <title>AppTest Example</title>
|
| + <script type="text/javascript">
|
| + var globalTimeout;
|
| +
|
| + function write(str) {
|
| + document.getElementById("console").innerHTML += "> " + str + "<br \>";
|
| + }
|
| +
|
| + /* Calls a function after a specified number of miliseconds. */
|
| + function delayedCallback(f, ms) {
|
| + globalTimeout = setTimeout(f, ms);
|
| + }
|
| +
|
| + /* Adds an event with the given name to the AutomationEventQueue. */
|
| + function raiseEvent(str) {
|
| + if (window.domAutomationController) {
|
| + window.domAutomationController.setAutomationId(424242)
|
| + window.domAutomationController.send(str);
|
| + }
|
| + }
|
| +
|
| + function init() {
|
| + write("Initializing...");
|
| + delayedCallback(createLoginLink, 2000);
|
| + raiseEvent("init");
|
| + }
|
| +
|
| + function createLoginLink() {
|
| + write("<a id='login' href='' onclick='return login();'>Log In</a>");
|
| + raiseEvent("login ready");
|
| + }
|
| +
|
| + function login() {
|
| + write("Logging in...");
|
| + delayedCallback(loginSuccess, 2000);
|
| + raiseEvent("login start");
|
| + return false;
|
| + }
|
| +
|
| + function loginSuccess() {
|
| + write("Login succeeded!");
|
| + raiseEvent("login done");
|
| + }
|
| +
|
| + function fail() {
|
| + clearTimeout(globalTimeout);
|
| + write("App failed!");
|
| + raiseEvent("error");
|
| + return false;
|
| + }
|
| + </script>
|
| + </head>
|
| +
|
| + <body onload="init()">
|
| + <div id="s-1">
|
| + [ <a id='fail' href='' onclick='return fail();'>Fail Test</a> ]
|
| + <br /><br />
|
| + </div>
|
| +
|
| + <div id="console">
|
| + </div>
|
| +
|
| + </body>
|
| +
|
| +</html>
|
|
|