Commit a1319271 authored by Luciano Pacheco's avatar Luciano Pacheco Committed by Commit Bot

Reorder zip and mounted volumes

Move zip, MTP, removable and archive volumes after Drive and 3rd-party
FSPs, as requested on the linked bug.

Bug: 867198
Change-Id: I69a61b621e190ade9dd6d16d5655c57ea722cdff
Reviewed-on: https://chromium-review.googlesource.com/1149421Reviewed-by: default avatarJoel Hockey <joelhockey@chromium.org>
Commit-Queue: Luciano Pacheco <lucmult@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577785}
parent f3336c9f
......@@ -493,9 +493,9 @@ NavigationListModel.prototype.flatNavigationItems_ = function() {
* 4.1. Downloads
* 4.2. Play files (android volume) (if enabled).
* 4.3. Linux files (crostini volume or fake item) (if enabled).
* 5. Other volumes (MTP, ARCHIVE, REMOVABLE, Zip volumes).
* 6. Drive volumes.
* 7. Other FSP (File System Provider) (when mounted).
* 5. Drive volumes.
* 6. Other FSP (File System Provider) (when mounted).
* 7. Other volumes (MTP, ARCHIVE, REMOVABLE, Zip volumes).
* 8. Add new services if (it exists).
* @private
*/
......@@ -644,8 +644,19 @@ NavigationListModel.prototype.orderAndNestItems_ = function() {
}
}
// Join MEDIA_VIEW, MTP, ARCHIVE and REMOVABLE. These types belong to same
// section.
// Add Drive.
for (const driveItem of getVolumes(VolumeManagerCommon.VolumeType.DRIVE)) {
this.navigationItems_.push(driveItem);
driveItem.section = NavigationSection.CLOUD;
}
// Add FSP.
for (const provided of getVolumes(VolumeManagerCommon.VolumeType.PROVIDED)) {
this.navigationItems_.push(provided);
provided.section = NavigationSection.CLOUD;
}
// Join MTP, ARCHIVE and REMOVABLE. These types belong to same section.
const zipIndexes = volumeIndexes[NavigationListModel.ZIP_VOLUME_TYPE] || [];
const otherVolumes =
[].concat(
......@@ -662,18 +673,6 @@ NavigationListModel.prototype.orderAndNestItems_ = function() {
volume.section = NavigationSection.REMOVABLE;
}
// Add Drive.
for (const driveItem of getVolumes(VolumeManagerCommon.VolumeType.DRIVE)) {
this.navigationItems_.push(driveItem);
driveItem.section = NavigationSection.CLOUD;
}
// Add FSP.
for (const provided of getVolumes(VolumeManagerCommon.VolumeType.PROVIDED)) {
this.navigationItems_.push(provided);
provided.section = NavigationSection.CLOUD;
}
if (this.addNewServicesItem_)
this.navigationItems_.push(this.addNewServicesItem_);
};
......
......@@ -226,14 +226,15 @@ function testOrderAndNestItems() {
// -> Downloads
// -> Play files
// -> Linux files
// 8. removable:hoge
// 9. archive:a-rar - mounted as archive
// 10. removable:fuga
// 11. mtp:a-phone
// 12. provided:"zip" - mounted as provided: $zipVolumeId
// 13. Drive - from setup()
// 14. provided:prov1
// 15. provided:prov2
// 8. Drive - from setup()
// 9. provided:prov1
// 10. provided:prov2
//
// 11. removable:hoge
// 12. archive:a-rar - mounted as archive
// 13. removable:fuga
// 14. mtp:a-phone
// 15. provided:"zip" - mounted as provided: $zipVolumeId
// Constructor already calls orderAndNestItems_.
const model = new NavigationListModel(
......@@ -252,15 +253,15 @@ function testOrderAndNestItems() {
assertEquals('shortcut2', model.item(5).label);
assertEquals('My files', model.item(6).label);
assertEquals('removable:hoge', model.item(7).label);
assertEquals('archive:a-rar', model.item(8).label);
assertEquals('removable:fuga', model.item(9).label);
assertEquals('mtp:a-phone', model.item(10).label);
assertEquals(zipVolumeId, model.item(11).label);
assertEquals('My Drive', model.item(7).label);
assertEquals('provided:prov1', model.item(8).label);
assertEquals('provided:prov2', model.item(9).label);
assertEquals('My Drive', model.item(12).label);
assertEquals('provided:prov1', model.item(13).label);
assertEquals('provided:prov2', model.item(14).label);
assertEquals('removable:hoge', model.item(10).label);
assertEquals('archive:a-rar', model.item(11).label);
assertEquals('removable:fuga', model.item(12).label);
assertEquals('mtp:a-phone', model.item(13).label);
assertEquals(zipVolumeId, model.item(14).label);
// Check NavigationSection, which defaults to TOP.
// recent-label.
......@@ -280,25 +281,25 @@ function testOrderAndNestItems() {
// My Files.
assertEquals(NavigationSection.MY_FILES, model.item(6).section);
// Drive and FSP are grouped together.
// My Drive.
assertEquals(NavigationSection.CLOUD, model.item(7).section);
// provided:prov1.
assertEquals(NavigationSection.CLOUD, model.item(8).section);
// provided:prov2.
assertEquals(NavigationSection.CLOUD, model.item(9).section);
// MTP/Archive/Removable are grouped together.
// removable:hoge.
assertEquals(NavigationSection.REMOVABLE, model.item(7).section);
assertEquals(NavigationSection.REMOVABLE, model.item(10).section);
// archive:a-rar.
assertEquals(NavigationSection.REMOVABLE, model.item(8).section);
assertEquals(NavigationSection.REMOVABLE, model.item(11).section);
// removable:fuga.
assertEquals(NavigationSection.REMOVABLE, model.item(9).section);
assertEquals(NavigationSection.REMOVABLE, model.item(12).section);
// mtp:a-phone.
assertEquals(NavigationSection.REMOVABLE, model.item(10).section);
assertEquals(NavigationSection.REMOVABLE, model.item(13).section);
// archive:"zip" - $zipVolumeId
assertEquals(NavigationSection.REMOVABLE, model.item(11).section);
// Drive and FSP are grouped together.
// My Drive.
assertEquals(NavigationSection.CLOUD, model.item(12).section);
// provided:prov1.
assertEquals(NavigationSection.CLOUD, model.item(13).section);
// provided:prov2.
assertEquals(NavigationSection.CLOUD, model.item(14).section);
assertEquals(NavigationSection.REMOVABLE, model.item(14).section);
const myFilesModel = model.item(6);
// Re-order again.
......
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