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

Side by Side Diff: chrome/browser/ui/webui/help/version_updater_chromeos_unittest.cc

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 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 <memory>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
9 #include "base/macros.h" 11 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "chrome/browser/chromeos/login/users/mock_user_manager.h" 12 #include "chrome/browser/chromeos/login/users/mock_user_manager.h"
12 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" 13 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
13 #include "chrome/browser/chromeos/settings/cros_settings.h" 14 #include "chrome/browser/chromeos/settings/cros_settings.h"
14 #include "chrome/browser/chromeos/settings/device_settings_service.h" 15 #include "chrome/browser/chromeos/settings/device_settings_service.h"
15 #include "chromeos/dbus/dbus_thread_manager.h" 16 #include "chromeos/dbus/dbus_thread_manager.h"
16 #include "chromeos/dbus/fake_update_engine_client.h" 17 #include "chromeos/dbus/fake_update_engine_client.h"
17 #include "chromeos/dbus/shill_service_client.h" 18 #include "chromeos/dbus/shill_service_client.h"
18 #include "chromeos/network/network_handler.h" 19 #include "chromeos/network/network_handler.h"
19 #include "content/public/test/test_browser_thread_bundle.h" 20 #include "content/public/test/test_browser_thread_bundle.h"
20 #include "testing/gmock/include/gmock/gmock.h" 21 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 19 matching lines...) Expand all
40 VersionUpdaterCrosTest() 41 VersionUpdaterCrosTest()
41 : version_updater_(VersionUpdater::Create(nullptr)), 42 : version_updater_(VersionUpdater::Create(nullptr)),
42 fake_update_engine_client_(NULL), 43 fake_update_engine_client_(NULL),
43 mock_user_manager_(new MockUserManager()), 44 mock_user_manager_(new MockUserManager()),
44 user_manager_enabler_(mock_user_manager_) {} 45 user_manager_enabler_(mock_user_manager_) {}
45 46
46 ~VersionUpdaterCrosTest() override {} 47 ~VersionUpdaterCrosTest() override {}
47 48
48 void SetUp() override { 49 void SetUp() override {
49 fake_update_engine_client_ = new FakeUpdateEngineClient(); 50 fake_update_engine_client_ = new FakeUpdateEngineClient();
50 scoped_ptr<DBusThreadManagerSetter> dbus_setter = 51 std::unique_ptr<DBusThreadManagerSetter> dbus_setter =
51 DBusThreadManager::GetSetterForTesting(); 52 DBusThreadManager::GetSetterForTesting();
52 dbus_setter->SetUpdateEngineClient( 53 dbus_setter->SetUpdateEngineClient(
53 scoped_ptr<UpdateEngineClient>(fake_update_engine_client_)); 54 std::unique_ptr<UpdateEngineClient>(fake_update_engine_client_));
54 55
55 EXPECT_CALL(*mock_user_manager_, IsCurrentUserOwner()) 56 EXPECT_CALL(*mock_user_manager_, IsCurrentUserOwner())
56 .WillRepeatedly(Return(false)); 57 .WillRepeatedly(Return(false));
57 EXPECT_CALL(*mock_user_manager_, Shutdown()).Times(AtLeast(0)); 58 EXPECT_CALL(*mock_user_manager_, Shutdown()).Times(AtLeast(0));
58 59
59 DeviceSettingsService::Initialize(); 60 DeviceSettingsService::Initialize();
60 CrosSettings::Initialize(); 61 CrosSettings::Initialize();
61 62
62 NetworkHandler::Initialize(); 63 NetworkHandler::Initialize();
63 ShillServiceClient::TestInterface* service_test = 64 ShillServiceClient::TestInterface* service_test =
64 DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface(); 65 DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface();
65 service_test->AddService("/service/eth", 66 service_test->AddService("/service/eth",
66 "eth" /* guid */, 67 "eth" /* guid */,
67 "eth", 68 "eth",
68 shill::kTypeEthernet, shill::kStateOnline, 69 shill::kTypeEthernet, shill::kStateOnline,
69 true /* visible */); 70 true /* visible */);
70 base::MessageLoop::current()->RunUntilIdle(); 71 base::MessageLoop::current()->RunUntilIdle();
71 } 72 }
72 73
73 void TearDown() override { 74 void TearDown() override {
74 NetworkHandler::Shutdown(); 75 NetworkHandler::Shutdown();
75 76
76 CrosSettings::Shutdown(); 77 CrosSettings::Shutdown();
77 DeviceSettingsService::Shutdown(); 78 DeviceSettingsService::Shutdown();
78 } 79 }
79 80
80 content::TestBrowserThreadBundle thread_bundle_; 81 content::TestBrowserThreadBundle thread_bundle_;
81 scoped_ptr<VersionUpdater> version_updater_; 82 std::unique_ptr<VersionUpdater> version_updater_;
82 FakeUpdateEngineClient* fake_update_engine_client_; // Not owned. 83 FakeUpdateEngineClient* fake_update_engine_client_; // Not owned.
83 84
84 MockUserManager* mock_user_manager_; // Not owned. 85 MockUserManager* mock_user_manager_; // Not owned.
85 ScopedUserManagerEnabler user_manager_enabler_; 86 ScopedUserManagerEnabler user_manager_enabler_;
86 87
87 DISALLOW_COPY_AND_ASSIGN(VersionUpdaterCrosTest); 88 DISALLOW_COPY_AND_ASSIGN(VersionUpdaterCrosTest);
88 }; 89 };
89 90
90 // The test checks following behaviour: 91 // The test checks following behaviour:
91 // 1. The device is currently on the dev channel and an user decides to switch 92 // 1. The device is currently on the dev channel and an user decides to switch
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 UpdateEngineClient::Status status; 144 UpdateEngineClient::Status status;
144 status.status = UpdateEngineClient::UPDATE_STATUS_IDLE; 145 status.status = UpdateEngineClient::UPDATE_STATUS_IDLE;
145 fake_update_engine_client_->set_default_status(status); 146 fake_update_engine_client_->set_default_status(status);
146 fake_update_engine_client_->NotifyObserversThatStatusChanged(status); 147 fake_update_engine_client_->NotifyObserversThatStatusChanged(status);
147 } 148 }
148 149
149 EXPECT_EQ(2, fake_update_engine_client_->request_update_check_call_count()); 150 EXPECT_EQ(2, fake_update_engine_client_->request_update_check_call_count());
150 } 151 }
151 152
152 } // namespace chromeos 153 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/help/help_handler.h ('k') | chrome/browser/ui/webui/history_login_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698