Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2360)

Unified Diff: chrome/browser/chromeos/login/update_screen_browsertest.cc

Issue 8585025: chromeos: Change all clients of UpdateLibrary to use UpdateEngineClient. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/login/update_screen.cc ('k') | chrome/browser/chromeos/upgrade_detector_chromeos.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/login/update_screen_browsertest.cc
diff --git a/chrome/browser/chromeos/login/update_screen_browsertest.cc b/chrome/browser/chromeos/login/update_screen_browsertest.cc
index d933e1cf84eb2c65da6891d011d15c6590133ede..97c3ccbe6f58838301a7816b2198ef7db7bc72d8 100644
--- a/chrome/browser/chromeos/login/update_screen_browsertest.cc
+++ b/chrome/browser/chromeos/login/update_screen_browsertest.cc
@@ -4,9 +4,9 @@
#include "base/message_loop.h"
#include "chrome/browser/chromeos/cros/mock_network_library.h"
-#include "chrome/browser/chromeos/cros/mock_update_library.h"
#include "chrome/browser/chromeos/dbus/mock_dbus_thread_manager.h"
#include "chrome/browser/chromeos/dbus/mock_session_manager_client.h"
+#include "chrome/browser/chromeos/dbus/mock_update_engine_client.h"
#include "chrome/browser/chromeos/login/mock_screen_observer.h"
#include "chrome/browser/chromeos/login/update_screen.h"
#include "chrome/browser/chromeos/login/wizard_controller.h"
@@ -20,15 +20,17 @@ using ::testing::AtLeast;
using ::testing::Return;
using ::testing::ReturnRef;
using ::testing::Invoke;
+using chromeos::UpdateEngineClient;
-static void RequestUpdateCheckSuccess(UpdateCallback callback, void* userdata) {
- callback(userdata, chromeos::UPDATE_RESULT_SUCCESS, NULL);
+static void RequestUpdateCheckSuccess(
+ UpdateEngineClient::UpdateCheckCallback callback) {
+ callback.Run(UpdateEngineClient::UPDATE_RESULT_SUCCESS);
}
class UpdateScreenTest : public WizardInProcessBrowserTest {
public:
UpdateScreenTest() : WizardInProcessBrowserTest("update"),
- mock_update_library_(NULL),
+ mock_update_engine_client_(NULL),
mock_network_library_(NULL) {}
protected:
@@ -45,17 +47,17 @@ class UpdateScreenTest : public WizardInProcessBrowserTest {
EXPECT_CALL(*mock_session_manager_client, EmitLoginPromptReady())
.Times(1);
- mock_update_library_ = new MockUpdateLibrary();
- cros_mock_->test_api()->SetUpdateLibrary(mock_update_library_, true);
+ mock_update_engine_client_
+ = mock_dbus_thread_manager->mock_update_engine_client();
// UpdateScreen::StartUpdate() will be called by the WizardController
// just after creating the update screen, so the expectations for that
// should be set up here.
- EXPECT_CALL(*mock_update_library_, AddObserver(_))
+ EXPECT_CALL(*mock_update_engine_client_, AddObserver(_))
.Times(AtLeast(1));
- EXPECT_CALL(*mock_update_library_, RemoveObserver(_))
+ EXPECT_CALL(*mock_update_engine_client_, RemoveObserver(_))
.Times(AtLeast(1));
- EXPECT_CALL(*mock_update_library_, RequestUpdateCheck(_,_))
+ EXPECT_CALL(*mock_update_engine_client_, RequestUpdateCheck(_))
.Times(1)
.WillOnce(Invoke(RequestUpdateCheckSuccess));
@@ -84,12 +86,11 @@ class UpdateScreenTest : public WizardInProcessBrowserTest {
virtual void TearDownInProcessBrowserTestFixture() {
update_screen_->screen_observer_ = (controller());
- cros_mock_->test_api()->SetUpdateLibrary(NULL, true);
WizardInProcessBrowserTest::TearDownInProcessBrowserTestFixture();
DBusThreadManager::Shutdown();
}
- MockUpdateLibrary* mock_update_library_;
+ MockUpdateEngineClient* mock_update_engine_client_;
MockNetworkLibrary* mock_network_library_;
scoped_ptr<MockScreenObserver> mock_screen_observer_;
@@ -105,17 +106,17 @@ IN_PROC_BROWSER_TEST_F(UpdateScreenTest, TestBasic) {
IN_PROC_BROWSER_TEST_F(UpdateScreenTest, TestNoUpdate) {
update_screen_->SetIgnoreIdleStatus(true);
- UpdateLibrary::Status status;
- status.status = UPDATE_STATUS_IDLE;
+ UpdateEngineClient::Status status;
+ status.status = UpdateEngineClient::UPDATE_STATUS_IDLE;
update_screen_->UpdateStatusChanged(status);
- status.status = UPDATE_STATUS_CHECKING_FOR_UPDATE;
+ status.status = UpdateEngineClient::UPDATE_STATUS_CHECKING_FOR_UPDATE;
update_screen_->UpdateStatusChanged(status);
- status.status = UPDATE_STATUS_IDLE;
- // status() will be called via ExitUpdate() called from
+ status.status = UpdateEngineClient::UPDATE_STATUS_IDLE;
+ // GetLastStatus() will be called via ExitUpdate() called from
// UpdateStatusChanged().
- EXPECT_CALL(*mock_update_library_, status())
+ EXPECT_CALL(*mock_update_engine_client_, GetLastStatus())
.Times(AtLeast(1))
- .WillRepeatedly(ReturnRef(status));
+ .WillRepeatedly(Return(status));
EXPECT_CALL(*mock_screen_observer_, OnExit(ScreenObserver::UPDATE_NOUPDATE))
.Times(1);
update_screen_->UpdateStatusChanged(status);
@@ -124,12 +125,12 @@ IN_PROC_BROWSER_TEST_F(UpdateScreenTest, TestNoUpdate) {
IN_PROC_BROWSER_TEST_F(UpdateScreenTest, TestUpdateAvailable) {
update_screen_->is_ignore_update_deadlines_ = true;
- UpdateLibrary::Status status;
- status.status = UPDATE_STATUS_UPDATE_AVAILABLE;
+ UpdateEngineClient::Status status;
+ status.status = UpdateEngineClient::UPDATE_STATUS_UPDATE_AVAILABLE;
status.new_version = "latest and greatest";
update_screen_->UpdateStatusChanged(status);
- status.status = UPDATE_STATUS_DOWNLOADING;
+ status.status = UpdateEngineClient::UPDATE_STATUS_DOWNLOADING;
status.download_progress = 0.0;
update_screen_->UpdateStatusChanged(status);
@@ -139,20 +140,21 @@ IN_PROC_BROWSER_TEST_F(UpdateScreenTest, TestUpdateAvailable) {
status.download_progress = 1.0;
update_screen_->UpdateStatusChanged(status);
- status.status = UPDATE_STATUS_VERIFYING;
+ status.status = UpdateEngineClient::UPDATE_STATUS_VERIFYING;
update_screen_->UpdateStatusChanged(status);
- status.status = UPDATE_STATUS_FINALIZING;
+ status.status = UpdateEngineClient::UPDATE_STATUS_FINALIZING;
update_screen_->UpdateStatusChanged(status);
- status.status = UPDATE_STATUS_UPDATED_NEED_REBOOT;
- EXPECT_CALL(*mock_update_library_, RebootAfterUpdate())
+ status.status = UpdateEngineClient::UPDATE_STATUS_UPDATED_NEED_REBOOT;
+ EXPECT_CALL(*mock_update_engine_client_, RebootAfterUpdate())
.Times(1);
update_screen_->UpdateStatusChanged(status);
}
-static void RequestUpdateCheckFail(UpdateCallback callback, void* userdata) {
- callback(userdata, chromeos::UPDATE_RESULT_FAILED, NULL);
+static void RequestUpdateCheckFail(
+ UpdateEngineClient::UpdateCheckCallback callback) {
+ callback.Run(chromeos::UpdateEngineClient::UPDATE_RESULT_FAILED);
}
IN_PROC_BROWSER_TEST_F(UpdateScreenTest, TestErrorIssuingUpdateCheck) {
@@ -164,11 +166,11 @@ IN_PROC_BROWSER_TEST_F(UpdateScreenTest, TestErrorIssuingUpdateCheck) {
// Run UpdateScreen::StartUpdate() again, but CheckForUpdate() will fail
// issuing the update check this time.
- EXPECT_CALL(*mock_update_library_, AddObserver(_))
+ EXPECT_CALL(*mock_update_engine_client_, AddObserver(_))
.Times(1);
- EXPECT_CALL(*mock_update_library_, RemoveObserver(_))
+ EXPECT_CALL(*mock_update_engine_client_, RemoveObserver(_))
.Times(AtLeast(1));
- EXPECT_CALL(*mock_update_library_, RequestUpdateCheck(_,_))
+ EXPECT_CALL(*mock_update_engine_client_, RequestUpdateCheck(_))
.Times(1)
.WillOnce(Invoke(RequestUpdateCheckFail));
EXPECT_CALL(*mock_screen_observer_,
@@ -178,13 +180,13 @@ IN_PROC_BROWSER_TEST_F(UpdateScreenTest, TestErrorIssuingUpdateCheck) {
}
IN_PROC_BROWSER_TEST_F(UpdateScreenTest, TestErrorCheckingForUpdate) {
- UpdateLibrary::Status status;
- status.status = UPDATE_STATUS_ERROR;
- // status() will be called via ExitUpdate() called from
+ UpdateEngineClient::Status status;
+ status.status = UpdateEngineClient::UPDATE_STATUS_ERROR;
+ // GetLastStatus() will be called via ExitUpdate() called from
// UpdateStatusChanged().
- EXPECT_CALL(*mock_update_library_, status())
+ EXPECT_CALL(*mock_update_engine_client_, GetLastStatus())
.Times(AtLeast(1))
- .WillRepeatedly(ReturnRef(status));
+ .WillRepeatedly(Return(status));
EXPECT_CALL(*mock_screen_observer_,
OnExit(ScreenObserver::UPDATE_ERROR_CHECKING_FOR_UPDATE))
.Times(1);
@@ -192,22 +194,22 @@ IN_PROC_BROWSER_TEST_F(UpdateScreenTest, TestErrorCheckingForUpdate) {
}
IN_PROC_BROWSER_TEST_F(UpdateScreenTest, TestErrorUpdating) {
- UpdateLibrary::Status status;
- status.status = UPDATE_STATUS_UPDATE_AVAILABLE;
+ UpdateEngineClient::Status status;
+ status.status = UpdateEngineClient::UPDATE_STATUS_UPDATE_AVAILABLE;
status.new_version = "latest and greatest";
- // status() will be called via ExitUpdate() called from
+ // GetLastStatus() will be called via ExitUpdate() called from
// UpdateStatusChanged().
- EXPECT_CALL(*mock_update_library_, status())
+ EXPECT_CALL(*mock_update_engine_client_, GetLastStatus())
.Times(AtLeast(1))
- .WillRepeatedly(ReturnRef(status));
+ .WillRepeatedly(Return(status));
update_screen_->UpdateStatusChanged(status);
- status.status = UPDATE_STATUS_ERROR;
- // status() will be called via ExitUpdate() called from
+ status.status = UpdateEngineClient::UPDATE_STATUS_ERROR;
+ // GetLastStatus() will be called via ExitUpdate() called from
// UpdateStatusChanged().
- EXPECT_CALL(*mock_update_library_, status())
+ EXPECT_CALL(*mock_update_engine_client_, GetLastStatus())
.Times(AtLeast(1))
- .WillRepeatedly(ReturnRef(status));
+ .WillRepeatedly(Return(status));
EXPECT_CALL(*mock_screen_observer_,
OnExit(ScreenObserver::UPDATE_ERROR_UPDATING))
.Times(1);
« no previous file with comments | « chrome/browser/chromeos/login/update_screen.cc ('k') | chrome/browser/chromeos/upgrade_detector_chromeos.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698