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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 function TestSupport() {};
6
7 TestSupport.prototype = {
8 /**
9 * Connect |parent| and |children| to each other.
10 *
11 * @param {!Object} parent
12 * @param {Array<Object>} children
13 */
14 setChildren: function(parent, children) {
15 // Connect parent to its children.
16 parent.children = children;
17 parent.firstChild = children[0];
18 parent.lastChild = children[children.length - 1];
19
20 for (let i = 0; i < children.length; i++) {
21 let child = children[i];
22
23 // Connect children to their parent.
24 child.parent = parent;
25
26 // Connect children to each other
27 if (i < children.length - 1)
28 child.nextSibling = children[i + 1];
29 if (i > 0)
30 child.previousSibling = children[i - 1];
31 }
32 },
33 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698