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

Unified Diff: ui/file_manager/file_manager/common/js/importer_common_unittest.js

Issue 963593004: Shrink space required by history log file (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2311
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
Index: ui/file_manager/file_manager/common/js/importer_common_unittest.js
diff --git a/ui/file_manager/file_manager/common/js/importer_common_unittest.js b/ui/file_manager/file_manager/common/js/importer_common_unittest.js
index 1c82a431d87f03e4f76df81e04c1544e8cef095c..0a8aafeba95e70180999e0b5c7ae5700ee9b7896 100644
--- a/ui/file_manager/file_manager/common/js/importer_common_unittest.js
+++ b/ui/file_manager/file_manager/common/js/importer_common_unittest.js
@@ -223,6 +223,39 @@ function testRotateLogs_RemembersInitialActiveLog(callback) {
reportPromise(promise, callback);
}
+function testDeflateAppUrl() {
+ var url = 'filesystem:chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj' +
+ '/external/removable/USB%20Drive/DCIM/derekkind2.jpg';
+ var deflated = importer.deflateAppUrl(url);
+
+ // Just verify that the string starts with our secret sauce marker...
+ assertEquals('$', deflated.substring(0, 1),
+ 'Deflated URLs must beging with the deflation marker.');
+
+ // And that it is shorter than the original...
+ assertTrue(deflated.length < url.length,
+ 'Deflated URLs must be shorter than the original.');
+
+ // And finally that we can reconstitute the original.
+ assertEquals(url, importer.inflateAppUrl(deflated),
+ 'Deflated then inflated URLs must match original URL.');
+};
+
+function testCreateMetadataHashcode(callback) {
+ var promise = importer.createMetadataHashcode(cameraFileEntry)
+ .then(
+ function(hashcode) {
+ // Note that the expression matches at least 4 numbers
+ // in the last segment, since we hard code the byte
+ // size in our test file to a four digit size.
+ // In reality it will vary.
+ assertEquals(0, hashcode.search(/[0-9]{9,}_[0-9]{4,}/),
+ 'Hashcode (' + hashcode + ') does not match next pattern.');
+ });
+
+ reportPromise(promise, callback);
+}
+
/** @param {string} path */
function assertIsMediaDir(path) {
var dir = createDirectoryEntry(sdVolume, path);
« no previous file with comments | « ui/file_manager/file_manager/common/js/importer_common.js ('k') | ui/file_manager/file_manager/foreground/js/file_manager.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698