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

Side by Side Diff: chrome/test/data/extensions/api_test/media_galleries/media_metadata/test.js

Issue 1791623002: Revert of Media Galleries Partial Deprecation: Remove image metadata & libexif. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Manual revert/rebase. Created 4 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 var mediaGalleries = chrome.mediaGalleries; 5 var mediaGalleries = chrome.mediaGalleries;
6 6
7 function RunMetadataTest(filename, callOptions, verifyMetadataFunction) { 7 function RunMetadataTest(filename, callOptions, verifyMetadataFunction) {
8 function getMediaFileSystemsCallback(results) { 8 function getMediaFileSystemsCallback(results) {
9 chrome.test.assertEq(1, results.length); 9 chrome.test.assertEq(1, results.length);
10 var gallery = results[0]; 10 var gallery = results[0];
(...skipping 17 matching lines...) Expand all
28 chrome.test.assertEq("image/jpeg", metadata.mimeType); 28 chrome.test.assertEq("image/jpeg", metadata.mimeType);
29 29
30 chrome.test.assertEq(0, metadata.attachedImages.length); 30 chrome.test.assertEq(0, metadata.attachedImages.length);
31 31
32 chrome.test.succeed(); 32 chrome.test.succeed();
33 } 33 }
34 34
35 RunMetadataTest("test.jpg", {metadataType: 'mimeTypeOnly'}, verifyMetadata); 35 RunMetadataTest("test.jpg", {metadataType: 'mimeTypeOnly'}, verifyMetadata);
36 } 36 }
37 37
38 function ImageTagsTest() {
39 function verifyMetadata(metadata) {
40 chrome.test.assertEq("image/jpeg", metadata.mimeType);
41 chrome.test.assertEq(5616, metadata.width);
42 chrome.test.assertEq(3744, metadata.height);
43 chrome.test.assertEq(0, metadata.rotation);
44 chrome.test.assertEq(300.0, metadata.xResolution);
45 chrome.test.assertEq(300.0, metadata.yResolution);
46 chrome.test.assertEq("Canon", metadata.cameraMake);
47 chrome.test.assertEq("Canon EOS 5D Mark II", metadata.cameraModel);
48 chrome.test.assertEq(0.01, metadata.exposureTimeSeconds);
49 chrome.test.assertFalse(metadata.flashFired);
50 chrome.test.assertEq(3.2, metadata.fNumber);
51 chrome.test.assertEq(100, metadata.focalLengthMm);
52 chrome.test.assertEq(1600, metadata.isoEquivalent);
53
54 chrome.test.assertEq(0, metadata.attachedImages.length);
55
56 chrome.test.succeed();
57 }
58
59 RunMetadataTest("test.jpg", {}, verifyMetadata);
60 }
61
38 function InvalidMultimediaFileTest() { 62 function InvalidMultimediaFileTest() {
39 function verifyMetadata(metadata) { 63 function verifyMetadata(metadata) {
40 chrome.test.assertEq(null, metadata); 64 chrome.test.assertEq(null, metadata);
41 65
42 chrome.test.succeed(); 66 chrome.test.succeed();
43 } 67 }
44 68
45 // Read a file that is not audio or video. 69 // Read a file that is not audio or video.
46 // We use getMetadata directly to test with invalid media data. 70 // We use getMetadata directly to test with invalid media data.
47 chrome.mediaGalleries.getMetadata(new Blob([]), verifyMetadata); 71 chrome.mediaGalleries.getMetadata(new Blob([]), verifyMetadata);
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 return RunMetadataTest("90rotation.mp4", {}, verifyMetadata); 186 return RunMetadataTest("90rotation.mp4", {}, verifyMetadata);
163 } 187 }
164 188
165 chrome.test.getConfig(function(config) { 189 chrome.test.getConfig(function(config) {
166 var customArg = JSON.parse(config.customArg); 190 var customArg = JSON.parse(config.customArg);
167 var useProprietaryCodecs = customArg[0]; 191 var useProprietaryCodecs = customArg[0];
168 192
169 // Should still be able to sniff MP3 MIME type without proprietary codecs. 193 // Should still be able to sniff MP3 MIME type without proprietary codecs.
170 var testsToRun = [ 194 var testsToRun = [
171 ImageMIMETypeOnlyTest, 195 ImageMIMETypeOnlyTest,
196 ImageTagsTest,
172 InvalidMultimediaFileTest 197 InvalidMultimediaFileTest
173 ]; 198 ];
174 199
175 if (useProprietaryCodecs) { 200 if (useProprietaryCodecs) {
176 testsToRun = testsToRun.concat([ 201 testsToRun = testsToRun.concat([
177 MP3MIMETypeOnlyTest, 202 MP3MIMETypeOnlyTest,
178 MP3TagsTest, 203 MP3TagsTest,
179 MP3AttachedImageTest, 204 MP3AttachedImageTest,
180 RotatedVideoTest 205 RotatedVideoTest
181 ]); 206 ]);
182 } 207 }
183 208
184 chrome.test.runTests(testsToRun); 209 chrome.test.runTests(testsToRun);
185 }); 210 });
OLDNEW
« no previous file with comments | « chrome/sync_integration_tests.isolate ('k') | chrome/test/data/extensions/api_test/media_galleries/read_access/test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698