Commit 4601a0d7 authored by Simon Zünd's avatar Simon Zünd Committed by Commit Bot

Fix comparison function when sorting volumes in tests

The following CL changed how Array.p.sort works in JS:
http://crrev.com/c/1151199

This broke some file manager tests. The reason is a broken comparison
function when sorting the volumes for the tests. JS needs a comparsion
function that returns < 0,0 or > 0 if a value is less than, equal to or
greater than another one respectively. This CL fixes that.

R=joelhockey@chromium.org

Change-Id: I08c4ebf352d3e8ec984239edd01f39eac261e576
Reviewed-on: https://chromium-review.googlesource.com/1184848Reviewed-by: default avatarJoel Hockey <joelhockey@chromium.org>
Commit-Queue: Simon Zünd <szuend@google.com>
Cr-Commit-Position: refs/heads/master@{#585419}
parent d10527ca
......@@ -235,7 +235,7 @@ function initTests(callback) {
var sortedVolumeMetadataList = volumeMetadataList.filter(function(volume) {
return possibleVolumeTypes.indexOf(volume.volumeType) != -1;
}).sort(function(volumeA, volumeB) {
return possibleVolumeTypes.indexOf(volumeA.volumeType) >
return possibleVolumeTypes.indexOf(volumeA.volumeType) -
possibleVolumeTypes.indexOf(volumeB.volumeType);
});
......
......@@ -490,7 +490,7 @@ function initTests(callback) {
var sortedVolumeMetadataList = volumeMetadataList.filter(function(volume) {
return possibleVolumeTypes.indexOf(volume.volumeType) != -1;
}).sort(function(volumeA, volumeB) {
return possibleVolumeTypes.indexOf(volumeA.volumeType) >
return possibleVolumeTypes.indexOf(volumeA.volumeType) -
possibleVolumeTypes.indexOf(volumeB.volumeType);
});
......
......@@ -194,7 +194,7 @@ function run() {
var sortedVolumeMetadataList = volumeMetadataList.filter(function(volume) {
return possibleVolumeTypes.indexOf(volume.volumeType) != -1;
}).sort(function(volumeA, volumeB) {
return possibleVolumeTypes.indexOf(volumeA.volumeType) >
return possibleVolumeTypes.indexOf(volumeA.volumeType) -
possibleVolumeTypes.indexOf(volumeB.volumeType);
});
if (sortedVolumeMetadataList.length == 0) {
......
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