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

Unified Diff: tools/chrome_remote_control/chrome_remote_control/test_helpers.js

Issue 11273081: Adding a test for measuring memory usage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 2 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: tools/chrome_remote_control/chrome_remote_control/test_helpers.js
diff --git a/tools/chrome_remote_control/chrome_remote_control/test_helpers.js b/tools/chrome_remote_control/chrome_remote_control/test_helpers.js
new file mode 100644
index 0000000000000000000000000000000000000000..0fb3e019b0085f9d37b0e15b8338879a17132f96
--- /dev/null
+++ b/tools/chrome_remote_control/chrome_remote_control/test_helpers.js
@@ -0,0 +1,37 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Inject this script on any page to use test helpers, e.g., click a link which
+// matches a given text.
+
+(function() {
+ function findElementWithText(element, text) {
+ if (element.innerHTML == text) {
+ return element;
+ }
+ for (var i in element.childNodes) {
+ var found_element = findElementWithText(element.childNodes[i], text);
+ if (found_element) {
+ return found_element;
+ }
+ }
+ return null;
+ }
+
+ function ClickLinkWithText(text) {
+ var element = findElementWithText(document, text);
+ if (element) {
+ element.click();
+ return true;
+ }
+ return false;
+ }
+
+ function ReadyStateComplete() {
+ return document.readyState == "complete";
+ }
+
+ window.__ClickLinkWithText = ClickLinkWithText;
+ window.__ReadyStateComplete = ReadyStateComplete;
+})();

Powered by Google App Engine
This is Rietveld 408576698