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

Side by Side Diff: chrome/browser/chromeos/login/screens/update_screen_browsertest.cc

Issue 2566443005: cros: Replace WizardController string constants with OobeScreen values. (Closed)
Patch Set: Address comments Created 3 years, 11 months 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/login/screens/update_screen.h" 5 #include "chrome/browser/chromeos/login/screens/update_screen.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 26 matching lines...) Expand all
37 37
38 namespace { 38 namespace {
39 39
40 const char kStubEthernetGuid[] = "eth0"; 40 const char kStubEthernetGuid[] = "eth0";
41 const char kStubWifiGuid[] = "wlan0"; 41 const char kStubWifiGuid[] = "wlan0";
42 42
43 } // namespace 43 } // namespace
44 44
45 class UpdateScreenTest : public WizardInProcessBrowserTest { 45 class UpdateScreenTest : public WizardInProcessBrowserTest {
46 public: 46 public:
47 UpdateScreenTest() : WizardInProcessBrowserTest("update"), 47 UpdateScreenTest()
48 fake_update_engine_client_(NULL), 48 : WizardInProcessBrowserTest(OobeScreen::SCREEN_OOBE_UPDATE),
49 network_portal_detector_(NULL) { 49 fake_update_engine_client_(nullptr),
50 } 50 network_portal_detector_(nullptr) {}
51 51
52 protected: 52 protected:
53 void SetUpInProcessBrowserTestFixture() override { 53 void SetUpInProcessBrowserTestFixture() override {
54 fake_update_engine_client_ = new FakeUpdateEngineClient; 54 fake_update_engine_client_ = new FakeUpdateEngineClient;
55 chromeos::DBusThreadManager::GetSetterForTesting()->SetUpdateEngineClient( 55 chromeos::DBusThreadManager::GetSetterForTesting()->SetUpdateEngineClient(
56 std::unique_ptr<UpdateEngineClient>(fake_update_engine_client_)); 56 std::unique_ptr<UpdateEngineClient>(fake_update_engine_client_));
57 57
58 WizardInProcessBrowserTest::SetUpInProcessBrowserTestFixture(); 58 WizardInProcessBrowserTest::SetUpInProcessBrowserTestFixture();
59 59
60 // Setup network portal detector to return online state for both 60 // Setup network portal detector to return online state for both
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 status.status = UpdateEngineClient::UPDATE_STATUS_FINALIZING; 175 status.status = UpdateEngineClient::UPDATE_STATUS_FINALIZING;
176 update_screen_->UpdateStatusChanged(status); 176 update_screen_->UpdateStatusChanged(status);
177 177
178 status.status = UpdateEngineClient::UPDATE_STATUS_UPDATED_NEED_REBOOT; 178 status.status = UpdateEngineClient::UPDATE_STATUS_UPDATED_NEED_REBOOT;
179 update_screen_->UpdateStatusChanged(status); 179 update_screen_->UpdateStatusChanged(status);
180 // UpdateStatusChanged(status) calls RebootAfterUpdate(). 180 // UpdateStatusChanged(status) calls RebootAfterUpdate().
181 EXPECT_EQ(1, fake_update_engine_client_->reboot_after_update_call_count()); 181 EXPECT_EQ(1, fake_update_engine_client_->reboot_after_update_call_count());
182 // Check that OOBE will resume back at this screen. 182 // Check that OOBE will resume back at this screen.
183 base::RunLoop().RunUntilIdle(); 183 base::RunLoop().RunUntilIdle();
184 EXPECT_FALSE(StartupUtils::IsOobeCompleted()); 184 EXPECT_FALSE(StartupUtils::IsOobeCompleted());
185 EXPECT_EQ( 185 EXPECT_EQ(update_screen_->screen_id(),
186 update_screen_->screen_id(), 186 GetOobeScreenFromName(g_browser_process->local_state()->GetString(
187 g_browser_process->local_state()->GetString(prefs::kOobeScreenPending)); 187 prefs::kOobeScreenPending)));
188 } 188 }
189 189
190 IN_PROC_BROWSER_TEST_F(UpdateScreenTest, TestErrorIssuingUpdateCheck) { 190 IN_PROC_BROWSER_TEST_F(UpdateScreenTest, TestErrorIssuingUpdateCheck) {
191 // First, cancel the update that is already in progress. 191 // First, cancel the update that is already in progress.
192 EXPECT_CALL(*mock_base_screen_delegate_, 192 EXPECT_CALL(*mock_base_screen_delegate_,
193 OnExit(_, BaseScreenDelegate::UPDATE_NOUPDATE, _)).Times(1); 193 OnExit(_, BaseScreenDelegate::UPDATE_NOUPDATE, _)).Times(1);
194 update_screen_->CancelUpdate(); 194 update_screen_->CancelUpdate();
195 195
196 fake_update_engine_client_->set_update_check_result( 196 fake_update_engine_client_->set_update_check_result(
197 chromeos::UpdateEngineClient::UPDATE_RESULT_FAILED); 197 chromeos::UpdateEngineClient::UPDATE_RESULT_FAILED);
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 chromeos::UpdateEngineClient::UPDATE_RESULT_FAILED); 402 chromeos::UpdateEngineClient::UPDATE_RESULT_FAILED);
403 EXPECT_CALL(*mock_base_screen_delegate_, 403 EXPECT_CALL(*mock_base_screen_delegate_,
404 OnExit(_, BaseScreenDelegate::UPDATE_ERROR_CHECKING_FOR_UPDATE, 404 OnExit(_, BaseScreenDelegate::UPDATE_ERROR_CHECKING_FOR_UPDATE,
405 _)).Times(1); 405 _)).Times(1);
406 406
407 update_screen_->OnConnectRequested(); 407 update_screen_->OnConnectRequested();
408 base::RunLoop().RunUntilIdle(); 408 base::RunLoop().RunUntilIdle();
409 } 409 }
410 410
411 } // namespace chromeos 411 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/screens/update_screen.cc ('k') | chrome/browser/chromeos/login/screens/user_image_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698