Commit 2de4b840 authored by Joel Hockey's avatar Joel Hockey Committed by Commit Bot

Fix default PluginVm name to be PvmDefault

Bug: 957477
Change-Id: Ica275a246afc3791cf06d32b8a67fa4587d1083b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1636651Reviewed-by: default avatarDemetrios Papadopoulos <dpapad@chromium.org>
Reviewed-by: default avatarTimothy Loh <timloh@chromium.org>
Commit-Queue: Joel Hockey <joelhockey@chromium.org>
Cr-Commit-Position: refs/heads/master@{#664601}
parent a0cfff62
...@@ -25,7 +25,7 @@ const char kLsbRelease[] = ...@@ -25,7 +25,7 @@ const char kLsbRelease[] =
class PluginVmFilesTest : public testing::Test { class PluginVmFilesTest : public testing::Test {
public: public:
void Callback(bool expected, const base::FilePath& dir, bool result) { void Callback(bool expected, const base::FilePath& dir, bool result) {
EXPECT_EQ(dir, my_files_.Append("PluginVm")); EXPECT_EQ(dir, my_files_.Append("PvmDefault"));
EXPECT_EQ(result, expected); EXPECT_EQ(result, expected);
} }
...@@ -57,7 +57,7 @@ TEST_F(PluginVmFilesTest, DirNotExists) { ...@@ -57,7 +57,7 @@ TEST_F(PluginVmFilesTest, DirNotExists) {
} }
TEST_F(PluginVmFilesTest, DirAlreadyExists) { TEST_F(PluginVmFilesTest, DirAlreadyExists) {
base::CreateDirectory(my_files_.Append("PluginVm")); base::CreateDirectory(my_files_.Append("PvmDefault"));
EnsureDefaultSharedDirExists(profile_.get(), EnsureDefaultSharedDirExists(profile_.get(),
base::BindOnce(&PluginVmFilesTest::Callback, base::BindOnce(&PluginVmFilesTest::Callback,
base::Unretained(this), true)); base::Unretained(this), true));
...@@ -67,7 +67,7 @@ TEST_F(PluginVmFilesTest, DirAlreadyExists) { ...@@ -67,7 +67,7 @@ TEST_F(PluginVmFilesTest, DirAlreadyExists) {
TEST_F(PluginVmFilesTest, FileAlreadyExists) { TEST_F(PluginVmFilesTest, FileAlreadyExists) {
base::FilePath my_files = base::FilePath my_files =
file_manager::util::GetMyFilesFolderForProfile(profile_.get()); file_manager::util::GetMyFilesFolderForProfile(profile_.get());
base::FilePath path = my_files.Append("PluginVm"); base::FilePath path = my_files.Append("PvmDefault");
EXPECT_TRUE(base::CreateDirectory(my_files)); EXPECT_TRUE(base::CreateDirectory(my_files));
EXPECT_EQ(base::WriteFile(path, "", 0), 0); EXPECT_EQ(base::WriteFile(path, "", 0), 0);
EnsureDefaultSharedDirExists(profile_.get(), EnsureDefaultSharedDirExists(profile_.get(),
......
...@@ -222,7 +222,7 @@ void PluginVmImageManager::OnFDPrepared( ...@@ -222,7 +222,7 @@ void PluginVmImageManager::OnFDPrepared(
vm_tools::concierge::ImportDiskImageRequest request; vm_tools::concierge::ImportDiskImageRequest request;
request.set_cryptohome_id( request.set_cryptohome_id(
chromeos::ProfileHelper::GetUserIdHashFromProfile(profile_)); chromeos::ProfileHelper::GetUserIdHashFromProfile(profile_));
request.set_disk_path(kPluginVmDefaultName); request.set_disk_path(kPluginVmName);
request.set_storage_location( request.set_storage_location(
vm_tools::concierge::STORAGE_CRYPTOHOME_PLUGINVM); vm_tools::concierge::STORAGE_CRYPTOHOME_PLUGINVM);
request.set_source_size(downloaded_plugin_vm_image_size_); request.set_source_size(downloaded_plugin_vm_image_size_);
......
...@@ -50,8 +50,6 @@ class PluginVmManagerFactory : public BrowserContextKeyedServiceFactory { ...@@ -50,8 +50,6 @@ class PluginVmManagerFactory : public BrowserContextKeyedServiceFactory {
} // namespace } // namespace
const char kPluginVmDefaultName[] = "PvmDefault";
PluginVmManager* PluginVmManager::GetForProfile(Profile* profile) { PluginVmManager* PluginVmManager::GetForProfile(Profile* profile) {
return PluginVmManagerFactory::GetForProfile(profile); return PluginVmManagerFactory::GetForProfile(profile);
} }
...@@ -85,7 +83,7 @@ void PluginVmManager::LaunchPluginVm() { ...@@ -85,7 +83,7 @@ void PluginVmManager::LaunchPluginVm() {
void PluginVmManager::StopPluginVm() { void PluginVmManager::StopPluginVm() {
vm_tools::plugin_dispatcher::StopVmRequest request; vm_tools::plugin_dispatcher::StopVmRequest request;
request.set_owner_id(owner_id_); request.set_owner_id(owner_id_);
request.set_vm_name_uuid(kPluginVmDefaultName); request.set_vm_name_uuid(kPluginVmName);
chromeos::DBusThreadManager::Get()->GetVmPluginDispatcherClient()->StopVm( chromeos::DBusThreadManager::Get()->GetVmPluginDispatcherClient()->StopVm(
std::move(request), base::DoNothing()); std::move(request), base::DoNothing());
...@@ -100,7 +98,7 @@ void PluginVmManager::OnStartPluginVmDispatcher(bool success) { ...@@ -100,7 +98,7 @@ void PluginVmManager::OnStartPluginVmDispatcher(bool success) {
vm_tools::plugin_dispatcher::ListVmRequest request; vm_tools::plugin_dispatcher::ListVmRequest request;
request.set_owner_id(owner_id_); request.set_owner_id(owner_id_);
request.set_vm_name_uuid(kPluginVmDefaultName); request.set_vm_name_uuid(kPluginVmName);
chromeos::DBusThreadManager::Get()->GetVmPluginDispatcherClient()->ListVms( chromeos::DBusThreadManager::Get()->GetVmPluginDispatcherClient()->ListVms(
std::move(request), base::BindOnce(&PluginVmManager::OnListVms, std::move(request), base::BindOnce(&PluginVmManager::OnListVms,
...@@ -131,7 +129,7 @@ void PluginVmManager::OnListVms( ...@@ -131,7 +129,7 @@ void PluginVmManager::OnListVms(
case vm_tools::plugin_dispatcher::VmState::VM_STATE_SUSPENDED: { case vm_tools::plugin_dispatcher::VmState::VM_STATE_SUSPENDED: {
vm_tools::plugin_dispatcher::StartVmRequest request; vm_tools::plugin_dispatcher::StartVmRequest request;
request.set_owner_id(owner_id_); request.set_owner_id(owner_id_);
request.set_vm_name_uuid(kPluginVmDefaultName); request.set_vm_name_uuid(kPluginVmName);
chromeos::DBusThreadManager::Get() chromeos::DBusThreadManager::Get()
->GetVmPluginDispatcherClient() ->GetVmPluginDispatcherClient()
...@@ -163,7 +161,7 @@ void PluginVmManager::OnStartVm( ...@@ -163,7 +161,7 @@ void PluginVmManager::OnStartVm(
void PluginVmManager::ShowVm() { void PluginVmManager::ShowVm() {
vm_tools::plugin_dispatcher::ShowVmRequest request; vm_tools::plugin_dispatcher::ShowVmRequest request;
request.set_owner_id(owner_id_); request.set_owner_id(owner_id_);
request.set_vm_name_uuid(kPluginVmDefaultName); request.set_vm_name_uuid(kPluginVmName);
chromeos::DBusThreadManager::Get()->GetVmPluginDispatcherClient()->ShowVm( chromeos::DBusThreadManager::Get()->GetVmPluginDispatcherClient()->ShowVm(
std::move(request), base::BindOnce(&PluginVmManager::OnShowVm, std::move(request), base::BindOnce(&PluginVmManager::OnShowVm,
......
...@@ -16,8 +16,6 @@ class Profile; ...@@ -16,8 +16,6 @@ class Profile;
namespace plugin_vm { namespace plugin_vm {
extern const char kPluginVmDefaultName[];
// The PluginVmManager is responsible for connecting to the D-Bus services to // The PluginVmManager is responsible for connecting to the D-Bus services to
// manage the Plugin Vm. // manage the Plugin Vm.
class PluginVmManager : public KeyedService { class PluginVmManager : public KeyedService {
......
...@@ -21,7 +21,7 @@ namespace plugin_vm { ...@@ -21,7 +21,7 @@ namespace plugin_vm {
constexpr char kPluginVmAppId[] = "lgjpclljbbmphhnalkeplcmnjpfmmaek"; constexpr char kPluginVmAppId[] = "lgjpclljbbmphhnalkeplcmnjpfmmaek";
// Name of the Plugin VM. // Name of the Plugin VM.
constexpr char kPluginVmName[] = "PluginVm"; constexpr char kPluginVmName[] = "PvmDefault";
// Checks if PluginVm is allowed for the current profile. // Checks if PluginVm is allowed for the current profile.
bool IsPluginVmAllowedForProfile(const Profile* profile); bool IsPluginVmAllowedForProfile(const Profile* profile);
......
...@@ -10,11 +10,11 @@ ...@@ -10,11 +10,11 @@
(function() { (function() {
/** /**
* The Plugin VM is named 'PluginVm'. * The Plugin VM is named 'PvmDefault'.
* https://cs.chromium.org/chromium/src/chrome/browser/chromeos/plugin_vm/plugin_vm_util.h?q=kPluginVmName * https://cs.chromium.org/chromium/src/chrome/browser/chromeos/plugin_vm/plugin_vm_util.h?q=kPluginVmName
* @type {string} * @type {string}
*/ */
const PLUGIN_VM = 'PluginVm'; const PLUGIN_VM = 'PvmDefault';
Polymer({ Polymer({
is: 'settings-plugin-vm-shared-paths', is: 'settings-plugin-vm-shared-paths',
......
...@@ -77,7 +77,7 @@ suite('SharedPaths', function() { ...@@ -77,7 +77,7 @@ suite('SharedPaths', function() {
}); });
test('Remove', function() { test('Remove', function() {
return setPrefs({'path1': ['PluginVm'], 'path2': ['PluginVm']}) return setPrefs({'path1': ['PvmDefault'], 'path2': ['PvmDefault']})
.then(() => { .then(() => {
assertEquals( assertEquals(
2, page.shadowRoot.querySelectorAll('.settings-box').length); 2, page.shadowRoot.querySelectorAll('.settings-box').length);
...@@ -91,9 +91,9 @@ suite('SharedPaths', function() { ...@@ -91,9 +91,9 @@ suite('SharedPaths', function() {
return pluginVmBrowserProxy.whenCalled('removePluginVmSharedPath'); return pluginVmBrowserProxy.whenCalled('removePluginVmSharedPath');
}) })
.then(([vmName, path]) => { .then(([vmName, path]) => {
assertEquals('PluginVm', vmName); assertEquals('PvmDefault', vmName);
assertEquals('path1', path); assertEquals('path1', path);
return setPrefs({'path2': ['PluginVm']}); return setPrefs({'path2': ['PvmDefault']});
}) })
.then(() => { .then(() => {
assertEquals( assertEquals(
...@@ -106,7 +106,7 @@ suite('SharedPaths', function() { ...@@ -106,7 +106,7 @@ suite('SharedPaths', function() {
return pluginVmBrowserProxy.whenCalled('removePluginVmSharedPath'); return pluginVmBrowserProxy.whenCalled('removePluginVmSharedPath');
}) })
.then(([vmName, path]) => { .then(([vmName, path]) => {
assertEquals('PluginVm', vmName); assertEquals('PvmDefault', vmName);
assertEquals('path2', path); assertEquals('path2', path);
return setPrefs({'ignored': ['ignore']}); return setPrefs({'ignored': ['ignore']});
}) })
......
...@@ -30,10 +30,10 @@ function CrostiniImpl() { ...@@ -30,10 +30,10 @@ function CrostiniImpl() {
CrostiniImpl.DEFAULT_VM = 'termina'; CrostiniImpl.DEFAULT_VM = 'termina';
/** /**
* Plugin VM 'PluginVm'. * Plugin VM 'PvmDefault'.
* @const * @const
*/ */
CrostiniImpl.PLUGIN_VM = 'PluginVm'; CrostiniImpl.PLUGIN_VM = 'PvmDefault';
/** /**
* Keep in sync with histograms.xml:FileBrowserCrostiniSharedPathsDepth * Keep in sync with histograms.xml:FileBrowserCrostiniSharedPathsDepth
......
...@@ -620,7 +620,7 @@ FileType.getIconOverrides = (entry, opt_rootType) => { ...@@ -620,7 +620,7 @@ FileType.getIconOverrides = (entry, opt_rootType) => {
const overrides = { const overrides = {
[VolumeManagerCommon.RootType.DOWNLOADS]: { [VolumeManagerCommon.RootType.DOWNLOADS]: {
'/Downloads': VolumeManagerCommon.VolumeType.DOWNLOADS, '/Downloads': VolumeManagerCommon.VolumeType.DOWNLOADS,
'/PluginVm': 'plugin_vm', '/PvmDefault': 'plugin_vm',
}, },
}; };
const root = overrides[opt_rootType]; const root = overrides[opt_rootType];
......
...@@ -1151,13 +1151,13 @@ util.getEntryLabel = (locationInfo, entry) => { ...@@ -1151,13 +1151,13 @@ util.getEntryLabel = (locationInfo, entry) => {
return util.getRootTypeLabel(locationInfo); return util.getRootTypeLabel(locationInfo);
} }
// Special case for MyFiles/Downloads and MyFiles/PluginVm. // Special case for MyFiles/Downloads and MyFiles/PvmDefault.
if (locationInfo && if (locationInfo &&
locationInfo.rootType == VolumeManagerCommon.RootType.DOWNLOADS) { locationInfo.rootType == VolumeManagerCommon.RootType.DOWNLOADS) {
if (util.isMyFilesVolumeEnabled() && entry.fullPath == '/Downloads') { if (util.isMyFilesVolumeEnabled() && entry.fullPath == '/Downloads') {
return str('DOWNLOADS_DIRECTORY_LABEL'); return str('DOWNLOADS_DIRECTORY_LABEL');
} }
if (util.isPluginVmEnabled() && entry.fullPath == '/PluginVm') { if (util.isPluginVmEnabled() && entry.fullPath == '/PvmDefault') {
return str('PLUGIN_VM_DIRECTORY_LABEL'); return str('PLUGIN_VM_DIRECTORY_LABEL');
} }
} }
...@@ -1167,7 +1167,7 @@ util.getEntryLabel = (locationInfo, entry) => { ...@@ -1167,7 +1167,7 @@ util.getEntryLabel = (locationInfo, entry) => {
/** /**
* Returns true if specified entry is a special entry such as MyFiles/Downloads, * Returns true if specified entry is a special entry such as MyFiles/Downloads,
* MyFiles/PluginVm or Linux files root which cannot be modified such as * MyFiles/PvmDefault or Linux files root which cannot be modified such as
* deleted/cut or renamed. * deleted/cut or renamed.
* *
* @param {!VolumeManager} volumeManager * @param {!VolumeManager} volumeManager
...@@ -1196,7 +1196,7 @@ util.isNonModifiable = (volumeManager, entry) => { ...@@ -1196,7 +1196,7 @@ util.isNonModifiable = (volumeManager, entry) => {
if (util.isMyFilesVolumeEnabled() && entry.fullPath === '/Downloads') { if (util.isMyFilesVolumeEnabled() && entry.fullPath === '/Downloads') {
return true; return true;
} }
if (util.isPluginVmEnabled() && entry.fullPath === '/PluginVm') { if (util.isPluginVmEnabled() && entry.fullPath === '/PvmDefault') {
return true; return true;
} }
} }
......
...@@ -88,4 +88,4 @@ constants.DEFAULT_CROSTINI_VM = 'termina'; ...@@ -88,4 +88,4 @@ constants.DEFAULT_CROSTINI_VM = 'termina';
* Name of the Plugin VM. * Name of the Plugin VM.
* @const * @const
*/ */
constants.PLUGIN_VM = 'PluginVm'; constants.PLUGIN_VM = 'PvmDefault';
...@@ -9,7 +9,7 @@ const shareBase = { ...@@ -9,7 +9,7 @@ const shareBase = {
enumUmaShareWithLinux: 12, enumUmaShareWithLinux: 12,
enumUmaManageLinuxSharing: 13, enumUmaManageLinuxSharing: 13,
// Params for 'Share with Plugin VM'. // Params for 'Share with Plugin VM'.
vmNamePluginVm: 'PluginVm', vmNamePluginVm: 'PvmDefault',
vmNameSelectorPluginVm: 'plugin-vm', vmNameSelectorPluginVm: 'plugin-vm',
enumUmaShareWithPluginVm: 16, enumUmaShareWithPluginVm: 16,
enumUmaManagePluginVmSharing: 17, enumUmaManagePluginVmSharing: 17,
...@@ -70,7 +70,7 @@ shareBase.testSharePaths = async (vmName, vmNameSelector, enumUma, done) => { ...@@ -70,7 +70,7 @@ shareBase.testSharePaths = async (vmName, vmNameSelector, enumUma, done) => {
const menuHidden = '#file-context-menu[hidden]'; const menuHidden = '#file-context-menu[hidden]';
const androidRoot = '#directory-tree [volume-type-icon="android_files"]'; const androidRoot = '#directory-tree [volume-type-icon="android_files"]';
const shareLabel = {'termina': 'Linux apps', 'PluginVm': 'Plugin VM'}; const shareLabel = {'termina': 'Linux apps', 'PvmDefault': 'Plugin VM'};
const givePermission = `Give ${shareLabel[vmName]} permission to modify `; const givePermission = `Give ${shareLabel[vmName]} permission to modify `;
const oldSharePaths = chrome.fileManagerPrivate.sharePathsWithCrostini; const oldSharePaths = chrome.fileManagerPrivate.sharePathsWithCrostini;
......
...@@ -231,11 +231,11 @@ test.ENTRIES = { ...@@ -231,11 +231,11 @@ test.ENTRIES = {
'...', 'Linux files', '--', 'Folder'), '...', 'Linux files', '--', 'Folder'),
pluginVm: new test.TestEntryInfo( pluginVm: new test.TestEntryInfo(
test.EntryType.DIRECTORY, '', 'PluginVm', '', test.SharedOption.NONE, test.EntryType.DIRECTORY, '', 'PvmDefault', '', test.SharedOption.NONE,
'Jan 1, 2000, 1:00 AM', 'Plugin VM', '--', 'Folder'), 'Jan 1, 2000, 1:00 AM', 'Plugin VM', '--', 'Folder'),
photosInPluginVm: new test.TestEntryInfo( photosInPluginVm: new test.TestEntryInfo(
test.EntryType.DIRECTORY, '', 'PluginVm/photos', '', test.EntryType.DIRECTORY, '', 'PvmDefault/photos', '',
test.SharedOption.NONE, 'Jan 1, 1980, 11:59 PM', 'photos', '--', test.SharedOption.NONE, 'Jan 1, 1980, 11:59 PM', 'photos', '--',
'Folder'), 'Folder'),
}; };
......
...@@ -28,10 +28,10 @@ pluginVm.testLabelIconContextMenu = async (done) => { ...@@ -28,10 +28,10 @@ pluginVm.testLabelIconContextMenu = async (done) => {
['#new-folder', true], ['#new-folder', true],
]; ];
const pluginVmFolder = '#file-list [file-name="PluginVm"]'; const pluginVmFolder = '#file-list [file-name="PvmDefault"]';
const photosSubfolder = '#file-list [file-name="photos"]'; const photosSubfolder = '#file-list [file-name="photos"]';
const iconFolder = const iconFolder =
'#file-list [file-name="PluginVm"] [file-type-icon="plugin_vm"]'; '#file-list [file-name="PvmDefault"] [file-type-icon="plugin_vm"]';
const fileMenuShown = '#file-context-menu:not([hidden])'; const fileMenuShown = '#file-context-menu:not([hidden])';
const iconDirTree = '#directory-tree [file-type-icon="plugin_vm"]'; const iconDirTree = '#directory-tree [file-type-icon="plugin_vm"]';
...@@ -53,7 +53,7 @@ pluginVm.testLabelIconContextMenu = async (done) => { ...@@ -53,7 +53,7 @@ pluginVm.testLabelIconContextMenu = async (done) => {
}); });
} }
// Verify that /PluginVm has label 'Plugin VM'. // Verify that /PvmDefault has label 'Plugin VM'.
await test.setupAndWaitUntilReady([], [], []); await test.setupAndWaitUntilReady([], [], []);
test.addEntries( test.addEntries(
[test.ENTRIES.pluginVm, test.ENTRIES.photosInPluginVm], [], []); [test.ENTRIES.pluginVm, test.ENTRIES.photosInPluginVm], [], []);
...@@ -64,15 +64,15 @@ pluginVm.testLabelIconContextMenu = async (done) => { ...@@ -64,15 +64,15 @@ pluginVm.testLabelIconContextMenu = async (done) => {
// Verify folder icon. // Verify folder icon.
await test.waitForElement(iconFolder); await test.waitForElement(iconFolder);
// Verify /PluginVm folder context menu. // Verify /PvmDefault folder context menu.
await waitForMenuItems(pluginVmFolder, fileMenuShown, fileMenu); await waitForMenuItems(pluginVmFolder, fileMenuShown, fileMenu);
// Change to 'PluginVm' directory, photos folder is shown. // Change to 'PvmDefault' directory, photos folder is shown.
assertTrue(test.fakeMouseDoubleClick(pluginVmFolder)); assertTrue(test.fakeMouseDoubleClick(pluginVmFolder));
await test.waitForFiles( await test.waitForFiles(
test.TestEntryInfo.getExpectedRows([test.ENTRIES.photos])); test.TestEntryInfo.getExpectedRows([test.ENTRIES.photos]));
// Verify /PluginVm/photos folder context menu. // Verify /PvmDefault/photos folder context menu.
await waitForMenuItems(photosSubfolder, fileMenuShown, fileMenuSubfolder); await waitForMenuItems(photosSubfolder, fileMenuShown, fileMenuSubfolder);
done(); done();
......
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