Commit e8a6938a authored by François Degros's avatar François Degros Committed by Commit Bot

[Files app] Fixed unit test exif_parser_unittest

Passed to ExitParser's constructor an object that actually implements
the expected interface MetadataParserLogger.

Change-Id: Ifad809c2bed7d334c62fc4ecd1c244d5ef218c83
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1646795Reviewed-by: default avatarLuciano Pacheco <lucmult@chromium.org>
Commit-Queue: Luciano Pacheco <lucmult@chromium.org>
Commit-Queue: François Degros <fdegros@chromium.org>
Auto-Submit: François Degros <fdegros@chromium.org>
Cr-Commit-Position: refs/heads/master@{#666548}
parent e61d2af3
...@@ -64,19 +64,35 @@ function writeDirectory_(bytes, tag) { ...@@ -64,19 +64,35 @@ function writeDirectory_(bytes, tag) {
byteWriter.checkResolved(); byteWriter.checkResolved();
} }
/**
* @implements {MetadataParserLogger}
* @final
*/
class ConsoleLogger {
constructor() {
this.verbose = true;
}
error(arg) {
console.error(arg);
}
log(arg) {
console.log(arg);
}
vlog(arg) {
console.log(arg);
}
}
/** /**
* Parses exif data bytes (with logging) and returns the parsed tags. * Parses exif data bytes (with logging) and returns the parsed tags.
* @param {!TypedArray} bytes Bytes to be read. * @param {!TypedArray} bytes Bytes to be read.
* @return {!Object<!Exif.Tag, !ExifEntry>} Tags. * @return {!Object<!Exif.Tag, !ExifEntry>} Tags.
*/ */
function parseExifData_(bytes) { function parseExifData_(bytes) {
let exifParser = new ExifParser(this); const exifParser = new ExifParser(new ConsoleLogger());
exifParser.log = arg => {
console.log(arg);
};
exifParser.vlog = arg => {
console.log(arg);
};
let tags = {}; let tags = {};
let byteReader = new ByteReader(bytes.buffer); let byteReader = new ByteReader(bytes.buffer);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment