Index: ui/file_manager/file_manager/foreground/js/navigation_list_model_unittest.js |
diff --git a/ui/file_manager/file_manager/foreground/js/navigation_list_model_unittest.js b/ui/file_manager/file_manager/foreground/js/navigation_list_model_unittest.js |
index 62e92a269c7ceb7dd4fc94e7cdc4611d3cb43361..4886eb6aca7f45b4699505d9447f628ee9e9d219 100644 |
--- a/ui/file_manager/file_manager/foreground/js/navigation_list_model_unittest.js |
+++ b/ui/file_manager/file_manager/foreground/js/navigation_list_model_unittest.js |
@@ -2,21 +2,31 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-function setUp() { |
- // Set up string assets. |
- loadTimeData.data = { |
- DRIVE_DIRECTORY_LABEL: 'My Drive', |
- DOWNLOADS_DIRECTORY_LABEL: 'Downloads' |
- }; |
+/** @type {!MockFileSystem} Simulate the drive file system. */ |
+var drive; |
+ |
+/** @type {!MockFileSystem} Simulate a removable volume. */ |
+var hoge; |
+ |
+// Set up string assets. |
+loadTimeData.data = { |
+ DRIVE_DIRECTORY_LABEL: 'My Drive', |
+ DOWNLOADS_DIRECTORY_LABEL: 'Downloads' |
+}; |
+function setUp() { |
// Override VolumeInfo.prototype.resolveDisplayRoot. |
VolumeInfo.prototype.resolveDisplayRoot = function() {}; |
+ |
+ drive = new MockFileSystem('drive'); |
+ hoge = new MockFileSystem('removable:hoge'); |
+ |
} |
function testModel() { |
var volumeManager = new MockVolumeManagerWrapper(); |
var shortcutListModel = new MockFolderShortcutDataModel( |
- [new MockFileEntry('drive', '/root/shortcut')]); |
+ [new MockFileEntry(drive, '/root/shortcut')]); |
var model = new NavigationListModel(volumeManager, shortcutListModel); |
assertEquals(3, model.length); |
@@ -28,18 +38,18 @@ function testModel() { |
function testAddAndRemoveShortcuts() { |
var volumeManager = new MockVolumeManagerWrapper(); |
var shortcutListModel = new MockFolderShortcutDataModel( |
- [new MockFileEntry('drive', '/root/shortcut')]); |
+ [new MockFileEntry(drive, '/root/shortcut')]); |
var model = new NavigationListModel(volumeManager, shortcutListModel); |
assertEquals(3, model.length); |
// Add a shortcut at the tail. |
- shortcutListModel.splice(1, 0, new MockFileEntry('drive', '/root/shortcut2')); |
+ shortcutListModel.splice(1, 0, new MockFileEntry(drive, '/root/shortcut2')); |
assertEquals(4, model.length); |
assertEquals('/root/shortcut2', model.item(3).entry.fullPath); |
// Add a shortcut at the head. |
- shortcutListModel.splice(0, 0, new MockFileEntry('drive', '/root/hoge')); |
+ shortcutListModel.splice(0, 0, new MockFileEntry(drive, '/root/hoge')); |
assertEquals(5, model.length); |
assertEquals('/root/hoge', model.item(2).entry.fullPath); |
assertEquals('/root/shortcut', model.item(3).entry.fullPath); |
@@ -60,7 +70,7 @@ function testAddAndRemoveShortcuts() { |
function testAddAndRemoveVolumes() { |
var volumeManager = new MockVolumeManagerWrapper(); |
var shortcutListModel = new MockFolderShortcutDataModel( |
- [new MockFileEntry('drive', '/root/shortcut')]); |
+ [new MockFileEntry(drive, '/root/shortcut')]); |
var model = new NavigationListModel(volumeManager, shortcutListModel); |
assertEquals(3, model.length); |
@@ -88,7 +98,7 @@ function testAddAndRemoveVolumes() { |
// A shortcut is created on the 'hoge' volume. |
shortcutListModel.splice( |
- 1, 0, new MockFileEntry('removable:hoge', '/shortcut2')); |
+ 1, 0, new MockFileEntry(hoge, '/shortcut2')); |
assertEquals(6, model.length); |
assertEquals('drive', model.item(0).volumeInfo.volumeId); |
assertEquals('downloads', model.item(1).volumeInfo.volumeId); |