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

Side by Side Diff: chrome/browser/chromeos/policy/consumer_management_notifier_factory_unittest.cc

Issue 1870793002: Convert //chrome/browser/chromeos 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/chromeos/policy/consumer_management_notifier_factory.h" 5 #include "chrome/browser/chromeos/policy/consumer_management_notifier_factory.h"
6 6
7 #include "base/memory/ptr_util.h"
7 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
8 #include "chrome/browser/browser_process_platform_part.h" 9 #include "chrome/browser/browser_process_platform_part.h"
9 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" 10 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h"
10 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" 11 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
11 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 12 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
12 #include "chrome/browser/chromeos/policy/consumer_management_service.h" 13 #include "chrome/browser/chromeos/policy/consumer_management_service.h"
13 #include "chrome/browser/chromeos/policy/consumer_management_stage.h" 14 #include "chrome/browser/chromeos/policy/consumer_management_stage.h"
14 #include "chrome/browser/chromeos/policy/fake_consumer_management_service.h" 15 #include "chrome/browser/chromeos/policy/fake_consumer_management_service.h"
15 #include "chrome/test/base/testing_browser_process.h" 16 #include "chrome/test/base/testing_browser_process.h"
16 #include "chrome/test/base/testing_profile_manager.h" 17 #include "chrome/test/base/testing_profile_manager.h"
(...skipping 17 matching lines...) Expand all
34 new TestingProfileManager(TestingBrowserProcess::GetGlobal())) { 35 new TestingProfileManager(TestingBrowserProcess::GetGlobal())) {
35 // Set up FakeConsumerManagementService. 36 // Set up FakeConsumerManagementService.
36 fake_service_->SetStatusAndStage( 37 fake_service_->SetStatusAndStage(
37 ConsumerManagementService::STATUS_UNENROLLED, 38 ConsumerManagementService::STATUS_UNENROLLED,
38 ConsumerManagementStage::None()); 39 ConsumerManagementStage::None());
39 40
40 // Inject fake objects. 41 // Inject fake objects.
41 BrowserPolicyConnectorChromeOS* connector = 42 BrowserPolicyConnectorChromeOS* connector =
42 g_browser_process->platform_part()->browser_policy_connector_chromeos(); 43 g_browser_process->platform_part()->browser_policy_connector_chromeos();
43 connector->SetConsumerManagementServiceForTesting( 44 connector->SetConsumerManagementServiceForTesting(
44 make_scoped_ptr(fake_service_)); 45 base::WrapUnique(fake_service_));
45 46
46 // Set up FakeChromeUserManager. 47 // Set up FakeChromeUserManager.
47 fake_user_manager_->AddUser(AccountId::FromUserEmail(kTestOwner)); 48 fake_user_manager_->AddUser(AccountId::FromUserEmail(kTestOwner));
48 fake_user_manager_->AddUser(AccountId::FromUserEmail(kTestUser)); 49 fake_user_manager_->AddUser(AccountId::FromUserEmail(kTestUser));
49 fake_user_manager_->set_owner_id(AccountId::FromUserEmail(kTestOwner)); 50 fake_user_manager_->set_owner_id(AccountId::FromUserEmail(kTestOwner));
50 } 51 }
51 52
52 void SetUp() override { 53 void SetUp() override {
53 ASSERT_TRUE(testing_profile_manager_->SetUp()); 54 ASSERT_TRUE(testing_profile_manager_->SetUp());
54 } 55 }
55 56
56 content::TestBrowserThreadBundle thread_bundle_; 57 content::TestBrowserThreadBundle thread_bundle_;
57 FakeConsumerManagementService* fake_service_; 58 FakeConsumerManagementService* fake_service_;
58 chromeos::FakeChromeUserManager* fake_user_manager_; 59 chromeos::FakeChromeUserManager* fake_user_manager_;
59 chromeos::ScopedUserManagerEnabler scoped_user_manager_enabler_; 60 chromeos::ScopedUserManagerEnabler scoped_user_manager_enabler_;
60 scoped_ptr<TestingProfileManager> testing_profile_manager_; 61 std::unique_ptr<TestingProfileManager> testing_profile_manager_;
61 }; 62 };
62 63
63 TEST_F(ConsumerManagementNotifierFactoryTest, ServiceIsCreated) { 64 TEST_F(ConsumerManagementNotifierFactoryTest, ServiceIsCreated) {
64 Profile* profile = testing_profile_manager_->CreateTestingProfile(kTestOwner); 65 Profile* profile = testing_profile_manager_->CreateTestingProfile(kTestOwner);
65 EXPECT_TRUE( 66 EXPECT_TRUE(
66 ConsumerManagementNotifierFactory::GetForBrowserContext(profile)); 67 ConsumerManagementNotifierFactory::GetForBrowserContext(profile));
67 } 68 }
68 69
69 TEST_F(ConsumerManagementNotifierFactoryTest, 70 TEST_F(ConsumerManagementNotifierFactoryTest,
70 ServiceIsNotCreatedForNonOwner) { 71 ServiceIsNotCreatedForNonOwner) {
71 Profile* profile = testing_profile_manager_->CreateTestingProfile(kTestUser); 72 Profile* profile = testing_profile_manager_->CreateTestingProfile(kTestUser);
72 EXPECT_FALSE( 73 EXPECT_FALSE(
73 ConsumerManagementNotifierFactory::GetForBrowserContext(profile)); 74 ConsumerManagementNotifierFactory::GetForBrowserContext(profile));
74 } 75 }
75 76
76 } // namespace policy 77 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698