Commit 8fc4016e authored by Stuart Langley's avatar Stuart Langley Committed by Commit Bot

Remove ImageOrientation.fromDriveOrientation as it's no longer used.

I did a bit of a code search and could not find this being used anymore,
so removing it as per the suggested bug.

- Added an assert just in case it was being used and my code search
  skills were not good enough, so we can roll it back.
- Closure compile the unit tests while I am at it.

Bug: 700272
Change-Id: I5523bbff983fbad3be886319d17278e4673915e3
Reviewed-on: https://chromium-review.googlesource.com/c/1341433Reviewed-by: default avatarLuciano Pacheco <lucmult@chromium.org>
Commit-Queue: Stuart Langley <slangley@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609179}
parent 08b51435
......@@ -174,8 +174,7 @@ IN_PROC_BROWSER_TEST_F(FileManagerJsTest, ExifParser) {
}
IN_PROC_BROWSER_TEST_F(FileManagerJsTest, ImageOrientation) {
RunTest(base::FilePath(FILE_PATH_LITERAL(
"foreground/js/metadata/image_orientation_unittest.html")));
RunGeneratedTest("/foreground/js/metadata/image_orientation_unittest.html");
}
IN_PROC_BROWSER_TEST_F(FileManagerJsTest, ProvidersModel) {
......
......@@ -60,6 +60,7 @@ group("unit_test_data") {
"file_manager/background/js:unit_tests",
"file_manager/common/js:unit_tests",
"file_manager/foreground/js:unit_tests",
"file_manager/foreground/js/metadata:unit_tests",
"file_manager/foreground/js/ui:unit_tests",
"gallery/js:unit_tests",
"gallery/js/image_editor:unit_tests",
......
......@@ -3,11 +3,12 @@
# found in the LICENSE file.
import("//third_party/closure_compiler/compile_js.gni")
import("//third_party/closure_compiler/js_unit_tests.gni")
# TODO(tapted): This entire folder should move to //ui/file_manager/base.
visibility = [ "//ui/file_manager/*" ]
js_type_check("closure_compile") {
js_type_check("closure_compile_module") {
deps = [
":byte_reader",
":closure_compile_externs",
......@@ -102,6 +103,13 @@ js_library("id3_parser") {
js_library("image_orientation") {
}
js_unittest("image_orientation_unittest") {
deps = [
":image_orientation",
"//ui/webui/resources/js:webui_resource_test",
]
}
js_library("image_parsers") {
deps = [
":metadata_parser",
......@@ -194,3 +202,17 @@ js_library("thumbnail_model") {
":metadata_model",
]
}
js_unit_tests("unit_tests") {
deps = [
":image_orientation_unittest",
]
}
group("closure_compile") {
testonly = true
deps = [
":closure_compile_module",
":unit_tests_type_check",
]
}
......@@ -75,14 +75,6 @@ ImageOrientation.fromExifOrientation = function(orientation) {
}
};
/**
* @param {number} rotation90 Clockwise degrees / 90.
* @return {!ImageOrientation}
*/
ImageOrientation.fromDriveOrientation = function(rotation90) {
return ImageOrientation.fromClockwiseRotation(rotation90);
};
/**
* @param {number} rotation90 Clockwise degrees / 90.
* @return {!ImageOrientation}
......
<!DOCTYPE html>
<!-- Copyright 2015 The Chromium Authors. All rights reserved.
-- Use of this source code is governed by a BSD-style license that can be
-- found in the LICENSE file.
-->
<script src="image_orientation.js"></script>
<script src="image_orientation_unittest.js"></script>
......@@ -98,11 +98,9 @@ ImageLoader.prototype.onIncomingRequest_ = function(
};
// Incoming requests won't have the full type.
assert(!(request.orientation instanceof ImageOrientation));
assert(!(typeof request.orientation === 'number'));
if (typeof request.orientation === 'number') {
request.orientation =
ImageOrientation.fromDriveOrientation(request.orientation);
} else if (request.orientation) {
if (request.orientation) {
request.orientation =
ImageOrientation.fromRotationAndScale(request.orientation);
} else {
......
......@@ -26,7 +26,7 @@ function testNormalImage() {
var options = {
maxWidth: 100,
maxHeight: 100,
orientation: ImageOrientation.fromDriveOrientation(0)
orientation: ImageOrientation.fromClockwiseRotation(0)
};
var result = calculateCopyParametersFromOptions(source, options);
assertEquals(0, result.source.x);
......@@ -53,7 +53,7 @@ function testRotatedImage() {
var options = {
maxWidth: 100,
maxHeight: 100,
orientation: ImageOrientation.fromDriveOrientation(1)
orientation: ImageOrientation.fromClockwiseRotation(1)
};
var result = calculateCopyParametersFromOptions(source, options);
assertEquals(0, result.source.x);
......@@ -81,7 +81,7 @@ function testCroppedImage() {
width: 50,
height: 50,
crop: true,
orientation: ImageOrientation.fromDriveOrientation(0)
orientation: ImageOrientation.fromClockwiseRotation(0)
};
var result = calculateCopyParametersFromOptions(source, options);
assertEquals(350, result.source.x);
......@@ -109,7 +109,7 @@ function testCroppedImageWithResize() {
width: 50,
height: 50,
crop: true,
orientation: ImageOrientation.fromDriveOrientation(0)
orientation: ImageOrientation.fromClockwiseRotation(0)
};
var result = calculateCopyParametersFromOptions(source, options);
assertEquals(87, result.source.x);
......@@ -137,7 +137,7 @@ function testCroppedTinyImage() {
width: 50,
height: 50,
crop: true,
orientation: ImageOrientation.fromDriveOrientation(0)
orientation: ImageOrientation.fromClockwiseRotation(0)
};
var result = calculateCopyParametersFromOptions(source, options);
assertEquals(5, result.source.x);
......@@ -165,7 +165,7 @@ function testCroppedRotatedImage() {
width: 50,
height: 50,
crop: true,
orientation: ImageOrientation.fromDriveOrientation(1)
orientation: ImageOrientation.fromClockwiseRotation(1)
};
var result = calculateCopyParametersFromOptions(source, options);
assertEquals(0, result.source.x);
......
......@@ -105,7 +105,7 @@ class LoadImageRequest {
*/
this.url;
/** @type{ImageOrientation|number|ImageTransformParam|undefined} */
/** @type{ImageOrientation|ImageTransformParam|undefined} */
this.orientation;
/** @type {number|undefined} */
this.scale;
......
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