Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6471)

Unified Diff: chrome/test/data/apptest/basic.html

Issue 9372120: Implementation of AutomationEventQueue and associated framework to support generic non-blocking aut… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed Nirnimesh's most recent comments. Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/chrome_browser.gypi ('k') | chrome/test/functional/PYAUTO_TESTS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « chrome/chrome_browser.gypi ('k') | chrome/test/functional/PYAUTO_TESTS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698