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..ff63e39eb4c9389b9203047fe54061de40d08520 |
--- /dev/null |
+++ b/chrome/test/data/apptest_basic.html |
@@ -0,0 +1,66 @@ |
+<html> |
dennis_jeffrey
2012/02/23 19:26:36
I recommend adding a comment at the top of this fi
craigdh
2012/02/24 01:30:02
Done.
|
+ |
+ <head> |
+ <title>AppTest Example</title> |
+ <script type="text/javascript"> |
+ var globalTimeout; |
+ |
+ function write(str) { |
+ document.getElementById("console").innerHTML += "> " + str + "<br \>"; |
+ } |
+ |
+ function delay(f, ms) { |
+ globalTimeout = setTimeout(f, ms); |
+ } |
+ |
+ function raiseEvent(str) { |
+ if (window.domAutomationController) { |
+ window.domAutomationController.setAutomationId(424242) |
+ window.domAutomationController.send(str); |
+ } |
+ } |
+ |
+ function init() { |
+ write("Initializing..."); |
+ delay(loginReady, 2000); |
+ raiseEvent("init"); |
+ } |
+ |
+ function loginReady() { |
+ write("<a id='login' href='' onclick='return login();'>Log In</a>"); |
+ raiseEvent("login ready"); |
+ } |
+ |
+ function login() { |
+ write("Logging in..."); |
+ delay(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> |