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

Side by Side Diff: chrome/browser/password_manager/chrome_password_manager_client_unittest.cc

Issue 1858513002: chrome/browser/password_manager: scoped_ptr -> unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Windows -- revert unwanted change 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/password_manager/chrome_password_manager_client.h" 5 #include "chrome/browser/password_manager/chrome_password_manager_client.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <string> 9 #include <string>
10 #include <tuple> 10 #include <tuple>
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 } 161 }
162 162
163 TEST_F(ChromePasswordManagerClientTest, 163 TEST_F(ChromePasswordManagerClientTest,
164 IsAutomaticPasswordSavingEnabledDefaultBehaviourTest) { 164 IsAutomaticPasswordSavingEnabledDefaultBehaviourTest) {
165 EXPECT_FALSE(GetClient()->IsAutomaticPasswordSavingEnabled()); 165 EXPECT_FALSE(GetClient()->IsAutomaticPasswordSavingEnabled());
166 } 166 }
167 167
168 TEST_F(ChromePasswordManagerClientTest, 168 TEST_F(ChromePasswordManagerClientTest,
169 IsAutomaticPasswordSavingEnabledWhenFlagIsSetTest) { 169 IsAutomaticPasswordSavingEnabledWhenFlagIsSetTest) {
170 // Add the enable-automatic-password-saving feature. 170 // Add the enable-automatic-password-saving feature.
171 scoped_ptr<base::FeatureList> feature_list(new base::FeatureList); 171 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList);
172 std::vector<const base::Feature*> enabled_features; 172 std::vector<const base::Feature*> enabled_features;
173 std::vector<const base::Feature*> disabled_features; 173 std::vector<const base::Feature*> disabled_features;
174 enabled_features.push_back( 174 enabled_features.push_back(
175 &password_manager::features::kEnableAutomaticPasswordSaving); 175 &password_manager::features::kEnableAutomaticPasswordSaving);
176 password_manager::SetFeatures(enabled_features, disabled_features, 176 password_manager::SetFeatures(enabled_features, disabled_features,
177 std::move(feature_list)); 177 std::move(feature_list));
178 178
179 if (chrome::GetChannel() == version_info::Channel::UNKNOWN) 179 if (chrome::GetChannel() == version_info::Channel::UNKNOWN)
180 EXPECT_TRUE(GetClient()->IsAutomaticPasswordSavingEnabled()); 180 EXPECT_TRUE(GetClient()->IsAutomaticPasswordSavingEnabled());
181 else 181 else
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 kPasswordManagerSettingsBehaviourChangeDisabledGroupName); 277 kPasswordManagerSettingsBehaviourChangeDisabledGroupName);
278 prefs()->SetUserPref(password_manager::prefs::kPasswordManagerSavingEnabled, 278 prefs()->SetUserPref(password_manager::prefs::kPasswordManagerSavingEnabled,
279 new base::FundamentalValue(true)); 279 new base::FundamentalValue(true));
280 EXPECT_TRUE(client->IsFillingEnabledForCurrentPage()); 280 EXPECT_TRUE(client->IsFillingEnabledForCurrentPage());
281 prefs()->SetUserPref(password_manager::prefs::kPasswordManagerSavingEnabled, 281 prefs()->SetUserPref(password_manager::prefs::kPasswordManagerSavingEnabled,
282 new base::FundamentalValue(false)); 282 new base::FundamentalValue(false));
283 EXPECT_TRUE(client->IsFillingEnabledForCurrentPage()); 283 EXPECT_TRUE(client->IsFillingEnabledForCurrentPage());
284 } 284 }
285 285
286 TEST_F(ChromePasswordManagerClientTest, SavingAndFillingEnabledConditionsTest) { 286 TEST_F(ChromePasswordManagerClientTest, SavingAndFillingEnabledConditionsTest) {
287 scoped_ptr<MockChromePasswordManagerClient> client( 287 std::unique_ptr<MockChromePasswordManagerClient> client(
288 new MockChromePasswordManagerClient(web_contents())); 288 new MockChromePasswordManagerClient(web_contents()));
289 // Functionality disabled if there is SSL errors. 289 // Functionality disabled if there is SSL errors.
290 EXPECT_CALL(*client, DidLastPageLoadEncounterSSLErrors()) 290 EXPECT_CALL(*client, DidLastPageLoadEncounterSSLErrors())
291 .WillRepeatedly(Return(true)); 291 .WillRepeatedly(Return(true));
292 EXPECT_FALSE(client->IsSavingAndFillingEnabledForCurrentPage()); 292 EXPECT_FALSE(client->IsSavingAndFillingEnabledForCurrentPage());
293 EXPECT_FALSE(client->IsFillingEnabledForCurrentPage()); 293 EXPECT_FALSE(client->IsFillingEnabledForCurrentPage());
294 294
295 // Functionality disabled if there are SSL errors and the manager itself is 295 // Functionality disabled if there are SSL errors and the manager itself is
296 // disabled. 296 // disabled.
297 prefs()->SetUserPref(password_manager::prefs::kPasswordManagerSavingEnabled, 297 prefs()->SetUserPref(password_manager::prefs::kPasswordManagerSavingEnabled,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 PasswordManagerInternalsServiceFactory::GetForBrowserContext(profile()); 349 PasswordManagerInternalsServiceFactory::GetForBrowserContext(profile());
350 DummyLogReceiver log_receiver; 350 DummyLogReceiver log_receiver;
351 EXPECT_EQ(std::string(), log_router->RegisterReceiver(&log_receiver)); 351 EXPECT_EQ(std::string(), log_router->RegisterReceiver(&log_receiver));
352 352
353 // But then navigate to a WebUI, there the logging should not be active. 353 // But then navigate to a WebUI, there the logging should not be active.
354 NavigateAndCommit(GURL("about:password-manager-internals")); 354 NavigateAndCommit(GURL("about:password-manager-internals"));
355 EXPECT_FALSE(GetClient()->GetLogManager()->IsLoggingActive()); 355 EXPECT_FALSE(GetClient()->GetLogManager()->IsLoggingActive());
356 356
357 log_router->UnregisterReceiver(&log_receiver); 357 log_router->UnregisterReceiver(&log_receiver);
358 } 358 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698