Commit d38cb945 authored by Pavol Marko's avatar Pavol Marko Committed by Commit Bot

Remove unused encryption migration modes (minimal migration)

This CL removes the encryption migration modes START_MINIMAL_MIGRATION
and RESUME_MINIMAL_MIGRATION. These could only be triggered by
enterprise policy which was removed in CL:2513205.

Bug: 832127
Change-Id: I59be83b162a49c7437aeab321f895b80bd8de7f3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2512892
Commit-Queue: Pavol Marko <pmarko@chromium.org>
Reviewed-by: default avatarRoman Sorokin [CET] <rsorokin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826560}
parent 95cd1db5
...@@ -46,8 +46,6 @@ const test::UIPath kMigratingDialog = {kEncryptionMigrationId, ...@@ -46,8 +46,6 @@ const test::UIPath kMigratingDialog = {kEncryptionMigrationId,
const test::UIPath kErrorDialog = {kEncryptionMigrationId, "error-dialog"}; const test::UIPath kErrorDialog = {kEncryptionMigrationId, "error-dialog"};
const test::UIPath kInsufficientSpaceDialog = {kEncryptionMigrationId, const test::UIPath kInsufficientSpaceDialog = {kEncryptionMigrationId,
"insufficient-space-dialog"}; "insufficient-space-dialog"};
const test::UIPath kMinimalMigrationDialog = {kEncryptionMigrationId,
"minimal-migration-dialog"};
const test::UIPath kMigrationProgress = {kEncryptionMigrationId, const test::UIPath kMigrationProgress = {kEncryptionMigrationId,
"migration-progress"}; "migration-progress"};
const test::UIPath kSkipButton = {kEncryptionMigrationId, "skip-button"}; const test::UIPath kSkipButton = {kEncryptionMigrationId, "skip-button"};
...@@ -121,7 +119,6 @@ class EncryptionMigrationTest : public OobeBaseTest { ...@@ -121,7 +119,6 @@ class EncryptionMigrationTest : public OobeBaseTest {
test::OobeJS().ExpectHiddenPath(kReadyDialog); test::OobeJS().ExpectHiddenPath(kReadyDialog);
test::OobeJS().ExpectHiddenPath(kErrorDialog); test::OobeJS().ExpectHiddenPath(kErrorDialog);
test::OobeJS().ExpectHiddenPath(kInsufficientSpaceDialog); test::OobeJS().ExpectHiddenPath(kInsufficientSpaceDialog);
test::OobeJS().ExpectHiddenPath(kMinimalMigrationDialog);
EXPECT_EQ( EXPECT_EQ(
GetTestCryptohomeId(), GetTestCryptohomeId(),
...@@ -192,7 +189,6 @@ IN_PROC_BROWSER_TEST_F(EncryptionMigrationTest, SkipWithNoPolicySet) { ...@@ -192,7 +189,6 @@ IN_PROC_BROWSER_TEST_F(EncryptionMigrationTest, SkipWithNoPolicySet) {
test::OobeJS().ExpectHiddenPath(kMigratingDialog); test::OobeJS().ExpectHiddenPath(kMigratingDialog);
test::OobeJS().ExpectHiddenPath(kErrorDialog); test::OobeJS().ExpectHiddenPath(kErrorDialog);
test::OobeJS().ExpectHiddenPath(kInsufficientSpaceDialog); test::OobeJS().ExpectHiddenPath(kInsufficientSpaceDialog);
test::OobeJS().ExpectHiddenPath(kMinimalMigrationDialog);
test::OobeJS().ExpectVisiblePath(kSkipButton); test::OobeJS().ExpectVisiblePath(kSkipButton);
test::OobeJS().ExpectVisiblePath(kUpgradeButton); test::OobeJS().ExpectVisiblePath(kUpgradeButton);
...@@ -216,7 +212,6 @@ IN_PROC_BROWSER_TEST_F(EncryptionMigrationTest, MigrateWithNoUserPolicySet) { ...@@ -216,7 +212,6 @@ IN_PROC_BROWSER_TEST_F(EncryptionMigrationTest, MigrateWithNoUserPolicySet) {
test::OobeJS().ExpectHiddenPath(kMigratingDialog); test::OobeJS().ExpectHiddenPath(kMigratingDialog);
test::OobeJS().ExpectHiddenPath(kErrorDialog); test::OobeJS().ExpectHiddenPath(kErrorDialog);
test::OobeJS().ExpectHiddenPath(kInsufficientSpaceDialog); test::OobeJS().ExpectHiddenPath(kInsufficientSpaceDialog);
test::OobeJS().ExpectHiddenPath(kMinimalMigrationDialog);
test::OobeJS().ExpectVisiblePath(kSkipButton); test::OobeJS().ExpectVisiblePath(kSkipButton);
test::OobeJS().ExpectVisiblePath(kUpgradeButton); test::OobeJS().ExpectVisiblePath(kUpgradeButton);
...@@ -270,7 +265,6 @@ IN_PROC_BROWSER_TEST_F(EncryptionMigrationTest, ...@@ -270,7 +265,6 @@ IN_PROC_BROWSER_TEST_F(EncryptionMigrationTest,
test::OobeJS().ExpectHiddenPath(kReadyDialog); test::OobeJS().ExpectHiddenPath(kReadyDialog);
test::OobeJS().ExpectHiddenPath(kMigratingDialog); test::OobeJS().ExpectHiddenPath(kMigratingDialog);
test::OobeJS().ExpectHiddenPath(kErrorDialog); test::OobeJS().ExpectHiddenPath(kErrorDialog);
test::OobeJS().ExpectHiddenPath(kMinimalMigrationDialog);
test::OobeJS().ExpectHiddenPath(kInsufficientSpaceRestartButton); test::OobeJS().ExpectHiddenPath(kInsufficientSpaceRestartButton);
test::OobeJS().ExpectVisiblePath(kInsufficientSpaceSkipButton); test::OobeJS().ExpectVisiblePath(kInsufficientSpaceSkipButton);
...@@ -294,7 +288,6 @@ IN_PROC_BROWSER_TEST_F(EncryptionMigrationTest, MigrateWithInsuficientSpace) { ...@@ -294,7 +288,6 @@ IN_PROC_BROWSER_TEST_F(EncryptionMigrationTest, MigrateWithInsuficientSpace) {
test::OobeJS().ExpectHiddenPath(kReadyDialog); test::OobeJS().ExpectHiddenPath(kReadyDialog);
test::OobeJS().ExpectHiddenPath(kMigratingDialog); test::OobeJS().ExpectHiddenPath(kMigratingDialog);
test::OobeJS().ExpectHiddenPath(kErrorDialog); test::OobeJS().ExpectHiddenPath(kErrorDialog);
test::OobeJS().ExpectHiddenPath(kMinimalMigrationDialog);
test::OobeJS().ExpectVisiblePath(kInsufficientSpaceRestartButton); test::OobeJS().ExpectVisiblePath(kInsufficientSpaceRestartButton);
test::OobeJS().ExpectHiddenPath(kInsufficientSpaceSkipButton); test::OobeJS().ExpectHiddenPath(kInsufficientSpaceSkipButton);
...@@ -319,7 +312,6 @@ IN_PROC_BROWSER_TEST_F(EncryptionMigrationTest, InsufficientSpaceOnResume) { ...@@ -319,7 +312,6 @@ IN_PROC_BROWSER_TEST_F(EncryptionMigrationTest, InsufficientSpaceOnResume) {
test::OobeJS().ExpectHiddenPath(kReadyDialog); test::OobeJS().ExpectHiddenPath(kReadyDialog);
test::OobeJS().ExpectHiddenPath(kMigratingDialog); test::OobeJS().ExpectHiddenPath(kMigratingDialog);
test::OobeJS().ExpectHiddenPath(kErrorDialog); test::OobeJS().ExpectHiddenPath(kErrorDialog);
test::OobeJS().ExpectHiddenPath(kMinimalMigrationDialog);
test::OobeJS().ExpectVisiblePath(kInsufficientSpaceRestartButton); test::OobeJS().ExpectVisiblePath(kInsufficientSpaceRestartButton);
test::OobeJS().ExpectHiddenPath(kInsufficientSpaceSkipButton); test::OobeJS().ExpectHiddenPath(kInsufficientSpaceSkipButton);
...@@ -355,7 +347,6 @@ IN_PROC_BROWSER_TEST_F(EncryptionMigrationTest, MigrationFailure) { ...@@ -355,7 +347,6 @@ IN_PROC_BROWSER_TEST_F(EncryptionMigrationTest, MigrationFailure) {
test::OobeJS().ExpectHiddenPath(kReadyDialog); test::OobeJS().ExpectHiddenPath(kReadyDialog);
test::OobeJS().ExpectHiddenPath(kMigratingDialog); test::OobeJS().ExpectHiddenPath(kMigratingDialog);
test::OobeJS().ExpectHiddenPath(kInsufficientSpaceDialog); test::OobeJS().ExpectHiddenPath(kInsufficientSpaceDialog);
test::OobeJS().ExpectHiddenPath(kMinimalMigrationDialog);
test::OobeJS().ExpectVisiblePath(kRestartButton); test::OobeJS().ExpectVisiblePath(kRestartButton);
test::OobeJS().TapOnPath(kRestartButton); test::OobeJS().TapOnPath(kRestartButton);
...@@ -375,7 +366,6 @@ IN_PROC_BROWSER_TEST_F(EncryptionMigrationTest, LowBattery) { ...@@ -375,7 +366,6 @@ IN_PROC_BROWSER_TEST_F(EncryptionMigrationTest, LowBattery) {
test::OobeJS().ExpectHiddenPath(kMigratingDialog); test::OobeJS().ExpectHiddenPath(kMigratingDialog);
test::OobeJS().ExpectHiddenPath(kInsufficientSpaceDialog); test::OobeJS().ExpectHiddenPath(kInsufficientSpaceDialog);
test::OobeJS().ExpectHiddenPath(kErrorDialog); test::OobeJS().ExpectHiddenPath(kErrorDialog);
test::OobeJS().ExpectHiddenPath(kMinimalMigrationDialog);
test::OobeJS().ExpectVisiblePath(kSkipButton); test::OobeJS().ExpectVisiblePath(kSkipButton);
test::OobeJS().ExpectEnabledPath(kSkipButton); test::OobeJS().ExpectEnabledPath(kSkipButton);
...@@ -404,7 +394,6 @@ IN_PROC_BROWSER_TEST_F(EncryptionMigrationTest, ...@@ -404,7 +394,6 @@ IN_PROC_BROWSER_TEST_F(EncryptionMigrationTest,
test::OobeJS().ExpectHiddenPath(kMigratingDialog); test::OobeJS().ExpectHiddenPath(kMigratingDialog);
test::OobeJS().ExpectHiddenPath(kInsufficientSpaceDialog); test::OobeJS().ExpectHiddenPath(kInsufficientSpaceDialog);
test::OobeJS().ExpectHiddenPath(kErrorDialog); test::OobeJS().ExpectHiddenPath(kErrorDialog);
test::OobeJS().ExpectHiddenPath(kMinimalMigrationDialog);
test::OobeJS().ExpectPathDisplayed(false, kSkipButton); test::OobeJS().ExpectPathDisplayed(false, kSkipButton);
test::OobeJS().ExpectPathDisplayed(false, kUpgradeButton); test::OobeJS().ExpectPathDisplayed(false, kUpgradeButton);
...@@ -427,7 +416,6 @@ IN_PROC_BROWSER_TEST_F(EncryptionMigrationTest, ...@@ -427,7 +416,6 @@ IN_PROC_BROWSER_TEST_F(EncryptionMigrationTest,
test::OobeJS().ExpectHiddenPath(kMigratingDialog); test::OobeJS().ExpectHiddenPath(kMigratingDialog);
test::OobeJS().ExpectHiddenPath(kInsufficientSpaceDialog); test::OobeJS().ExpectHiddenPath(kInsufficientSpaceDialog);
test::OobeJS().ExpectHiddenPath(kErrorDialog); test::OobeJS().ExpectHiddenPath(kErrorDialog);
test::OobeJS().ExpectHiddenPath(kMinimalMigrationDialog);
EXPECT_FALSE(FakeCryptohomeClient::Get() EXPECT_FALSE(FakeCryptohomeClient::Get()
->get_id_for_disk_migrated_to_dircrypto() ->get_id_for_disk_migrated_to_dircrypto()
......
...@@ -13,12 +13,8 @@ enum class EncryptionMigrationMode { ...@@ -13,12 +13,8 @@ enum class EncryptionMigrationMode {
ASK_USER, ASK_USER,
// Start migration immediately. // Start migration immediately.
START_MIGRATION, START_MIGRATION,
// Start minimal migration immediately.
START_MINIMAL_MIGRATION,
// Resume incomplete migration. // Resume incomplete migration.
RESUME_MIGRATION, RESUME_MIGRATION
// Resume minimal migration.
RESUME_MINIMAL_MIGRATION
}; };
} // namespace chromeos } // namespace chromeos
......
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
#include "base/task/post_task.h" #include "base/task/post_task.h"
#include "base/task/thread_pool.h" #include "base/task/thread_pool.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "base/time/default_tick_clock.h"
#include "base/time/tick_clock.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/arc/arc_migration_constants.h" #include "chrome/browser/chromeos/arc/arc_migration_constants.h"
...@@ -58,10 +56,6 @@ constexpr char kUserActionRequestRestartOnLowStorage[] = ...@@ -58,10 +56,6 @@ constexpr char kUserActionRequestRestartOnLowStorage[] =
constexpr char kUserActionRequestRestartOnFailure[] = "requestRestartOnFailure"; constexpr char kUserActionRequestRestartOnFailure[] = "requestRestartOnFailure";
constexpr char kUserActionOpenFeedbackDialog[] = "openFeedbackDialog"; constexpr char kUserActionOpenFeedbackDialog[] = "openFeedbackDialog";
// If minimal migration takes this threshold or longer (in seconds), we
// will ask the user to re-enter their password.
constexpr int64_t kMinimalMigrationReenterPasswordThreshold = 45;
// UMA names. // UMA names.
constexpr char kUmaNameFirstScreen[] = "Cryptohome.MigrationUI.FirstScreen"; constexpr char kUmaNameFirstScreen[] = "Cryptohome.MigrationUI.FirstScreen";
constexpr char kUmaNameUserChoice[] = "Cryptohome.MigrationUI.UserChoice"; constexpr char kUmaNameUserChoice[] = "Cryptohome.MigrationUI.UserChoice";
...@@ -235,14 +229,8 @@ FirstScreen GetFirstScreenForMode(chromeos::EncryptionMigrationMode mode) { ...@@ -235,14 +229,8 @@ FirstScreen GetFirstScreenForMode(chromeos::EncryptionMigrationMode mode) {
return FirstScreen::FIRST_SCREEN_READY; return FirstScreen::FIRST_SCREEN_READY;
case chromeos::EncryptionMigrationMode::START_MIGRATION: case chromeos::EncryptionMigrationMode::START_MIGRATION:
return FirstScreen::FIRST_SCREEN_START_AUTOMATICALLY; return FirstScreen::FIRST_SCREEN_START_AUTOMATICALLY;
case chromeos::EncryptionMigrationMode::START_MINIMAL_MIGRATION:
return FirstScreen::FIRST_SCREEN_START_AUTOMATICALLY_MINIMAL;
case chromeos::EncryptionMigrationMode::RESUME_MIGRATION: case chromeos::EncryptionMigrationMode::RESUME_MIGRATION:
return FirstScreen::FIRST_SCREEN_RESUME; return FirstScreen::FIRST_SCREEN_RESUME;
case chromeos::EncryptionMigrationMode::RESUME_MINIMAL_MIGRATION:
return FirstScreen::FIRST_SCREEN_RESUME_MINIMAL;
default:
NOTREACHED();
} }
} }
...@@ -254,8 +242,7 @@ EncryptionMigrationScreen::EncryptionMigrationScreen( ...@@ -254,8 +242,7 @@ EncryptionMigrationScreen::EncryptionMigrationScreen(
EncryptionMigrationScreenView* view) EncryptionMigrationScreenView* view)
: BaseScreen(EncryptionMigrationScreenView::kScreenId, : BaseScreen(EncryptionMigrationScreenView::kScreenId,
OobeScreenPriority::DEFAULT), OobeScreenPriority::DEFAULT),
view_(view), view_(view) {
tick_clock_(base::DefaultTickClock::GetInstance()) {
free_disk_space_fetcher_ = base::Bind(&base::SysInfo::AmountOfFreeDiskSpace, free_disk_space_fetcher_ = base::Bind(&base::SysInfo::AmountOfFreeDiskSpace,
base::FilePath(kCheckStoragePath)); base::FilePath(kCheckStoragePath));
DCHECK(view_); DCHECK(view_);
...@@ -434,8 +421,7 @@ void EncryptionMigrationScreen::UpdateUIState( ...@@ -434,8 +421,7 @@ void EncryptionMigrationScreen::UpdateUIState(
// We should request wake lock and not shut down on lid close during // We should request wake lock and not shut down on lid close during
// migration. // migration.
if (state == EncryptionMigrationScreenView::MIGRATING || if (state == EncryptionMigrationScreenView::MIGRATING) {
state == EncryptionMigrationScreenView::MIGRATING_MINIMAL) {
GetWakeLock()->RequestWakeLock(); GetWakeLock()->RequestWakeLock();
PowerPolicyController::Get()->SetEncryptionMigrationActive(true); PowerPolicyController::Get()->SetEncryptionMigrationActive(true);
} else { } else {
...@@ -465,10 +451,7 @@ void EncryptionMigrationScreen::OnGetAvailableStorage(int64_t size) { ...@@ -465,10 +451,7 @@ void EncryptionMigrationScreen::OnGetAvailableStorage(int64_t size) {
if (size >= arc::kMigrationMinimumAvailableStorage || IsTestingUI()) { if (size >= arc::kMigrationMinimumAvailableStorage || IsTestingUI()) {
RecordFirstScreen(GetFirstScreenForMode(mode_)); RecordFirstScreen(GetFirstScreenForMode(mode_));
if (IsStartImmediately()) { if (IsStartImmediately()) {
if (IsMinimalMigration()) WaitBatteryAndMigrate();
StartMigration();
else
WaitBatteryAndMigrate();
} else { } else {
UpdateUIState(EncryptionMigrationScreenView::READY); UpdateUIState(EncryptionMigrationScreenView::READY);
} }
...@@ -499,7 +482,7 @@ void EncryptionMigrationScreen::WaitBatteryAndMigrate() { ...@@ -499,7 +482,7 @@ void EncryptionMigrationScreen::WaitBatteryAndMigrate() {
} }
void EncryptionMigrationScreen::StartMigration() { void EncryptionMigrationScreen::StartMigration() {
UpdateUIState(GetMigratingUIState()); UpdateUIState(EncryptionMigrationScreenView::MIGRATING);
if (current_battery_percent_) if (current_battery_percent_)
initial_battery_percent_ = *current_battery_percent_; initial_battery_percent_ = *current_battery_percent_;
...@@ -532,13 +515,7 @@ void EncryptionMigrationScreen::OnMountExistingVault( ...@@ -532,13 +515,7 @@ void EncryptionMigrationScreen::OnMountExistingVault(
return; return;
} }
// For minimal migration, start a timer which will measure how long migration
// took, so we can require a re sign-in if it took too long.
if (IsMinimalMigration())
minimal_migration_start_ = tick_clock_->NowTicks();
cryptohome::MigrateToDircryptoRequest request; cryptohome::MigrateToDircryptoRequest request;
request.set_minimal_migration(IsMinimalMigration());
cryptohome_observer_ = std::make_unique< cryptohome_observer_ = std::make_unique<
ScopedObserver<CryptohomeClient, CryptohomeClient::Observer>>(this); ScopedObserver<CryptohomeClient, CryptohomeClient::Observer>>(this);
cryptohome_observer_->Add(CryptohomeClient::Get()); cryptohome_observer_->Add(CryptohomeClient::Get());
...@@ -632,10 +609,10 @@ void EncryptionMigrationScreen::DircryptoMigrationProgress( ...@@ -632,10 +609,10 @@ void EncryptionMigrationScreen::DircryptoMigrationProgress(
uint64_t total) { uint64_t total) {
switch (status) { switch (status) {
case cryptohome::DIRCRYPTO_MIGRATION_INITIALIZING: case cryptohome::DIRCRYPTO_MIGRATION_INITIALIZING:
UpdateUIState(GetMigratingUIState()); UpdateUIState(EncryptionMigrationScreenView::MIGRATING);
break; break;
case cryptohome::DIRCRYPTO_MIGRATION_IN_PROGRESS: case cryptohome::DIRCRYPTO_MIGRATION_IN_PROGRESS:
UpdateUIState(GetMigratingUIState()); UpdateUIState(EncryptionMigrationScreenView::MIGRATING);
view_->SetMigrationProgress(static_cast<double>(current) / total); view_->SetMigrationProgress(static_cast<double>(current) / total);
break; break;
case cryptohome::DIRCRYPTO_MIGRATION_SUCCESS: case cryptohome::DIRCRYPTO_MIGRATION_SUCCESS:
...@@ -652,28 +629,10 @@ void EncryptionMigrationScreen::DircryptoMigrationProgress( ...@@ -652,28 +629,10 @@ void EncryptionMigrationScreen::DircryptoMigrationProgress(
static_cast<int>(std::round(initial_battery_percent_ - static_cast<int>(std::round(initial_battery_percent_ -
*current_battery_percent_))); *current_battery_percent_)));
} }
if (IsMinimalMigration() && !continue_login_callback_.is_null() && // Restart immediately after successful migration.
!restart_login_callback_.is_null()) { PowerManagerClient::Get()->RequestRestart(
GetWakeLock()->CancelWakeLock(); power_manager::REQUEST_RESTART_OTHER,
PowerPolicyController::Get()->SetEncryptionMigrationActive(false); "login encryption migration success");
// If minimal migration was fast enough, continue with same sign-in
// data. Fast enough means that the elapsed time is under the defined
// threshold.
const base::TimeDelta elapsed_time =
tick_clock_->NowTicks() - minimal_migration_start_;
const bool require_password_reentry =
elapsed_time.InSeconds() >
kMinimalMigrationReenterPasswordThreshold;
if (require_password_reentry)
std::move(restart_login_callback_).Run(user_context_);
else
std::move(continue_login_callback_).Run(user_context_);
} else {
// Restart immediately after successful full migration.
PowerManagerClient::Get()->RequestRestart(
power_manager::REQUEST_RESTART_OTHER,
"login encryption migration success");
}
break; break;
case cryptohome::DIRCRYPTO_MIGRATION_FAILED: case cryptohome::DIRCRYPTO_MIGRATION_FAILED:
RecordMigrationResultGeneralFailure(IsResumingIncompleteMigration(), RecordMigrationResultGeneralFailure(IsResumingIncompleteMigration(),
...@@ -714,28 +673,14 @@ bool EncryptionMigrationScreen::IsResumingIncompleteMigration() const { ...@@ -714,28 +673,14 @@ bool EncryptionMigrationScreen::IsResumingIncompleteMigration() const {
bool EncryptionMigrationScreen::IsStartImmediately() const { bool EncryptionMigrationScreen::IsStartImmediately() const {
return mode_ == EncryptionMigrationMode::START_MIGRATION || return mode_ == EncryptionMigrationMode::START_MIGRATION ||
mode_ == EncryptionMigrationMode::START_MINIMAL_MIGRATION || mode_ == EncryptionMigrationMode::RESUME_MIGRATION;
mode_ == EncryptionMigrationMode::RESUME_MIGRATION ||
mode_ == EncryptionMigrationMode::RESUME_MINIMAL_MIGRATION;
}
bool EncryptionMigrationScreen::IsMinimalMigration() const {
return mode_ == EncryptionMigrationMode::START_MINIMAL_MIGRATION ||
mode_ == EncryptionMigrationMode::RESUME_MINIMAL_MIGRATION;
}
EncryptionMigrationScreenView::UIState
EncryptionMigrationScreen::GetMigratingUIState() const {
return IsMinimalMigration() ? EncryptionMigrationScreenView::MIGRATING_MINIMAL
: EncryptionMigrationScreenView::MIGRATING;
} }
void EncryptionMigrationScreen::MaybeStopForcingMigration() { void EncryptionMigrationScreen::MaybeStopForcingMigration() {
// |mode_| will be START_MIGRATION if migration was forced by user policy. // |mode_| will be START_MIGRATION if migration was forced.
// If an incomplete migration is being resumed, it would be RESUME_MIGRATION. // If an incomplete migration is being resumed, it would be RESUME_MIGRATION.
// We only want to disable auto-starting migration in the first case. // We only want to disable auto-starting migration in the first case.
if (mode_ == EncryptionMigrationMode::START_MIGRATION || if (mode_ == EncryptionMigrationMode::START_MIGRATION)
mode_ == EncryptionMigrationMode::START_MINIMAL_MIGRATION)
view_->SetIsResuming(false); view_->SetIsResuming(false);
} }
......
...@@ -24,11 +24,6 @@ ...@@ -24,11 +24,6 @@
#include "services/device/public/mojom/wake_lock.mojom.h" #include "services/device/public/mojom/wake_lock.mojom.h"
#include "third_party/cros_system_api/dbus/cryptohome/dbus-constants.h" #include "third_party/cros_system_api/dbus/cryptohome/dbus-constants.h"
namespace base {
class TickClock;
class TimeTicks;
} // namespace base
namespace chromeos { namespace chromeos {
class EncryptionMigrationScreenView; class EncryptionMigrationScreenView;
...@@ -76,14 +71,6 @@ class EncryptionMigrationScreen : public BaseScreen, ...@@ -76,14 +71,6 @@ class EncryptionMigrationScreen : public BaseScreen,
free_disk_space_fetcher_ = std::move(free_disk_space_fetcher); free_disk_space_fetcher_ = std::move(free_disk_space_fetcher);
} }
// Testing only: Sets the tick clock used to measure elapsed time during
// migration.
// This doesn't take the ownership of the clock. |tick_clock| must outlive
// the EncryptionMigrationScreenHandler instance.
void set_tick_clock_for_testing(const base::TickClock* tick_clock) {
tick_clock_ = tick_clock;
}
protected: protected:
virtual device::mojom::WakeLock* GetWakeLock(); virtual device::mojom::WakeLock* GetWakeLock();
...@@ -138,14 +125,6 @@ class EncryptionMigrationScreen : public BaseScreen, ...@@ -138,14 +125,6 @@ class EncryptionMigrationScreen : public BaseScreen,
// True if |mode_| suggests that migration should start immediately. // True if |mode_| suggests that migration should start immediately.
bool IsStartImmediately() const; bool IsStartImmediately() const;
// True if |mode_| suggests that we are starting or resuming a minimal
// migration.
bool IsMinimalMigration() const;
// Returns the UIState we should be in when migration is in progress.
// This will be different between regular and minimal migration.
EncryptionMigrationScreenView::UIState GetMigratingUIState() const;
// Stop forcing migration if it was forced by policy. // Stop forcing migration if it was forced by policy.
void MaybeStopForcingMigration(); void MaybeStopForcingMigration();
...@@ -179,16 +158,10 @@ class EncryptionMigrationScreen : public BaseScreen, ...@@ -179,16 +158,10 @@ class EncryptionMigrationScreen : public BaseScreen,
// The battery level at the timing that the migration starts. // The battery level at the timing that the migration starts.
double initial_battery_percent_ = 0.0; double initial_battery_percent_ = 0.0;
// Point in time when minimal migration started, as reported by |tick_clock_|.
base::TimeTicks minimal_migration_start_;
mojo::Remote<device::mojom::WakeLock> wake_lock_; mojo::Remote<device::mojom::WakeLock> wake_lock_;
std::unique_ptr<LoginFeedback> login_feedback_; std::unique_ptr<LoginFeedback> login_feedback_;
// Used to measure elapsed time during migration.
const base::TickClock* tick_clock_;
FreeDiskSpaceFetcher free_disk_space_fetcher_; FreeDiskSpaceFetcher free_disk_space_fetcher_;
std::unique_ptr<ScopedObserver<CryptohomeClient, CryptohomeClient::Observer>> std::unique_ptr<ScopedObserver<CryptohomeClient, CryptohomeClient::Observer>>
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "base/test/simple_test_tick_clock.h"
#include "base/test/task_environment.h" #include "base/test/task_environment.h"
#include "chrome/browser/chromeos/arc/arc_migration_constants.h" #include "chrome/browser/chromeos/arc/arc_migration_constants.h"
#include "chrome/browser/chromeos/login/screens/encryption_migration_mode.h" #include "chrome/browser/chromeos/login/screens/encryption_migration_mode.h"
...@@ -73,7 +72,6 @@ class TestEncryptionMigrationScreen : public EncryptionMigrationScreen { ...@@ -73,7 +72,6 @@ class TestEncryptionMigrationScreen : public EncryptionMigrationScreen {
set_free_disk_space_fetcher_for_testing(base::BindRepeating( set_free_disk_space_fetcher_for_testing(base::BindRepeating(
&TestEncryptionMigrationScreen::FreeDiskSpaceFetcher, &TestEncryptionMigrationScreen::FreeDiskSpaceFetcher,
base::Unretained(this))); base::Unretained(this)));
set_tick_clock_for_testing(&testing_tick_clock_);
} }
// Sets the free disk space seen by EncryptionMigrationScreen. // Sets the free disk space seen by EncryptionMigrationScreen.
...@@ -81,12 +79,6 @@ class TestEncryptionMigrationScreen : public EncryptionMigrationScreen { ...@@ -81,12 +79,6 @@ class TestEncryptionMigrationScreen : public EncryptionMigrationScreen {
free_disk_space_ = free_disk_space; free_disk_space_ = free_disk_space;
} }
// Returns the SimpleTestTickClock used to simulate time elapsed during
// migration.
base::SimpleTestTickClock* testing_tick_clock() {
return &testing_tick_clock_;
}
FakeWakeLock* fake_wake_lock() { return &fake_wake_lock_; } FakeWakeLock* fake_wake_lock() { return &fake_wake_lock_; }
protected: protected:
...@@ -99,9 +91,6 @@ class TestEncryptionMigrationScreen : public EncryptionMigrationScreen { ...@@ -99,9 +91,6 @@ class TestEncryptionMigrationScreen : public EncryptionMigrationScreen {
FakeWakeLock fake_wake_lock_; FakeWakeLock fake_wake_lock_;
// Tick clock used to simulate time elapsed during migration.
base::SimpleTestTickClock testing_tick_clock_;
int64_t free_disk_space_; int64_t free_disk_space_;
}; };
...@@ -226,106 +215,4 @@ class EncryptionMigrationScreenTest : public testing::Test { ...@@ -226,106 +215,4 @@ class EncryptionMigrationScreenTest : public testing::Test {
} // namespace } // namespace
// Tests handling of a minimal migration run that finishes immediately.
TEST_F(EncryptionMigrationScreenTest, MinimalMigration) {
encryption_migration_screen_->SetMode(
EncryptionMigrationMode::START_MINIMAL_MIGRATION);
encryption_migration_screen_->SetupInitialView();
task_environment_.RunUntilIdle();
EXPECT_TRUE(encryption_migration_screen_->fake_wake_lock()->HasWakeLock());
fake_cryptohome_client_->NotifyDircryptoMigrationProgress(
cryptohome::DircryptoMigrationStatus::DIRCRYPTO_MIGRATION_SUCCESS,
0 /* current */, 0 /* total */);
EXPECT_TRUE(continue_login_callback_called_);
EXPECT_FALSE(encryption_migration_screen_->fake_wake_lock()->HasWakeLock());
EXPECT_TRUE(fake_cryptohome_client_->to_migrate_from_ecryptfs());
EXPECT_TRUE(fake_cryptohome_client_->minimal_migration());
EXPECT_EQ(cryptohome::CreateAccountIdentifierFromAccountId(
user_context_.GetAccountId()),
fake_cryptohome_client_->get_id_for_disk_migrated_to_dircrypto());
EXPECT_EQ(
user_context_.GetKey()->GetSecret(),
fake_cryptohome_client_->get_secret_for_last_mount_authentication());
}
// Tests handling of a resumed minimal migration run. This should behave the
// same way that a freshly started minimal migration does (only UMA stats are
// different, but we don't test that at the moment).
TEST_F(EncryptionMigrationScreenTest, ResumeMinimalMigration) {
encryption_migration_screen_->SetMode(
EncryptionMigrationMode::RESUME_MINIMAL_MIGRATION);
encryption_migration_screen_->SetupInitialView();
task_environment_.RunUntilIdle();
fake_cryptohome_client_->NotifyDircryptoMigrationProgress(
cryptohome::DircryptoMigrationStatus::DIRCRYPTO_MIGRATION_SUCCESS,
0 /* current */, 0 /* total */);
EXPECT_TRUE(continue_login_callback_called_);
EXPECT_TRUE(fake_cryptohome_client_->to_migrate_from_ecryptfs());
EXPECT_TRUE(fake_cryptohome_client_->minimal_migration());
EXPECT_EQ(cryptohome::CreateAccountIdentifierFromAccountId(
user_context_.GetAccountId()),
fake_cryptohome_client_->get_id_for_disk_migrated_to_dircrypto());
EXPECT_EQ(
user_context_.GetKey()->GetSecret(),
fake_cryptohome_client_->get_secret_for_last_mount_authentication());
}
// Tests handling of a minimal migration run that takes a long time to finish.
// We expect that EncryptionMigrationScreen will require the user to re-enter
// their password.
TEST_F(EncryptionMigrationScreenTest, MinimalMigrationSlow) {
encryption_migration_screen_->SetMode(
EncryptionMigrationMode::START_MINIMAL_MIGRATION);
encryption_migration_screen_->SetupInitialView();
task_environment_.RunUntilIdle();
encryption_migration_screen_->testing_tick_clock()->Advance(
base::TimeDelta::FromMinutes(1));
fake_cryptohome_client_->NotifyDircryptoMigrationProgress(
cryptohome::DircryptoMigrationStatus::DIRCRYPTO_MIGRATION_SUCCESS,
0 /* current */, 0 /* total */);
EXPECT_TRUE(restart_login_callback_called_);
EXPECT_TRUE(fake_cryptohome_client_->to_migrate_from_ecryptfs());
EXPECT_TRUE(fake_cryptohome_client_->minimal_migration());
EXPECT_EQ(cryptohome::CreateAccountIdentifierFromAccountId(
user_context_.GetAccountId()),
fake_cryptohome_client_->get_id_for_disk_migrated_to_dircrypto());
EXPECT_EQ(
user_context_.GetKey()->GetSecret(),
fake_cryptohome_client_->get_secret_for_last_mount_authentication());
}
// Tests handling of a minimal migration run that fails.
TEST_F(EncryptionMigrationScreenTest, MinimalMigrationFails) {
encryption_migration_screen_->SetMode(
EncryptionMigrationMode::START_MINIMAL_MIGRATION);
encryption_migration_screen_->SetupInitialView();
task_environment_.RunUntilIdle();
encryption_migration_screen_->testing_tick_clock()->Advance(
base::TimeDelta::FromMinutes(1));
fake_cryptohome_client_->NotifyDircryptoMigrationProgress(
cryptohome::DircryptoMigrationStatus::DIRCRYPTO_MIGRATION_FAILED,
0 /* current */, 0 /* total */);
Mock::VerifyAndClearExpectations(mock_async_method_caller_);
EXPECT_TRUE(fake_cryptohome_client_->to_migrate_from_ecryptfs());
EXPECT_TRUE(fake_cryptohome_client_->minimal_migration());
EXPECT_EQ(cryptohome::CreateAccountIdentifierFromAccountId(
user_context_.GetAccountId()),
fake_cryptohome_client_->get_id_for_disk_migrated_to_dircrypto());
EXPECT_EQ(
user_context_.GetKey()->GetSecret(),
fake_cryptohome_client_->get_secret_for_last_mount_authentication());
}
} // namespace chromeos } // namespace chromeos
...@@ -17,12 +17,6 @@ ...@@ -17,12 +17,6 @@
<link rel="stylesheet" href="encryption_migration.css"> <link rel="stylesheet" href="encryption_migration.css">
<oobe-dialog tabindex="0" has-buttons for-step="initial"> <oobe-dialog tabindex="0" has-buttons for-step="initial">
</oobe-dialog> </oobe-dialog>
<oobe-dialog id="minimal-migration-dialog" tabindex="0" has-buttons
for-step="migrating-minimal">
<div slot="footer" class="layout vertical">
<throbber-notice text-key="gaiaLoading"></throbber-notice>
</div>
</oobe-dialog>
<oobe-dialog tabindex="0" id="ready-dialog" has-buttons <oobe-dialog tabindex="0" id="ready-dialog" has-buttons
title-key="migrationReadyTitle" for-step="ready" title-key="migrationReadyTitle" for-step="ready"
subtitle-key="migrationReadyDescription"> subtitle-key="migrationReadyDescription">
......
...@@ -19,7 +19,6 @@ var EncryptionMigrationUIState = { ...@@ -19,7 +19,6 @@ var EncryptionMigrationUIState = {
MIGRATING: 'migrating', MIGRATING: 'migrating',
MIGRATION_FAILED: 'migration-failed', MIGRATION_FAILED: 'migration-failed',
NOT_ENOUGH_SPACE: 'not-enough-space', NOT_ENOUGH_SPACE: 'not-enough-space',
MIGRATING_MINIMAL: 'migrating-minimal',
}; };
Polymer({ Polymer({
......
...@@ -25,7 +25,6 @@ class EncryptionMigrationScreenView { ...@@ -25,7 +25,6 @@ class EncryptionMigrationScreenView {
MIGRATING = 2, MIGRATING = 2,
MIGRATION_FAILED = 3, MIGRATION_FAILED = 3,
NOT_ENOUGH_STORAGE = 4, NOT_ENOUGH_STORAGE = 4,
MIGRATING_MINIMAL = 5,
COUNT COUNT
}; };
......
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