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

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 Dennis' 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
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..bedfa91e37dbe8d4a0d2c37e04e8386568d9dfaf
--- /dev/null
+++ b/chrome/test/data/apptest_basic.html
@@ -0,0 +1,69 @@
+<!DOCTYPE html>
Nirnimesh 2012/02/24 23:18:09 I recommend moving this file a dir 'apptest' so th
+<!-- This is an example app used by chrome/functional/apptest.py to demonstrate
+ use of the Automation Event Queue for testing. -->
Nirnimesh 2012/02/24 23:18:09 testing -> testing webapps
Nirnimesh 2012/02/24 23:18:09 Describe a little what this app does. "Simulates a
+<html>
+
+ <head>
+ <title>AppTest Example</title>
+ <script type="text/javascript">
+ var globalTimeout;
+
+ function write(str) {
+ document.getElementById("console").innerHTML += "> " + str + "<br \>";
+ }
+
+ function delay(f, ms) {
Nirnimesh 2012/02/24 23:18:09 Add doc
Nirnimesh 2012/02/24 23:18:09 rename: delayedCallback
craigdh 2012/02/27 22:43:38 Done.
craigdh 2012/02/27 22:43:38 Done.
+ 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() {
Nirnimesh 2012/02/24 23:18:09 createLoginLink
craigdh 2012/02/27 22:43:38 Done.
+ 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;
Nirnimesh 2012/02/24 23:18:09 why?
craigdh 2012/02/27 22:43:38 If I remember my JS correctly, doesn't the onclick
+ }
+
+ 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>

Powered by Google App Engine
This is Rietveld 408576698