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

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

Issue 868133004: Serialize reading and writing in the import history storage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 11 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/background/js/import_history.js ('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/background/js/import_history_unittest.js
diff --git a/ui/file_manager/file_manager/background/js/import_history_unittest.js b/ui/file_manager/file_manager/background/js/import_history_unittest.js
index ca0f523c78bfca60f3f71d0067f4c59a21de5833..999963a7057ccf9648969a2454430caf661f8a37 100644
--- a/ui/file_manager/file_manager/background/js/import_history_unittest.js
+++ b/ui/file_manager/file_manager/background/js/import_history_unittest.js
@@ -243,6 +243,27 @@ function testRecordStorageRemembersPreviouslyWrittenRecords(callback) {
reportPromise(testPromise, callback);
}
+function testRecordStorageSerializingOperations(callback) {
+ testPromise = createRealStorage('recordStorageTestForSerializing.data')
+ .then(
+ function(storage) {
+ var writePromises = [];
+ var WRITES_COUNT = 20;
+ for (var i = 0; i < WRITES_COUNT; i++)
+ writePromises.push(storage.write(['abc', '123']));
+ var readAllPromise = storage.readAll().then(
+ function(records) {
+ assertEquals(WRITES_COUNT, records.length);
+ });
+ // Write an extra record, which must be executed afte reading is
+ // completed.
+ writePromises.push(storage.write(['abc', '123']));
+ return Promise.all(writePromises.concat([readAllPromise]));
+ });
+
+ reportPromise(testPromise, callback);
+}
+
function testHistoryLoaderIntegration(callback) {
/** @type {!SyncFileEntryProvider|undefined} */
« no previous file with comments | « ui/file_manager/file_manager/background/js/import_history.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698