diff options
author | merkulova@chromium.org <merkulova@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-12 08:38:45 +0000 |
---|---|---|
committer | merkulova@chromium.org <merkulova@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-12 08:38:45 +0000 |
commit | 90556c5c9d0a274cc823b713544e9b6064e205cd (patch) | |
tree | 44b72d8fb3288f48dcc9247950a6edfdb11ddaba | |
parent | cc6e6473790d4fd0e1a3ea018c53068d93f232f3 (diff) | |
download | chromium_src-90556c5c9d0a274cc823b713544e9b6064e205cd.zip chromium_src-90556c5c9d0a274cc823b713544e9b6064e205cd.tar.gz chromium_src-90556c5c9d0a274cc823b713544e9b6064e205cd.tar.bz2 |
Rollback option put behind the flag.
BUG=368860
Review URL: https://codereview.chromium.org/267393011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269753 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/chromeos/login/reset_browsertest.cc | 45 | ||||
-rw-r--r-- | chrome/browser/ui/webui/chromeos/login/reset_screen_handler.cc | 8 | ||||
-rw-r--r-- | chromeos/chromeos_switches.cc | 3 | ||||
-rw-r--r-- | chromeos/chromeos_switches.h | 1 |
4 files changed, 37 insertions, 20 deletions
diff --git a/chrome/browser/chromeos/login/reset_browsertest.cc b/chrome/browser/chromeos/login/reset_browsertest.cc index 759e8c7..fb4385bc 100644 --- a/chrome/browser/chromeos/login/reset_browsertest.cc +++ b/chrome/browser/chromeos/login/reset_browsertest.cc @@ -105,7 +105,9 @@ IN_PROC_BROWSER_TEST_F(ResetTest, ShowAndCancel) { JSExpect("!document.querySelector('#reset.hidden')"); CloseResetScreen(); JSExpect("!!document.querySelector('#reset.hidden')"); - EXPECT_EQ(1, update_engine_client_->can_rollback_call_count()); + if (CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableRollbackOption)) + EXPECT_EQ(1, update_engine_client_->can_rollback_call_count()); } IN_PROC_BROWSER_TEST_F(ResetTest, PRE_RestartBeforePowerwash) { @@ -177,15 +179,18 @@ IN_PROC_BROWSER_TEST_F(ResetFirstAfterBootTest, ShortcutInvokedCases) { CloseResetScreen(); OobeScreenWaiter(OobeDisplay::SCREEN_ACCOUNT_PICKER).Wait(); - // rollback available and checked - InvokeResetScreen(); - ASSERT_TRUE(content::ExecuteScript( - web_contents(), - "$('reset-rollback-checkbox').checked = true;")); - ClickResetButton(); - EXPECT_EQ(0, power_manager_client_->num_request_restart_calls()); - EXPECT_EQ(2, session_manager_client_->start_device_wipe_call_count()); - EXPECT_EQ(1, update_engine_client_->rollback_call_count()); + if (CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableRollbackOption)) { + // rollback available and checked + InvokeResetScreen(); + ASSERT_TRUE(content::ExecuteScript( + web_contents(), + "$('reset-rollback-checkbox').checked = true;")); + ClickResetButton(); + EXPECT_EQ(0, power_manager_client_->num_request_restart_calls()); + EXPECT_EQ(2, session_manager_client_->start_device_wipe_call_count()); + EXPECT_EQ(1, update_engine_client_->rollback_call_count()); + } } IN_PROC_BROWSER_TEST_F(ResetFirstAfterBootTest, PRE_PowerwashRequested) { @@ -220,14 +225,18 @@ IN_PROC_BROWSER_TEST_F(ResetFirstAfterBootTest, ErrorOnRollbackRequested) { EXPECT_EQ(0, update_engine_client_->rollback_call_count()); JSExpect("!$('reset').classList.contains('revert-promise')"); ClickResetButton(); - EXPECT_EQ(0, power_manager_client_->num_request_restart_calls()); - EXPECT_EQ(0, session_manager_client_->start_device_wipe_call_count()); - EXPECT_EQ(1, update_engine_client_->rollback_call_count()); - JSExpect("$('reset').classList.contains('revert-promise')"); - UpdateEngineClient::Status error_update_status; - error_update_status.status = UpdateEngineClient::UPDATE_STATUS_ERROR; - update_engine_client_->NotifyObserversThatStatusChanged(error_update_status); - OobeScreenWaiter(OobeDisplay::SCREEN_ERROR_MESSAGE).Wait(); + if (CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableRollbackOption)) { + EXPECT_EQ(0, power_manager_client_->num_request_restart_calls()); + EXPECT_EQ(0, session_manager_client_->start_device_wipe_call_count()); + EXPECT_EQ(1, update_engine_client_->rollback_call_count()); + JSExpect("$('reset').classList.contains('revert-promise')"); + UpdateEngineClient::Status error_update_status; + error_update_status.status = UpdateEngineClient::UPDATE_STATUS_ERROR; + update_engine_client_->NotifyObserversThatStatusChanged( + error_update_status); + OobeScreenWaiter(OobeDisplay::SCREEN_ERROR_MESSAGE).Wait(); + } } IN_PROC_BROWSER_TEST_F(ResetFirstAfterBootTest, diff --git a/chrome/browser/ui/webui/chromeos/login/reset_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/reset_screen_handler.cc index 4ae16a7..5e92909 100644 --- a/chrome/browser/ui/webui/chromeos/login/reset_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/reset_screen_handler.cc @@ -14,7 +14,6 @@ #include "chrome/browser/chromeos/login/help_app_launcher.h" #include "chrome/browser/chromeos/reset/metrics.h" #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" -#include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "chromeos/chromeos_switches.h" #include "chromeos/dbus/dbus_thread_manager.h" @@ -102,7 +101,11 @@ void ResetScreenHandler::Show() { rollback_available_ = false; if (!restart_required_) // First exec after boot. reboot_was_requested_ = prefs->GetBoolean(prefs::kFactoryResetRequested); - if (!restart_required_ && reboot_was_requested_) { + if (!CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableRollbackOption)) { + rollback_available_ = false; + ShowWithParams(); + } else if (!restart_required_ && reboot_was_requested_) { // First exec after boot. rollback_available_ = prefs->GetBoolean(prefs::kRollbackRequested); ShowWithParams(); @@ -231,6 +234,7 @@ void ResetScreenHandler::HandleOnLearnMore() { void ResetScreenHandler::UpdateStatusChanged( const UpdateEngineClient::Status& status) { + VLOG(1) << "Update status change to " << status.status; if (status.status == UpdateEngineClient::UPDATE_STATUS_ERROR) { // Show error screen. base::DictionaryValue params; diff --git a/chromeos/chromeos_switches.cc b/chromeos/chromeos_switches.cc index 6478063..77cf81b 100644 --- a/chromeos/chromeos_switches.cc +++ b/chromeos/chromeos_switches.cc @@ -90,6 +90,9 @@ const char kEnableTouchpadThreeFingerClick[] // than the kiosk app mode. const char kEnableKioskMode[] = "enable-kiosk-mode"; +// Enables rollback option for resetting ChromeOS. +const char kEnableRollbackOption[] = "enable-rollback-option"; + // Enables request of tablet site (via user agent override). const char kEnableRequestTabletSite[] = "enable-request-tablet-site"; diff --git a/chromeos/chromeos_switches.h b/chromeos/chromeos_switches.h index 01ab36b..0290c2b 100644 --- a/chromeos/chromeos_switches.h +++ b/chromeos/chromeos_switches.h @@ -40,6 +40,7 @@ CHROMEOS_EXPORT extern const char kEchoExtensionPath[]; CHROMEOS_EXPORT extern const char kEnableCarrierSwitching[]; CHROMEOS_EXPORT extern const char kEnableConsumerManagement[]; CHROMEOS_EXPORT extern const char kEnableFileManagerMTP[]; +CHROMEOS_EXPORT extern const char kEnableRollbackOption[]; CHROMEOS_EXPORT extern const char kEnableHIDDetectionOnOOBE[]; CHROMEOS_EXPORT extern const char kEnableKioskMode[]; CHROMEOS_EXPORT extern const char kEnableNetworkPortalNotification[]; |