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

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

Issue 954583004: Shrink space required by history log file (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplify some of the history initialization complexity added in earlier patch. 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 9018108d3f9554563bf1c2aa7f0bfd3f32d11084..0e2fca79b2086ec2ea000b0c5caab5d69dbcc83f 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);

Powered by Google App Engine
This is Rietveld 408576698