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

Unified Diff: ui/file_manager/file_manager/background/js/test_util.js

Issue 1246923003: Files.app: Stop to use autogen IDs of TreeItems to identify tree items. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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: ui/file_manager/file_manager/background/js/test_util.js
diff --git a/ui/file_manager/file_manager/background/js/test_util.js b/ui/file_manager/file_manager/background/js/test_util.js
index 83ce6ee79dd380983b5bfb075b9808da6faa8918..d7b398bf271ec94323b99845447f952a994e921d 100644
--- a/ui/file_manager/file_manager/background/js/test_util.js
+++ b/ui/file_manager/file_manager/background/js/test_util.js
@@ -140,6 +140,24 @@ test.util.async.selectVolume = function(contentWindow, iconName, callback) {
};
/**
+ * Obtains visible tree items.
+ *
+ * @param {Window} contentWindow Window to be tested.
+ * @return {!Array<string>} List of visible item names.
+ */
+test.util.sync.getTreeItems = function(contentWindow) {
+ var items = contentWindow.document.querySelectorAll(
+ '#directory-tree .tree-item');
+ var result = [];
+ for (var i = 0; i < items.length; i++) {
+ if (items[i].matches('.tree-children:not([expanded]) *'))
+ continue;
+ result.push(items[i].querySelector('.entry-name').textContent);
+ }
+ return result;
+};
+
+/**
* Executes Javascript code on a webview and returns the result.
*
* @param {Window} contentWindow Window to be tested.

Powered by Google App Engine
This is Rietveld 408576698