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

Unified Diff: ui/file_manager/integration_tests/file_manager/file_display.js

Issue 1067983002: browser_tests for searching within Downloads in Files (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « chrome/browser/chromeos/file_manager/file_manager_browsertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/integration_tests/file_manager/file_display.js
diff --git a/ui/file_manager/integration_tests/file_manager/file_display.js b/ui/file_manager/integration_tests/file_manager/file_display.js
index 54f9e48c83ec6d714b1bedf68a8c77c409bc1605..d122daf3ca7c2452fa7b8ffc22748b5a1b8c9a92 100644
--- a/ui/file_manager/integration_tests/file_manager/file_display.js
+++ b/ui/file_manager/integration_tests/file_manager/file_display.js
@@ -88,3 +88,111 @@ testcase.fileDisplayMtp = function() {
}
]);
};
+
+/**
+ * Searches for a string in Downloads and checks the correct results are
+ * being displayed.
+ *
+ * @param {string} searchTerm The string to search for.
+ * @param {Array<Object>} expectedResults The results set.
+ *
+ */
+function searchDownloads(searchTerm, expectedResults) {
+ var appId;
+
+ StepsRunner.run([
+ function() {
+ setupAndWaitUntilReady(null, RootPath.DOWNLOADS, this.next);
+ },
+ // Focus the search box.
+ function(inAppId, list) {
+ appId = inAppId;
+ remoteCall.callRemoteTestUtil('fakeEvent',
+ appId,
+ ['#search-box input', 'focus'],
+ this.next);
+ },
+ // Input a text.
+ function(result) {
+ chrome.test.assertTrue(result);
+ remoteCall.callRemoteTestUtil('inputText',
+ appId,
+ ['#search-box input', searchTerm],
+ this.next);
+ },
+ // Notify the element of the input.
+ function() {
+ remoteCall.callRemoteTestUtil('fakeEvent',
+ appId,
+ ['#search-box input', 'input'],
+ this.next);
+ },
+ function(result) {
+ remoteCall.waitForFileListChange(appId, BASIC_LOCAL_ENTRY_SET.length).
+ then(this.next);
+ },
+ function(actualFilesAfter) {
+ chrome.test.assertEq(
+ TestEntryInfo.getExpectedRows(expectedResults).sort(),
+ actualFilesAfter);
+
+ checkIfNoErrorsOccured(this.next);
+ }
+ ]);
+}
+
+testcase.searchNormal = function() {
+ searchDownloads('hello', [ENTRIES.hello]);
+};
+
+testcase.searchCaseInsensitive = function() {
+ searchDownloads('HELLO', [ENTRIES.hello]);
+};
+
+/**
+ * Searches for a string that doesn't match anything in Downloads
+ * and checks that the no items match string is displayed.
+ *
+ */
+testcase.searchNotFound = function() {
+ var appId;
+ var searchTerm = 'blahblah';
+
+ StepsRunner.run([
+ function() {
+ setupAndWaitUntilReady(null, RootPath.DOWNLOADS, this.next);
+ },
+ // Focus the search box.
+ function(inAppId, list) {
+ appId = inAppId;
+ console.log(list);
+ remoteCall.callRemoteTestUtil('fakeEvent',
+ appId,
+ ['#search-box input', 'focus'],
+ this.next);
+ },
+ // Input a text.
+ function(result) {
+ chrome.test.assertTrue(result);
+ remoteCall.callRemoteTestUtil('inputText',
+ appId,
+ ['#search-box input', searchTerm],
+ this.next);
+ },
+ // Notify the element of the input.
+ function() {
+ remoteCall.callRemoteTestUtil('fakeEvent',
+ appId,
+ ['#search-box input', 'input'],
+ this.next);
+ },
+ function(result) {
+ remoteCall.waitForElement(appId, ['#no-search-results b']).
+ then(this.next);
+ },
+ function(element) {
+ chrome.test.assertEq(element.text, '\"' + searchTerm + '\"');
+ checkIfNoErrorsOccured(this.next);
+ }
+ ]);
+};
« no previous file with comments | « chrome/browser/chromeos/file_manager/file_manager_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698