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

Unified Diff: chrome/browser/resources/chromeos/switch_access/test_support.js

Issue 2866123002: Added unit tests for tree_walker and automation_predicate. (Closed)
Patch Set: Combined getSampleTree functions into one Created 3 years, 7 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/browser/resources/chromeos/switch_access/test_support.js
diff --git a/chrome/browser/resources/chromeos/switch_access/test_support.js b/chrome/browser/resources/chromeos/switch_access/test_support.js
new file mode 100644
index 0000000000000000000000000000000000000000..8e76f1ba017ae09e79155645c184ca0fb794ff1b
--- /dev/null
+++ b/chrome/browser/resources/chromeos/switch_access/test_support.js
@@ -0,0 +1,33 @@
+// Copyright 2017 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.
+
+function TestSupport() {};
+
+TestSupport.prototype = {
+ /**
+ * Connect |parent| and |children| to each other.
+ *
+ * @param {!Object} parent
+ * @param {Array<Object>} children
+ */
+ setChildren: function(parent, children) {
+ // Connect parent to its children.
+ parent.children = children;
+ parent.firstChild = children[0];
+ parent.lastChild = children[children.length - 1];
+
+ for (let i = 0; i < children.length; i++) {
+ let child = children[i];
+
+ // Connect children to their parent.
+ child.parent = parent;
+
+ // Connect children to each other
+ if (i < children.length - 1)
+ child.nextSibling = children[i + 1];
+ if (i > 0)
+ child.previousSibling = children[i - 1];
+ }
+ },
+};

Powered by Google App Engine
This is Rietveld 408576698