| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ui/webui/help/version_updater_chromeos.h" | 5 #include "chrome/browser/ui/webui/help/version_updater_chromeos.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 class VersionUpdaterCrosTest : public ::testing::Test { | 38 class VersionUpdaterCrosTest : public ::testing::Test { |
| 39 protected: | 39 protected: |
| 40 VersionUpdaterCrosTest() | 40 VersionUpdaterCrosTest() |
| 41 : version_updater_(VersionUpdater::Create()), | 41 : version_updater_(VersionUpdater::Create()), |
| 42 fake_update_engine_client_(NULL), | 42 fake_update_engine_client_(NULL), |
| 43 mock_user_manager_(new MockUserManager()), | 43 mock_user_manager_(new MockUserManager()), |
| 44 user_manager_enabler_(mock_user_manager_) {} | 44 user_manager_enabler_(mock_user_manager_) {} |
| 45 | 45 |
| 46 virtual ~VersionUpdaterCrosTest() {} | 46 virtual ~VersionUpdaterCrosTest() {} |
| 47 | 47 |
| 48 virtual void SetUp() OVERRIDE { | 48 virtual void SetUp() override { |
| 49 fake_update_engine_client_ = new FakeUpdateEngineClient(); | 49 fake_update_engine_client_ = new FakeUpdateEngineClient(); |
| 50 scoped_ptr<DBusThreadManagerSetter> dbus_setter = | 50 scoped_ptr<DBusThreadManagerSetter> dbus_setter = |
| 51 DBusThreadManager::GetSetterForTesting(); | 51 DBusThreadManager::GetSetterForTesting(); |
| 52 dbus_setter->SetUpdateEngineClient( | 52 dbus_setter->SetUpdateEngineClient( |
| 53 scoped_ptr<UpdateEngineClient>(fake_update_engine_client_).Pass()); | 53 scoped_ptr<UpdateEngineClient>(fake_update_engine_client_).Pass()); |
| 54 | 54 |
| 55 EXPECT_CALL(*mock_user_manager_, IsCurrentUserOwner()) | 55 EXPECT_CALL(*mock_user_manager_, IsCurrentUserOwner()) |
| 56 .WillRepeatedly(Return(false)); | 56 .WillRepeatedly(Return(false)); |
| 57 EXPECT_CALL(*mock_user_manager_, Shutdown()).Times(AtLeast(0)); | 57 EXPECT_CALL(*mock_user_manager_, Shutdown()).Times(AtLeast(0)); |
| 58 | 58 |
| 59 DeviceSettingsService::Initialize(); | 59 DeviceSettingsService::Initialize(); |
| 60 CrosSettings::Initialize(); | 60 CrosSettings::Initialize(); |
| 61 | 61 |
| 62 NetworkHandler::Initialize(); | 62 NetworkHandler::Initialize(); |
| 63 ShillServiceClient::TestInterface* service_test = | 63 ShillServiceClient::TestInterface* service_test = |
| 64 DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface(); | 64 DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface(); |
| 65 service_test->AddService("/service/eth", | 65 service_test->AddService("/service/eth", |
| 66 "eth" /* guid */, | 66 "eth" /* guid */, |
| 67 "eth", | 67 "eth", |
| 68 shill::kTypeEthernet, shill::kStateOnline, | 68 shill::kTypeEthernet, shill::kStateOnline, |
| 69 true /* visible */); | 69 true /* visible */); |
| 70 loop_.RunUntilIdle(); | 70 loop_.RunUntilIdle(); |
| 71 } | 71 } |
| 72 | 72 |
| 73 virtual void TearDown() OVERRIDE { | 73 virtual void TearDown() override { |
| 74 NetworkHandler::Shutdown(); | 74 NetworkHandler::Shutdown(); |
| 75 | 75 |
| 76 CrosSettings::Shutdown(); | 76 CrosSettings::Shutdown(); |
| 77 DeviceSettingsService::Shutdown(); | 77 DeviceSettingsService::Shutdown(); |
| 78 } | 78 } |
| 79 | 79 |
| 80 scoped_ptr<VersionUpdater> version_updater_; | 80 scoped_ptr<VersionUpdater> version_updater_; |
| 81 FakeUpdateEngineClient* fake_update_engine_client_; // Not owned. | 81 FakeUpdateEngineClient* fake_update_engine_client_; // Not owned. |
| 82 | 82 |
| 83 MockUserManager* mock_user_manager_; // Not owned. | 83 MockUserManager* mock_user_manager_; // Not owned. |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 UpdateEngineClient::Status status; | 142 UpdateEngineClient::Status status; |
| 143 status.status = UpdateEngineClient::UPDATE_STATUS_IDLE; | 143 status.status = UpdateEngineClient::UPDATE_STATUS_IDLE; |
| 144 fake_update_engine_client_->set_default_status(status); | 144 fake_update_engine_client_->set_default_status(status); |
| 145 fake_update_engine_client_->NotifyObserversThatStatusChanged(status); | 145 fake_update_engine_client_->NotifyObserversThatStatusChanged(status); |
| 146 } | 146 } |
| 147 | 147 |
| 148 EXPECT_EQ(2, fake_update_engine_client_->request_update_check_call_count()); | 148 EXPECT_EQ(2, fake_update_engine_client_->request_update_check_call_count()); |
| 149 } | 149 } |
| 150 | 150 |
| 151 } // namespace chromeos | 151 } // namespace chromeos |
| OLD | NEW |