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

Unified Diff: ui/file_manager/file_manager/foreground/js/list_thumbnail_loader_unittest.js

Issue 886503006: Handle sorted event. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 | « ui/file_manager/file_manager/foreground/js/list_thumbnail_loader_unittest.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/file_manager/foreground/js/list_thumbnail_loader_unittest.js
diff --git a/ui/file_manager/file_manager/foreground/js/list_thumbnail_loader_unittest.js b/ui/file_manager/file_manager/foreground/js/list_thumbnail_loader_unittest.js
index 8c917f221f44d23a6d4340cbcb9563763fbbc087..0f506988237d9c9e52247addb603366ee6502924 100644
--- a/ui/file_manager/file_manager/foreground/js/list_thumbnail_loader_unittest.js
+++ b/ui/file_manager/file_manager/foreground/js/list_thumbnail_loader_unittest.js
@@ -242,3 +242,30 @@ function testErrorHandling(callback) {
return !!getOneCallbacks[entry3.toURL()];
}), callback);
}
+
+/**
+ * Test case for handling sorted event in data model.
+ */
+function testSortedEvent(callback) {
+ listThumbnailLoader.setHighPriorityRange(0, 2);
+ fileListModel.push(directory1, entry1, entry2, entry3, entry4, entry5);
+
+ resolveGetOneCallback(entry1.toURL());
+ resolveGetOneCallback(entry2.toURL());
+ assertEquals(0, Object.keys(getOneCallbacks).length);
+
+ // In order to assert that following task enqueues are fired by sorted event,
+ // wait until all thumbnail loads are completed.
+ reportPromise(waitUntil(function() {
+ return thumbnailLoadedEvents.length === 2;
+ }).then(function() {
+ // After the sort, list should be
+ // directory1, entry5, entry4, entry3, entry2, entry1.
+ fileListModel.sort('name', 'desc');
+
+ return waitUntil(function() {
+ return !!getOneCallbacks[entry5.toURL()] &&
+ !!getOneCallbacks[entry4.toURL()]
+ });
+ }), callback);
+}
« no previous file with comments | « ui/file_manager/file_manager/foreground/js/list_thumbnail_loader_unittest.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698