| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/cros/mock_login_library.h" | 5 #include "chrome/browser/chromeos/cros/mock_login_library.h" |
| 6 #include "chrome/browser/chromeos/cros/mock_network_library.h" | 6 #include "chrome/browser/chromeos/cros/mock_network_library.h" |
| 7 #include "chrome/browser/chromeos/cros/mock_update_library.h" | 7 #include "chrome/browser/chromeos/cros/mock_update_library.h" |
| 8 #include "chrome/browser/chromeos/login/mock_screen_observer.h" | 8 #include "chrome/browser/chromeos/login/mock_screen_observer.h" |
| 9 #include "chrome/browser/chromeos/login/update_screen.h" | 9 #include "chrome/browser/chromeos/login/update_screen.h" |
| 10 #include "chrome/browser/chromeos/login/wizard_controller.h" | 10 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 11 #include "chrome/browser/chromeos/login/wizard_in_process_browser_test.h" | 11 #include "chrome/browser/chromeos/login/wizard_in_process_browser_test.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 13 |
| 14 namespace chromeos { | 14 namespace chromeos { |
| 15 using ::testing::_; | 15 using ::testing::_; |
| 16 using ::testing::AtLeast; | 16 using ::testing::AtLeast; |
| 17 using ::testing::Return; | 17 using ::testing::Return; |
| 18 using ::testing::ReturnRef; | 18 using ::testing::ReturnRef; |
| 19 | 19 |
| 20 class UpdateScreenTest : public WizardInProcessBrowserTest { | 20 class UpdateScreenTest : public WizardInProcessBrowserTest { |
| 21 public: | 21 public: |
| 22 UpdateScreenTest() : WizardInProcessBrowserTest("update"), | 22 UpdateScreenTest() : WizardInProcessBrowserTest("update"), |
| 23 mock_login_library_(NULL), | 23 mock_login_library_(NULL), |
| 24 mock_update_library_(NULL), | 24 mock_update_library_(NULL), |
| 25 mock_network_library_(NULL){} | 25 mock_network_library_(NULL) {} |
| 26 | 26 |
| 27 protected: | 27 protected: |
| 28 virtual void SetUpInProcessBrowserTestFixture() { | 28 virtual void SetUpInProcessBrowserTestFixture() { |
| 29 WizardInProcessBrowserTest::SetUpInProcessBrowserTestFixture(); | 29 WizardInProcessBrowserTest::SetUpInProcessBrowserTestFixture(); |
| 30 cros_mock_->InitStatusAreaMocks(); | 30 cros_mock_->InitStatusAreaMocks(); |
| 31 cros_mock_->SetStatusAreaMocksExpectations(); | 31 cros_mock_->SetStatusAreaMocksExpectations(); |
| 32 ASSERT_TRUE(CrosLibrary::Get()->EnsureLoaded()); | 32 ASSERT_TRUE(CrosLibrary::Get()->EnsureLoaded()); |
| 33 | 33 |
| 34 mock_login_library_ = new MockLoginLibrary(); | 34 mock_login_library_ = new MockLoginLibrary(); |
| 35 cros_mock_->test_api()->SetLoginLibrary(mock_login_library_, true); | 35 cros_mock_->test_api()->SetLoginLibrary(mock_login_library_, true); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 48 .Times(AtLeast(1)); | 48 .Times(AtLeast(1)); |
| 49 EXPECT_CALL(*mock_update_library_, CheckForUpdate()) | 49 EXPECT_CALL(*mock_update_library_, CheckForUpdate()) |
| 50 .Times(1) | 50 .Times(1) |
| 51 .WillOnce(Return(true)); | 51 .WillOnce(Return(true)); |
| 52 | 52 |
| 53 mock_network_library_ = cros_mock_->mock_network_library(); | 53 mock_network_library_ = cros_mock_->mock_network_library(); |
| 54 EXPECT_CALL(*mock_network_library_, Connected()) | 54 EXPECT_CALL(*mock_network_library_, Connected()) |
| 55 .Times(1) // also called by NetworkMenu::InitMenuItems() | 55 .Times(1) // also called by NetworkMenu::InitMenuItems() |
| 56 .WillRepeatedly((Return(false))) | 56 .WillRepeatedly((Return(false))) |
| 57 .RetiresOnSaturation(); | 57 .RetiresOnSaturation(); |
| 58 EXPECT_CALL(*mock_network_library_, AddObserver(_)) | 58 EXPECT_CALL(*mock_network_library_, AddNetworkManagerObserver(_)) |
| 59 .Times(1) | 59 .Times(1) |
| 60 .RetiresOnSaturation(); | 60 .RetiresOnSaturation(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 virtual void TearDownInProcessBrowserTestFixture() { | 63 virtual void TearDownInProcessBrowserTestFixture() { |
| 64 cros_mock_->test_api()->SetUpdateLibrary(NULL, true); | 64 cros_mock_->test_api()->SetUpdateLibrary(NULL, true); |
| 65 WizardInProcessBrowserTest::TearDownInProcessBrowserTestFixture(); | 65 WizardInProcessBrowserTest::TearDownInProcessBrowserTestFixture(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 MockLoginLibrary* mock_login_library_; | 68 MockLoginLibrary* mock_login_library_; |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 .WillRepeatedly(ReturnRef(status)); | 246 .WillRepeatedly(ReturnRef(status)); |
| 247 EXPECT_CALL(*mock_screen_observer, | 247 EXPECT_CALL(*mock_screen_observer, |
| 248 OnExit(ScreenObserver::UPDATE_ERROR_UPDATING)) | 248 OnExit(ScreenObserver::UPDATE_ERROR_UPDATING)) |
| 249 .Times(1); | 249 .Times(1); |
| 250 update_screen->UpdateStatusChanged(mock_update_library_); | 250 update_screen->UpdateStatusChanged(mock_update_library_); |
| 251 | 251 |
| 252 controller()->set_observer(NULL); | 252 controller()->set_observer(NULL); |
| 253 } | 253 } |
| 254 | 254 |
| 255 } // namespace chromeos | 255 } // namespace chromeos |
| OLD | NEW |