Commit dd9e2211 authored by Joel Hockey's avatar Joel Hockey Committed by Commit Bot

Launch Plugin VM immediately if it is already imported

Bug: b/154140429
Change-Id: I4cee76ea773233b5e01a00a6d198ac3e8aedf673
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2400790
Auto-Submit: Joel Hockey <joelhockey@chromium.org>
Reviewed-by: default avatarJason Lin <lxj@google.com>
Commit-Queue: Joel Hockey <joelhockey@chromium.org>
Cr-Commit-Position: refs/heads/master@{#805622}
parent 0709f04c
...@@ -257,13 +257,12 @@ void PluginVmInstallerView::OnDownloadProgressUpdated(uint64_t bytes_downloaded, ...@@ -257,13 +257,12 @@ void PluginVmInstallerView::OnDownloadProgressUpdated(uint64_t bytes_downloaded,
void PluginVmInstallerView::OnVmExists() { void PluginVmInstallerView::OnVmExists() {
DCHECK_EQ(installing_state_, InstallingState::kCheckingForExistingVm); DCHECK_EQ(installing_state_, InstallingState::kCheckingForExistingVm);
// TODO(b/154140429): Consider automatically dismissing the dialog.
// This case should only occur if the user manually installed a VM via vmc,
// which is rare enough so we just re-use the regular success strings.
state_ = State::kImported; state_ = State::kImported;
installing_state_ = InstallingState::kInactive; installing_state_ = InstallingState::kInactive;
OnStateUpdated(); OnStateUpdated();
// Launch app now if the VM has previously been imported via
// 'vmc import -p PvmDefault image.zip'.
AcceptDialog();
} }
void PluginVmInstallerView::OnCreated() { void PluginVmInstallerView::OnCreated() {
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/dbus/debug_daemon/fake_debug_daemon_client.h" #include "chromeos/dbus/debug_daemon/fake_debug_daemon_client.h"
#include "chromeos/dbus/fake_concierge_client.h" #include "chromeos/dbus/fake_concierge_client.h"
#include "chromeos/dbus/fake_vm_plugin_dispatcher_client.h"
#include "chromeos/tpm/stub_install_attributes.h" #include "chromeos/tpm/stub_install_attributes.h"
#include "components/account_id/account_id.h" #include "components/account_id/account_id.h"
#include "components/download/public/background_service/download_metadata.h" #include "components/download/public/background_service/download_metadata.h"
...@@ -65,6 +66,9 @@ class PluginVmInstallerViewBrowserTest : public DialogBrowserTest { ...@@ -65,6 +66,9 @@ class PluginVmInstallerViewBrowserTest : public DialogBrowserTest {
fake_concierge_client_ = static_cast<chromeos::FakeConciergeClient*>( fake_concierge_client_ = static_cast<chromeos::FakeConciergeClient*>(
chromeos::DBusThreadManager::Get()->GetConciergeClient()); chromeos::DBusThreadManager::Get()->GetConciergeClient());
fake_concierge_client_->set_disk_image_progress_signal_connected(true); fake_concierge_client_->set_disk_image_progress_signal_connected(true);
fake_vm_plugin_dispatcher_client_ =
static_cast<chromeos::FakeVmPluginDispatcherClient*>(
chromeos::DBusThreadManager::Get()->GetVmPluginDispatcherClient());
network_connection_tracker_ = network_connection_tracker_ =
network::TestNetworkConnectionTracker::CreateInstance(); network::TestNetworkConnectionTracker::CreateInstance();
...@@ -146,6 +150,7 @@ class PluginVmInstallerViewBrowserTest : public DialogBrowserTest { ...@@ -146,6 +150,7 @@ class PluginVmInstallerViewBrowserTest : public DialogBrowserTest {
std::unique_ptr<user_manager::ScopedUserManager> scoped_user_manager_; std::unique_ptr<user_manager::ScopedUserManager> scoped_user_manager_;
PluginVmInstallerView* view_; PluginVmInstallerView* view_;
chromeos::FakeConciergeClient* fake_concierge_client_; chromeos::FakeConciergeClient* fake_concierge_client_;
chromeos::FakeVmPluginDispatcherClient* fake_vm_plugin_dispatcher_client_;
private: private:
void EnterpriseEnrollDevice() { void EnterpriseEnrollDevice() {
...@@ -295,3 +300,23 @@ IN_PROC_BROWSER_TEST_F( ...@@ -295,3 +300,23 @@ IN_PROC_BROWSER_TEST_F(
plugin_vm::PluginVmInstaller::FailureReason>>( plugin_vm::PluginVmInstaller::FailureReason>>(
plugin_vm::PluginVmInstaller::FailureReason::NOT_ALLOWED)))); plugin_vm::PluginVmInstaller::FailureReason::NOT_ALLOWED))));
} }
IN_PROC_BROWSER_TEST_F(PluginVmInstallerViewBrowserTestWithFeatureEnabled,
SetupShouldLaunchIfImageAlreadyImported) {
AllowPluginVm();
// Setup dispatcher client for VM already imported.
vm_tools::plugin_dispatcher::ListVmResponse list_vms_response;
list_vms_response.add_vm_info()->set_state(
vm_tools::plugin_dispatcher::VmState::VM_STATE_STOPPED);
fake_vm_plugin_dispatcher_client_->set_list_vms_response(list_vms_response);
ShowUi("default");
EXPECT_NE(nullptr, view_);
view_->AcceptDialog();
WaitForSetupToFinish();
// Installer should be closed.
EXPECT_EQ(nullptr, PluginVmInstallerView::GetActiveViewForTesting());
}
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