Commit 40f27b9b authored by Joel Hockey's avatar Joel Hockey Committed by Commit Bot

Update FilesApp PluginVm sharing messages

Added tests for dialog messages, and refactored tests
by combining 2 similar tests together.
This should reduce overall overhead on the
bots and maybe help keep test time within
timeout limits.

Bug: 946273
Change-Id: I8f0c3ee98c308b45a3ce56eb6fb72931170ec477
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1616718Reviewed-by: default avatarLuciano Pacheco <lucmult@chromium.org>
Commit-Queue: Joel Hockey <joelhockey@chromium.org>
Cr-Commit-Position: refs/heads/master@{#661242}
parent e93ef5af
...@@ -755,6 +755,12 @@ std::unique_ptr<base::DictionaryValue> GetFileManagerStrings() { ...@@ -755,6 +755,12 @@ std::unique_ptr<base::DictionaryValue> GetFileManagerStrings() {
IDS_FILE_BROWSER_SHARE_ROOT_FOLDER_WITH_CROSTINI); IDS_FILE_BROWSER_SHARE_ROOT_FOLDER_WITH_CROSTINI);
SET_STRING("SHARE_ROOT_FOLDER_WITH_CROSTINI_DRIVE", SET_STRING("SHARE_ROOT_FOLDER_WITH_CROSTINI_DRIVE",
IDS_FILE_BROWSER_SHARE_ROOT_FOLDER_WITH_CROSTINI_DRIVE); IDS_FILE_BROWSER_SHARE_ROOT_FOLDER_WITH_CROSTINI_DRIVE);
SET_STRING("SHARE_ROOT_FOLDER_WITH_PLUGIN_VM_TITLE",
IDS_FILE_BROWSER_SHARE_ROOT_FOLDER_WITH_PLUGIN_VM_TITLE);
SET_STRING("SHARE_ROOT_FOLDER_WITH_PLUGIN_VM",
IDS_FILE_BROWSER_SHARE_ROOT_FOLDER_WITH_PLUGIN_VM);
SET_STRING("SHARE_ROOT_FOLDER_WITH_PLUGIN_VM_DRIVE",
IDS_FILE_BROWSER_SHARE_ROOT_FOLDER_WITH_PLUGIN_VM_DRIVE);
SET_STRING("SIZE_BYTES", IDS_FILE_BROWSER_SIZE_BYTES); SET_STRING("SIZE_BYTES", IDS_FILE_BROWSER_SIZE_BYTES);
SET_STRING("SIZE_COLUMN_LABEL", IDS_FILE_BROWSER_SIZE_COLUMN_LABEL); SET_STRING("SIZE_COLUMN_LABEL", IDS_FILE_BROWSER_SIZE_COLUMN_LABEL);
SET_STRING("SIZE_GB", IDS_FILE_BROWSER_SIZE_GB); SET_STRING("SIZE_GB", IDS_FILE_BROWSER_SIZE_GB);
......
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
<message name="IDS_FILE_BROWSER_MEDIA_VIEW_AUDIO_ROOT_LABEL" desc="A label for the 'Audio' root of media views."> <message name="IDS_FILE_BROWSER_MEDIA_VIEW_AUDIO_ROOT_LABEL" desc="A label for the 'Audio' root of media views.">
Audio Audio
</message> </message>
<message name="IDS_FILE_BROWSER_PLUGIN_VM_DIRECTORY_LABEL" desc="PluginVm local directory label."> <message name="IDS_FILE_BROWSER_PLUGIN_VM_DIRECTORY_LABEL" translateable="false" desc="PluginVm local directory label.">
Plugin VM Plugin VM
</message> </message>
<message name="IDS_FILE_BROWSER_RECENT_ROOT_LABEL" desc="A label for the 'Recent' root which shows files recently modified by the user."> <message name="IDS_FILE_BROWSER_RECENT_ROOT_LABEL" desc="A label for the 'Recent' root which shows files recently modified by the user.">
...@@ -555,10 +555,10 @@ ...@@ -555,10 +555,10 @@
<message name="IDS_FILE_BROWSER_MANAGE_LINUX_SHARING_BUTTON_LABEL" desc="Label for menu that will take users to the settings page where they can manage which files and folders are shared with the crostini Linux container."> <message name="IDS_FILE_BROWSER_MANAGE_LINUX_SHARING_BUTTON_LABEL" desc="Label for menu that will take users to the settings page where they can manage which files and folders are shared with the crostini Linux container.">
Manage Linux sharing Manage Linux sharing
</message> </message>
<message name="IDS_FILE_BROWSER_SHARE_WITH_PLUGIN_VM_BUTTON_LABEL" desc="Label for menu that will share a folder with the Plugin VM."> <message name="IDS_FILE_BROWSER_SHARE_WITH_PLUGIN_VM_BUTTON_LABEL" translateable="false" desc="Label for menu that will share a folder with the Plugin VM.">
Share with Plugin VM Share with Plugin VM
</message> </message>
<message name="IDS_FILE_BROWSER_MANAGE_PLUGIN_VM_SHARING_BUTTON_LABEL" desc="Label for menu that will take users to the settings page where they can manage which files and folders are shared with the Plugin VM."> <message name="IDS_FILE_BROWSER_MANAGE_PLUGIN_VM_SHARING_BUTTON_LABEL" translateable="false" desc="Label for menu that will take users to the settings page where they can manage which files and folders are shared with the Plugin VM.">
Manage Plugin VM sharing Manage Plugin VM sharing
</message> </message>
<message name="IDS_FILE_BROWSER_TOGGLE_HIDDEN_FILES_COMMAND_LABEL" desc="Label for menu or button with checkmark that toggles visibility of hidden files."> <message name="IDS_FILE_BROWSER_TOGGLE_HIDDEN_FILES_COMMAND_LABEL" desc="Label for menu or button with checkmark that toggles visibility of hidden files.">
...@@ -1081,10 +1081,10 @@ ...@@ -1081,10 +1081,10 @@
<message name="IDS_FILE_BROWSER_UNABLE_TO_OPEN_CROSTINI" desc="Message shown when a user tries to use a crostini app to open a file which cannot be shared with the crostini container (e.g. in Play or USB). This message will be removed once we support this action."> <message name="IDS_FILE_BROWSER_UNABLE_TO_OPEN_CROSTINI" desc="Message shown when a user tries to use a crostini app to open a file which cannot be shared with the crostini container (e.g. in Play or USB). This message will be removed once we support this action.">
To open files with <ph name="APP_NAME">$1<ex>Visual Studio Code</ex></ph>, first copy to Linux files folder. To open files with <ph name="APP_NAME">$1<ex>Visual Studio Code</ex></ph>, first copy to Linux files folder.
</message> </message>
<message name="IDS_FILE_BROWSER_SHARE_ROOT_FOLDER_WITH_CROSTINI_TITLE" desc="Message title shown when a user shares the root of a volume such as Downloads with the crostini container."> <message name="IDS_FILE_BROWSER_SHARE_ROOT_FOLDER_WITH_CROSTINI_TITLE" desc="Message title shown when a user shares the root of a volume such as 'My files' with the crostini container.">
Share folder with Linux Share folder with Linux
</message> </message>
<message name="IDS_FILE_BROWSER_SHARE_ROOT_FOLDER_WITH_CROSTINI" desc="Confirmation message shown when a user shares the root of a volume such as Downloads with the crostini container."> <message name="IDS_FILE_BROWSER_SHARE_ROOT_FOLDER_WITH_CROSTINI" desc="Confirmation message shown when a user shares the root of a volume such as 'My files' with the crostini container.">
Give Linux apps permission to modify files in the <ph name="FOLDER_NAME">$1<ex>Downloads</ex></ph> folder Give Linux apps permission to modify files in the <ph name="FOLDER_NAME">$1<ex>Downloads</ex></ph> folder
</message> </message>
<message name="IDS_FILE_BROWSER_SHARE_ROOT_FOLDER_WITH_CROSTINI_DRIVE" desc="Confirmation message shown when a user shares the root of a Drive volume (My Drive, Team Drives, Computers) with the crostini container."> <message name="IDS_FILE_BROWSER_SHARE_ROOT_FOLDER_WITH_CROSTINI_DRIVE" desc="Confirmation message shown when a user shares the root of a Drive volume (My Drive, Team Drives, Computers) with the crostini container.">
...@@ -1096,10 +1096,19 @@ ...@@ -1096,10 +1096,19 @@
<message name="IDS_FILE_BROWSER_FOLDER_SHARED_WITH_CROSTINI_PLURAL" desc="Confirmation message shown when a user shares more than 1 folder with the crostini container."> <message name="IDS_FILE_BROWSER_FOLDER_SHARED_WITH_CROSTINI_PLURAL" desc="Confirmation message shown when a user shares more than 1 folder with the crostini container.">
<ph name="NUMBER_OF_ITEMS">$1<ex>3</ex></ph> folders shared with Linux <ph name="NUMBER_OF_ITEMS">$1<ex>3</ex></ph> folders shared with Linux
</message> </message>
<message name="IDS_FILE_BROWSER_FOLDER_SHARED_WITH_PLUGIN_VM" desc="Confirmation message shown when a user shares a folder with the Plugin VM."> <message name="IDS_FILE_BROWSER_SHARE_ROOT_FOLDER_WITH_PLUGIN_VM_TITLE" translateable="false" desc="Message title shown when a user shares the root of a volume such as 'My files' with the Plugin VM.">
Share folder with PluginVm
</message>
<message name="IDS_FILE_BROWSER_SHARE_ROOT_FOLDER_WITH_PLUGIN_VM" translateable="false" desc="Confirmation message shown when a user shares the root of a volume such as 'My files' with the Plugin VM." >
Give Plugin VM permission to modify files in the <ph name="FOLDER_NAME">$1<ex>Downloads</ex></ph> folder
</message>
<message name="IDS_FILE_BROWSER_SHARE_ROOT_FOLDER_WITH_PLUGIN_VM_DRIVE" translateable="false" desc="Confirmation message shown when a user shares the root of a Drive volume (My Drive, Team Drives, Computers) with the Plugin VM.">
Give Plugin VM permission to modify files in your Google Drive. Changes will sync to your other devices.
</message>
<message name="IDS_FILE_BROWSER_FOLDER_SHARED_WITH_PLUGIN_VM" translateable="false" desc="Confirmation message shown when a user shares a folder with the Plugin VM.">
1 folder shared with Plugin VM 1 folder shared with Plugin VM
</message> </message>
<message name="IDS_FILE_BROWSER_FOLDER_SHARED_WITH_PLUGIN_VM_PLURAL" desc="Confirmation message shown when a user shares more than 1 folder with the Plugin VM."> <message name="IDS_FILE_BROWSER_FOLDER_SHARED_WITH_PLUGIN_VM_PLURAL" translateable="false" desc="Confirmation message shown when a user shares more than 1 folder with the Plugin VM.">
<ph name="NUMBER_OF_ITEMS">$1<ex>3</ex></ph> folders shared with Plugin VM <ph name="NUMBER_OF_ITEMS">$1<ex>3</ex></ph> folders shared with Plugin VM
</message> </message>
......
...@@ -2056,9 +2056,9 @@ CommandHandler.COMMANDS_['share-with-plugin-vm'] = /** @type {Command} */ ({ ...@@ -2056,9 +2056,9 @@ CommandHandler.COMMANDS_['share-with-plugin-vm'] = /** @type {Command} */ ({
// Non-Drive volume roots are always '/'. // Non-Drive volume roots are always '/'.
if (dir.fullPath == '/') { if (dir.fullPath == '/') {
fileManager.ui_.confirmDialog.showHtml( fileManager.ui_.confirmDialog.showHtml(
strf('SHARE_ROOT_FOLDER_WITH_CROSTINI_TITLE'), strf('SHARE_ROOT_FOLDER_WITH_PLUGIN_VM_TITLE'),
strf('SHARE_ROOT_FOLDER_WITH_CROSTINI', info.volumeInfo.label), share, strf('SHARE_ROOT_FOLDER_WITH_PLUGIN_VM', info.volumeInfo.label),
() => {}); share, () => {});
} else if ( } else if (
info.isRootEntry && info.isRootEntry &&
(info.rootType == VolumeManagerCommon.RootType.DRIVE || (info.rootType == VolumeManagerCommon.RootType.DRIVE ||
...@@ -2069,8 +2069,8 @@ CommandHandler.COMMANDS_['share-with-plugin-vm'] = /** @type {Command} */ ({ ...@@ -2069,8 +2069,8 @@ CommandHandler.COMMANDS_['share-with-plugin-vm'] = /** @type {Command} */ ({
// Computers Grand Root. Do not show for roots of a single Shared Drive // Computers Grand Root. Do not show for roots of a single Shared Drive
// or Computer. // or Computer.
fileManager.ui_.confirmDialog.showHtml( fileManager.ui_.confirmDialog.showHtml(
strf('SHARE_ROOT_FOLDER_WITH_CROSTINI_TITLE'), strf('SHARE_ROOT_FOLDER_WITH_PLUGIN_VM_TITLE'),
strf('SHARE_ROOT_FOLDER_WITH_CROSTINI_DRIVE'), share, () => {}); strf('SHARE_ROOT_FOLDER_WITH_PLUGIN_VM_DRIVE'), share, () => {});
} else { } else {
// This is not a root, share it without confirmation dialog. // This is not a root, share it without confirmation dialog.
share(); share();
......
...@@ -447,18 +447,28 @@ test.addEntries = function(downloads, drive, crostini) { ...@@ -447,18 +447,28 @@ test.addEntries = function(downloads, drive, crostini) {
'MyUSB') 'MyUSB')
.fileSystem); .fileSystem);
fsRemovable.populate([], true); fsRemovable.populate([], true);
const fsAndroidFiles = /** @type {MockFileSystem} */ (
mockVolumeManager
.createVolumeInfo(
VolumeManagerCommon.VolumeType.ANDROID_FILES, 'android_files',
str('ANDROID_FILES_ROOT_LABEL'))
.fileSystem);
fsAndroidFiles.populate([], true);
}; };
/** /**
* Sends mount event for crostini volume. * Sends mount event.
* @param {!VolumeManagerCommon.VolumeType} volumeType
* @param {string} volumeId
*/ */
test.mountCrostini = function() { test.mount = function(volumeType, volumeId) {
chrome.fileManagerPrivate.onMountCompleted.dispatchEvent({ chrome.fileManagerPrivate.onMountCompleted.dispatchEvent({
status: 'success', status: 'success',
eventType: 'mount', eventType: 'mount',
volumeMetadata: { volumeMetadata: {
volumeType: VolumeManagerCommon.VolumeType.CROSTINI, volumeType: volumeType,
volumeId: 'crostini', volumeId: volumeId,
isReadOnly: false, isReadOnly: false,
iconSet: {}, iconSet: {},
profile: {isCurrentProfile: true, displayName: ''}, profile: {isCurrentProfile: true, displayName: ''},
...@@ -470,19 +480,22 @@ test.mountCrostini = function() { ...@@ -470,19 +480,22 @@ test.mountCrostini = function() {
/** /**
* Sends mount event for crostini volume. * Sends mount event for crostini volume.
*/ */
test.mountCrostini = function() {
test.mount(VolumeManagerCommon.VolumeType.CROSTINI, 'crostini');
};
/**
* Sends mount event for removable volume.
*/
test.mountRemovable = function() { test.mountRemovable = function() {
chrome.fileManagerPrivate.onMountCompleted.dispatchEvent({ test.mount(VolumeManagerCommon.VolumeType.REMOVABLE, 'removable:MyUSB');
status: 'success', };
eventType: 'mount',
volumeMetadata: { /**
volumeType: VolumeManagerCommon.VolumeType.REMOVABLE, * Sends mount event for android files volume.
volumeId: 'removable:MyUSB', */
isReadOnly: false, test.mountAndroidFiles = function() {
iconSet: {}, test.mount(VolumeManagerCommon.VolumeType.ANDROID_FILES, 'android_files');
profile: {isCurrentProfile: true, displayName: ''},
mountContext: 'user',
},
});
}; };
/** /**
......
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