CodeHealth: Avoid ListValue::Clear()
Replace every occurrence with Value::ClearList(). Will follow up with a CL that actually removes ListValue::Clear() when this one has landed. Bug: 1187063 Change-Id: Iff16d0f893b7d549012069872de5ffe19a975c22 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3006068 Reviewed-by: Finnur Thorarinsson <finnur@chromium.org> Reviewed-by: Michael Crouse <mcrouse@chromium.org> Reviewed-by: Camille Lamy <clamy@chromium.org> Reviewed-by: Xiaoqian Dai <xdai@chromium.org> Reviewed-by: Mark Pearson <mpearson@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Marc Treib <treib@chromium.org> Reviewed-by: Sylvain Defresne <sdefresne@chromium.org> Reviewed-by: Maksim Ivanov <emaxx@chromium.org> Reviewed-by: Josh Karlin <jkarlin@chromium.org> Reviewed-by: Elly Fong-Jones <ellyjones@chromium.org> Reviewed-by: Alexander Alekseev <alemate@chromium.org> Reviewed-by: Bruce Dawson <brucedawson@chromium.org> Reviewed-by: Evan Liu <evliu@google.com> Reviewed-by: Yuchen Liu <yucliu@chromium.org> Commit-Queue: Morten Stenshorne <mstensho@chromium.org> Cr-Commit-Position: refs/heads/master@{#900907}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
494206e059
commit
03129fe90d
ash
base
chrome
browser
ash
login
devtools
extensions
policy
prefs
profiles
safe_browsing
cloud_content_scanning
ui
web_applications
system_web_apps
test
chromedriver
chromecast/crash/linux
chromeos
dbus
network
services
device_sync
components
data_reduction_proxy
core
flags_ui
metrics
signin
internal
soda
user_manager
content/browser
extensions
browser
common
net/dns
tools/json_schema_compiler
@ -715,7 +715,7 @@ void StoreDisplayTouchAssociations(PrefService* pref_service) {
|
||||
void StoreExternalDisplayMirrorInfo(PrefService* pref_service) {
|
||||
ListPrefUpdate update(pref_service, prefs::kExternalDisplayMirrorInfo);
|
||||
base::ListValue* pref_data = update.Get();
|
||||
pref_data->Clear();
|
||||
pref_data->ClearList();
|
||||
const std::set<int64_t>& external_display_mirror_info =
|
||||
GetDisplayManager()->external_display_mirror_info();
|
||||
for (const auto& id : external_display_mirror_info)
|
||||
|
@ -216,7 +216,7 @@ class DisplayPrefsTest : public AshTestBase {
|
||||
const std::set<int64_t>& external_display_mirror_info) {
|
||||
ListPrefUpdate update(local_state(), prefs::kExternalDisplayMirrorInfo);
|
||||
base::ListValue* pref_data = update.Get();
|
||||
pref_data->Clear();
|
||||
pref_data->ClearList();
|
||||
for (const auto& id : external_display_mirror_info)
|
||||
pref_data->Append(base::Value(base::NumberToString(id)));
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ void UpdatePrimaryUserDeskNamesPrefs() {
|
||||
|
||||
ListPrefUpdate name_update(primary_user_prefs, prefs::kDesksNamesList);
|
||||
base::ListValue* name_pref_data = name_update.Get();
|
||||
name_pref_data->Clear();
|
||||
name_pref_data->ClearList();
|
||||
|
||||
const auto& desks = DesksController::Get()->desks();
|
||||
for (const auto& desk : desks) {
|
||||
@ -234,7 +234,7 @@ void UpdatePrimaryUserDeskMetricsPrefs() {
|
||||
// Save per-desk metrics.
|
||||
ListPrefUpdate metrics_update(primary_user_prefs, prefs::kDesksMetricsList);
|
||||
base::ListValue* metrics_pref_data = metrics_update.Get();
|
||||
metrics_pref_data->Clear();
|
||||
metrics_pref_data->ClearList();
|
||||
|
||||
auto* desks_controller = DesksController::Get();
|
||||
const auto& desks = desks_controller->desks();
|
||||
|
@ -1490,7 +1490,7 @@ TEST(ValuesTest, ListDeletion) {
|
||||
ListValue list;
|
||||
list.Append(std::make_unique<Value>());
|
||||
EXPECT_FALSE(list.GetList().empty());
|
||||
list.Clear();
|
||||
list.ClearList();
|
||||
EXPECT_TRUE(list.GetList().empty());
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ void EasyUnlockKeyManager::DeviceDataListToRemoteDeviceList(
|
||||
const AccountId& account_id,
|
||||
const EasyUnlockDeviceKeyDataList& data_list,
|
||||
base::ListValue* device_list) {
|
||||
device_list->Clear();
|
||||
device_list->ClearList();
|
||||
for (size_t i = 0; i < data_list.size(); ++i) {
|
||||
std::unique_ptr<base::DictionaryValue> device_dict(
|
||||
new base::DictionaryValue);
|
||||
|
@ -756,7 +756,7 @@ void ChromeUserManagerImpl::RetrieveTrustedDevicePolicies() {
|
||||
if (GetEphemeralUsersEnabled() && !IsUserLoggedIn()) {
|
||||
ListPrefUpdate prefs_users_update(GetLocalState(),
|
||||
user_manager::kRegularUsersPref);
|
||||
prefs_users_update->Clear();
|
||||
prefs_users_update->ClearList();
|
||||
for (user_manager::UserList::iterator it = users_.begin();
|
||||
it != users_.end();) {
|
||||
const AccountId account_id = (*it)->GetAccountId();
|
||||
@ -1014,7 +1014,7 @@ bool ChromeUserManagerImpl::UpdateAndCleanUpDeviceLocalAccounts(
|
||||
// us to clean up associated data if they disappear from policy.
|
||||
ListPrefUpdate prefs_device_local_accounts_update(
|
||||
GetLocalState(), kDeviceLocalAccountsWithSavedData);
|
||||
prefs_device_local_accounts_update->Clear();
|
||||
prefs_device_local_accounts_update->ClearList();
|
||||
for (const auto& account : device_local_accounts)
|
||||
prefs_device_local_accounts_update->AppendString(account.user_id);
|
||||
|
||||
|
@ -396,7 +396,7 @@ StartupProfileInfo CreatePrimaryProfile(
|
||||
ListPrefUpdate update(g_browser_process->local_state(),
|
||||
prefs::kProfilesLastActive);
|
||||
base::ListValue* profile_list = update.Get();
|
||||
profile_list->Clear();
|
||||
profile_list->ClearList();
|
||||
}
|
||||
|
||||
StartupProfileInfo profile_info;
|
||||
|
@ -75,7 +75,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsAndroidBridgeTest, DiscoveryListChanges) {
|
||||
EXPECT_STREQ("somehost:2000", AllTargetsString(provider).c_str());
|
||||
|
||||
invocations = called;
|
||||
list.Clear();
|
||||
list.ClearList();
|
||||
service->Set(prefs::kDevToolsTCPDiscoveryConfig, list);
|
||||
|
||||
EXPECT_LT(invocations, called);
|
||||
|
@ -505,7 +505,7 @@ TEST_F(DeveloperPrivateApiUnitTest, DeveloperPrivateChoosePath) {
|
||||
base::FilePath expected_file_path =
|
||||
data_dir().AppendASCII("simple_with_popup.pem");
|
||||
api::EntryPicker::SkipPickerAndAlwaysSelectPathForTest(&expected_file_path);
|
||||
choose_args.Clear();
|
||||
choose_args.ClearList();
|
||||
choose_args.AppendString("FILE");
|
||||
choose_args.AppendString("PEM");
|
||||
function = new api::DeveloperPrivateChoosePathFunction();
|
||||
|
@ -250,7 +250,7 @@ LanguageSettingsPrivateGetLanguageListFunction::Run() {
|
||||
std::move(spellcheck_languages));
|
||||
|
||||
// Build the language list.
|
||||
language_list_->Clear();
|
||||
language_list_->ClearList();
|
||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
const base::flat_set<std::string> allowed_ui_locales(GetAllowedLanguages(
|
||||
Profile::FromBrowserContext(browser_context())->GetPrefs()));
|
||||
|
@ -149,7 +149,7 @@ void TabCaptureRegistry::GetCapturedTabs(
|
||||
base::ListValue* list_of_capture_info) const {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||
DCHECK(list_of_capture_info);
|
||||
list_of_capture_info->Clear();
|
||||
list_of_capture_info->ClearList();
|
||||
for (const std::unique_ptr<LiveRequest>& request : requests_) {
|
||||
if (request->is_anonymous() || !request->is_verified() ||
|
||||
request->extension_id() != extension_id)
|
||||
|
@ -77,7 +77,7 @@ bool WillDispatchTabCreatedEvent(WebContents* contents,
|
||||
const Extension* extension,
|
||||
Event* event,
|
||||
const base::DictionaryValue* listener_filter) {
|
||||
event->event_args->Clear();
|
||||
event->event_args->ClearList();
|
||||
ExtensionTabUtil::ScrubTabBehavior scrub_tab_behavior =
|
||||
ExtensionTabUtil::GetScrubTabBehavior(extension, target_context,
|
||||
contents);
|
||||
|
@ -133,10 +133,10 @@ bool WillDispatchWindowFocusedEvent(
|
||||
window_controller, extension, listener_filter);
|
||||
|
||||
if (cant_cross_incognito || !visible_to_listener) {
|
||||
event->event_args->Clear();
|
||||
event->event_args->ClearList();
|
||||
event->event_args->AppendInteger(extension_misc::kUnknownWindowId);
|
||||
} else {
|
||||
event->event_args->Clear();
|
||||
event->event_args->ClearList();
|
||||
event->event_args->AppendInteger(window_id);
|
||||
}
|
||||
return true;
|
||||
|
@ -1094,7 +1094,7 @@ TEST_F(ExtensionAdminPolicyTest, BlocklistedByDefault) {
|
||||
blocklist.AppendString("*");
|
||||
EXPECT_TRUE(BlocklistedByDefault(&blocklist));
|
||||
|
||||
blocklist.Clear();
|
||||
blocklist.ClearList();
|
||||
blocklist.AppendString("*");
|
||||
EXPECT_TRUE(BlocklistedByDefault(&blocklist));
|
||||
}
|
||||
@ -1171,7 +1171,7 @@ TEST_F(ExtensionAdminPolicyTest, UserMayLoadBlocklisted) {
|
||||
blocklist.AppendString(extension_->id());
|
||||
EXPECT_FALSE(UserMayLoad(&blocklist, nullptr, nullptr, nullptr,
|
||||
extension_.get(), nullptr));
|
||||
blocklist.Clear();
|
||||
blocklist.ClearList();
|
||||
blocklist.AppendString(extension_->id());
|
||||
EXPECT_FALSE(UserMayLoad(&blocklist, nullptr, nullptr, nullptr,
|
||||
extension_.get(), nullptr));
|
||||
|
@ -152,7 +152,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, SafeBrowsingWhitelistDomains) {
|
||||
EXPECT_EQ("mydomain.net", canonicalized_domains[1]);
|
||||
|
||||
// Invalid domains will be skipped.
|
||||
whitelist_domains.Clear();
|
||||
whitelist_domains.ClearList();
|
||||
whitelist_domains.AppendString(std::string("%EF%BF%BDzyx.com"));
|
||||
policies.Set(key::kSafeBrowsingWhitelistDomains, POLICY_LEVEL_MANDATORY,
|
||||
POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
|
||||
@ -195,7 +195,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, PasswordProtectionLoginURLs) {
|
||||
EXPECT_EQ(GURL("https://mydomian.com/login.html"), login_urls[1]);
|
||||
|
||||
// Verify non-http/https schemes, or invalid URLs will be skipped.
|
||||
login_url_values.Clear();
|
||||
login_url_values.ClearList();
|
||||
login_url_values.AppendString(std::string("invalid"));
|
||||
login_url_values.AppendString(std::string("ftp://login.mydomain.com"));
|
||||
policies.Set(key::kPasswordProtectionLoginURLs, POLICY_LEVEL_MANDATORY,
|
||||
|
@ -88,7 +88,7 @@ void SessionStartupPref::SetStartupPref(PrefService* prefs,
|
||||
ListPrefUpdate update(prefs, prefs::kURLsToRestoreOnStartup);
|
||||
base::ListValue* url_pref_list = update.Get();
|
||||
DCHECK(url_pref_list);
|
||||
url_pref_list->Clear();
|
||||
url_pref_list->ClearList();
|
||||
for (size_t i = 0; i < pref.urls.size(); ++i) {
|
||||
url_pref_list->Set(static_cast<int>(i),
|
||||
std::make_unique<base::Value>(pref.urls[i].spec()));
|
||||
|
@ -2172,7 +2172,7 @@ void ProfileManager::SaveActiveProfiles() {
|
||||
ListPrefUpdate update(local_state, prefs::kProfilesLastActive);
|
||||
base::ListValue* profile_list = update.Get();
|
||||
|
||||
profile_list->Clear();
|
||||
profile_list->ClearList();
|
||||
|
||||
// crbug.com/120112 -> several non-off-the-record profiles might have the same
|
||||
// GetBaseName(). In that case, we cannot restore both
|
||||
|
@ -407,7 +407,7 @@ void SetAnalysisConnector(PrefService* prefs,
|
||||
ListPrefUpdate settings_list(prefs, ConnectorPref(connector));
|
||||
DCHECK(settings_list.Get());
|
||||
if (!settings_list->GetList().empty())
|
||||
settings_list->Clear();
|
||||
settings_list->ClearList();
|
||||
|
||||
settings_list->Append(*base::JSONReader::Read(pref_value));
|
||||
prefs->SetInteger(
|
||||
@ -453,7 +453,7 @@ void ClearAnalysisConnector(
|
||||
enterprise_connectors::AnalysisConnector connector) {
|
||||
ListPrefUpdate settings_list(prefs, ConnectorPref(connector));
|
||||
DCHECK(settings_list.Get());
|
||||
settings_list->Clear();
|
||||
settings_list->ClearList();
|
||||
prefs->ClearPref(ConnectorScopePref(connector));
|
||||
}
|
||||
|
||||
|
@ -263,7 +263,7 @@ TEST_F(AppMenuModelTest, DisableSettingsItem) {
|
||||
ListPrefUpdate update(TestingBrowserProcess::GetGlobal()->local_state(),
|
||||
policy::policy_prefs::kSystemFeaturesDisableList);
|
||||
base::ListValue* list = update.Get();
|
||||
list->Clear();
|
||||
list->ClearList();
|
||||
}
|
||||
EXPECT_TRUE(model.IsEnabledAt(options_index));
|
||||
|
||||
|
@ -347,7 +347,7 @@ TEST_F(SiteSettingsHelperTest, CheckExceptionOrder) {
|
||||
map, std::move(extension_provider),
|
||||
HostContentSettingsMap::CUSTOM_EXTENSION_PROVIDER);
|
||||
|
||||
exceptions.Clear();
|
||||
exceptions.ClearList();
|
||||
GetExceptionsForContentType(kContentType, &profile,
|
||||
/*extension_registry=*/nullptr,
|
||||
/*web_ui=*/nullptr,
|
||||
|
@ -1394,7 +1394,7 @@ IN_PROC_BROWSER_TEST_P(SystemWebAppManagerAppSuspensionBrowserTest,
|
||||
ListPrefUpdate update(TestingBrowserProcess::GetGlobal()->local_state(),
|
||||
policy::policy_prefs::kSystemFeaturesDisableList);
|
||||
base::ListValue* list = update.Get();
|
||||
list->Clear();
|
||||
list->ClearList();
|
||||
}
|
||||
GetAppServiceProxy(browser()->profile())->FlushMojoCallsForTesting();
|
||||
EXPECT_EQ(apps::mojom::Readiness::kReady, GetAppReadiness(*settings_id));
|
||||
@ -1430,7 +1430,7 @@ IN_PROC_BROWSER_TEST_P(SystemWebAppManagerAppSuspensionBrowserTest,
|
||||
ListPrefUpdate update(TestingBrowserProcess::GetGlobal()->local_state(),
|
||||
policy::policy_prefs::kSystemFeaturesDisableList);
|
||||
base::ListValue* list = update.Get();
|
||||
list->Clear();
|
||||
list->ClearList();
|
||||
}
|
||||
proxy->FlushMojoCallsForTesting();
|
||||
EXPECT_EQ(apps::mojom::Readiness::kReady, GetAppReadiness(*settings_id));
|
||||
|
@ -1935,7 +1935,7 @@ Status ExecuteReleaseActions(Session* session,
|
||||
|
||||
session->input_cancel_list.clear();
|
||||
session->input_state_table.Clear();
|
||||
session->active_input_sources.Clear();
|
||||
session->active_input_sources.ClearList();
|
||||
session->mouse_position = WebPoint(0, 0);
|
||||
session->click_count = 0;
|
||||
session->mouse_click_timestamp = base::TimeTicks::Now();
|
||||
|
@ -392,7 +392,7 @@ std::vector<std::unique_ptr<DumpInfo>> SynchronizedMinidumpManager::GetDumps() {
|
||||
|
||||
bool SynchronizedMinidumpManager::SetCurrentDumps(
|
||||
const std::vector<std::unique_ptr<DumpInfo>>& dumps) {
|
||||
dumps_->Clear();
|
||||
dumps_->ClearList();
|
||||
|
||||
for (auto& dump : dumps)
|
||||
dumps_->Append(dump->GetAsValue());
|
||||
|
@ -500,7 +500,7 @@ void FakeShillManagerClient::RemoveDevice(const std::string& device_path) {
|
||||
}
|
||||
|
||||
void FakeShillManagerClient::ClearDevices() {
|
||||
GetListProperty(shill::kDevicesProperty)->Clear();
|
||||
GetListProperty(shill::kDevicesProperty)->ClearList();
|
||||
CallNotifyObserversPropertyChanged(shill::kDevicesProperty);
|
||||
}
|
||||
|
||||
@ -623,7 +623,7 @@ void FakeShillManagerClient::RemoveManagerService(
|
||||
|
||||
void FakeShillManagerClient::ClearManagerServices() {
|
||||
VLOG(1) << "ClearManagerServices";
|
||||
GetListProperty(shill::kServiceCompleteListProperty)->Clear();
|
||||
GetListProperty(shill::kServiceCompleteListProperty)->ClearList();
|
||||
CallNotifyObserversPropertyChanged(shill::kServiceCompleteListProperty);
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ TEST_F(NetworkUtilTest, ParseScanResults) {
|
||||
EXPECT_FALSE(ParseCellularScanResults(list, &scan_results));
|
||||
|
||||
// Scan result has no network id.
|
||||
list.Clear();
|
||||
list.ClearList();
|
||||
auto dict_value = std::make_unique<base::DictionaryValue>();
|
||||
dict_value->SetString(shill::kStatusProperty, "available");
|
||||
list.Append(std::move(dict_value));
|
||||
|
@ -704,7 +704,7 @@ TEST_F(
|
||||
InitWithExistingPrefs_MigrateDeprecateBooleansFromPrefsToSoftwareFeature) {
|
||||
ListPrefUpdate update_clear(&pref_service_,
|
||||
prefs::kCryptAuthDeviceSyncUnlockKeys);
|
||||
update_clear.Get()->Clear();
|
||||
update_clear.Get()->ClearList();
|
||||
|
||||
// Simulate a deprecated device being persisted to prefs.
|
||||
auto device_dictionary = std::make_unique<base::DictionaryValue>();
|
||||
|
@ -241,7 +241,7 @@ class DataReductionProxyCompressionStats::DailyContentLengthUpdate {
|
||||
} else if (days_since_last_update < -1) {
|
||||
// Erase all entries if the system went backwards in time by more than
|
||||
// a day.
|
||||
update_->Clear();
|
||||
update_->ClearList();
|
||||
|
||||
days_since_last_update = kNumDaysInHistory;
|
||||
}
|
||||
@ -464,8 +464,8 @@ void DataReductionProxyCompressionStats::ResetStatistics() {
|
||||
GetList(prefs::kDailyHttpOriginalContentLength);
|
||||
base::ListValue* received_update =
|
||||
GetList(prefs::kDailyHttpReceivedContentLength);
|
||||
original_update->Clear();
|
||||
received_update->Clear();
|
||||
original_update->ClearList();
|
||||
received_update->ClearList();
|
||||
for (size_t i = 0; i < kNumDaysInHistory; ++i) {
|
||||
original_update->AppendString(base::NumberToString(0));
|
||||
received_update->AppendString(base::NumberToString(0));
|
||||
@ -610,7 +610,7 @@ void DataReductionProxyCompressionStats::ClearDataSavingStatistics(
|
||||
|
||||
for (auto iter = list_pref_map_.begin(); iter != list_pref_map_.end();
|
||||
++iter) {
|
||||
iter->second->Clear();
|
||||
iter->second->ClearList();
|
||||
}
|
||||
|
||||
RecordSavingsClearedMetric(reason);
|
||||
|
@ -166,7 +166,7 @@ class DataReductionProxyCompressionStatsTest : public testing::Test {
|
||||
i, std::make_unique<base::Value>(base::NumberToString(i)));
|
||||
}
|
||||
|
||||
received_daily_content_length_list->Clear();
|
||||
received_daily_content_length_list->ClearList();
|
||||
for (size_t i = 0; i < kNumDaysInHistory / 2; ++i) {
|
||||
received_daily_content_length_list->AppendString(base::NumberToString(i));
|
||||
}
|
||||
|
@ -40,9 +40,9 @@ bool PrefServiceFlagsStorage::SetFlags(const std::set<std::string>& flags) {
|
||||
ListPrefUpdate update(prefs_, prefs::kAboutFlagsEntries);
|
||||
base::ListValue* experiments_list = update.Get();
|
||||
|
||||
experiments_list->Clear();
|
||||
for (auto it = flags.begin(); it != flags.end(); ++it) {
|
||||
experiments_list->AppendString(*it);
|
||||
experiments_list->ClearList();
|
||||
for (const auto& item : flags) {
|
||||
experiments_list->AppendString(item);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -334,7 +334,7 @@ void UnsentLogStore::TrimLogs() {
|
||||
}
|
||||
|
||||
void UnsentLogStore::WriteLogsToPrefList(base::ListValue* list_value) const {
|
||||
list_value->Clear();
|
||||
list_value->ClearList();
|
||||
|
||||
base::HistogramBase::Count unsent_samples_count = 0;
|
||||
size_t unsent_persisted_size = 0;
|
||||
|
@ -1099,7 +1099,7 @@ TEST_F(MutableProfileOAuth2TokenServiceDelegateTest, GaiaIdMigration) {
|
||||
AccountTrackerService::MIGRATION_NOT_STARTED);
|
||||
|
||||
ListPrefUpdate update(&pref_service_, prefs::kAccountInfo);
|
||||
update->Clear();
|
||||
update->ClearList();
|
||||
auto dict = std::make_unique<base::DictionaryValue>();
|
||||
dict->SetString("account_id", email);
|
||||
dict->SetString("email", email);
|
||||
@ -1162,7 +1162,7 @@ TEST_F(MutableProfileOAuth2TokenServiceDelegateTest,
|
||||
AccountTrackerService::MIGRATION_NOT_STARTED);
|
||||
|
||||
ListPrefUpdate update(&pref_service_, prefs::kAccountInfo);
|
||||
update->Clear();
|
||||
update->ClearList();
|
||||
auto dict = std::make_unique<base::DictionaryValue>();
|
||||
dict->SetString("account_id", email1);
|
||||
dict->SetString("email", email1);
|
||||
|
@ -361,7 +361,7 @@ TEST_F(PrimaryAccountManagerTest, GaiaIdMigration) {
|
||||
client_prefs->SetInteger(prefs::kAccountIdMigrationState,
|
||||
AccountTrackerService::MIGRATION_NOT_STARTED);
|
||||
ListPrefUpdate update(client_prefs, prefs::kAccountInfo);
|
||||
update->Clear();
|
||||
update->ClearList();
|
||||
auto dict = std::make_unique<base::DictionaryValue>();
|
||||
dict->SetString("account_id", email);
|
||||
dict->SetString("email", email);
|
||||
@ -394,7 +394,7 @@ TEST_F(PrimaryAccountManagerTest, GaiaIdMigrationCrashInTheMiddle) {
|
||||
client_prefs->SetInteger(prefs::kAccountIdMigrationState,
|
||||
AccountTrackerService::MIGRATION_NOT_STARTED);
|
||||
ListPrefUpdate update(client_prefs, prefs::kAccountInfo);
|
||||
update->Clear();
|
||||
update->ClearList();
|
||||
auto dict = std::make_unique<base::DictionaryValue>();
|
||||
dict->SetString("account_id", email);
|
||||
dict->SetString("email", email);
|
||||
@ -427,7 +427,7 @@ TEST_F(PrimaryAccountManagerTest, GaiaIdMigration_ForceAllAccounts) {
|
||||
client_prefs->SetInteger(prefs::kAccountIdMigrationState,
|
||||
AccountTrackerService::MIGRATION_NOT_STARTED);
|
||||
ListPrefUpdate update(client_prefs, prefs::kAccountInfo);
|
||||
update->Clear();
|
||||
update->ClearList();
|
||||
auto dict = std::make_unique<base::DictionaryValue>();
|
||||
dict->SetString("account_id", email);
|
||||
dict->SetString("email", email);
|
||||
|
@ -178,7 +178,7 @@ void SodaInstaller::RegisterLanguage(const std::string& language,
|
||||
|
||||
void SodaInstaller::UnregisterLanguages(PrefService* global_prefs) {
|
||||
ListPrefUpdate update(global_prefs, prefs::kSodaRegisteredLanguagePacks);
|
||||
update->Clear();
|
||||
update->ClearList();
|
||||
}
|
||||
|
||||
bool SodaInstaller::IsAnyFeatureUsingSodaEnabled(PrefService* prefs) {
|
||||
|
@ -1007,7 +1007,7 @@ User* UserManagerBase::RemoveRegularOrSupervisedUserFromList(
|
||||
const AccountId& account_id,
|
||||
bool notify) {
|
||||
ListPrefUpdate prefs_users_update(GetLocalState(), kRegularUsersPref);
|
||||
prefs_users_update->Clear();
|
||||
prefs_users_update->ClearList();
|
||||
User* user = nullptr;
|
||||
for (UserList::iterator it = users_.begin(); it != users_.end();) {
|
||||
if ((*it)->GetAccountId() == account_id) {
|
||||
|
@ -540,7 +540,7 @@ void MediaInternals::UpdateVideoCaptureDeviceCapabilities(
|
||||
media::VideoCaptureFormats>>&
|
||||
descriptors_and_formats) {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
||||
video_capture_capabilities_cached_data_.Clear();
|
||||
video_capture_capabilities_cached_data_.ClearList();
|
||||
|
||||
for (const auto& device_format_pair : descriptors_and_formats) {
|
||||
base::ListValue control_support;
|
||||
|
@ -26,27 +26,27 @@ TEST(WebUIMessageHandlerTest, ExtractIntegerValue) {
|
||||
list.AppendInteger(zero_value);
|
||||
EXPECT_TRUE(WebUIMessageHandler::ExtractIntegerValue(&list, &value));
|
||||
EXPECT_EQ(value, zero_value);
|
||||
list.Clear();
|
||||
list.ClearList();
|
||||
|
||||
list.AppendInteger(neg_value);
|
||||
EXPECT_TRUE(WebUIMessageHandler::ExtractIntegerValue(&list, &value));
|
||||
EXPECT_EQ(value, neg_value);
|
||||
list.Clear();
|
||||
list.ClearList();
|
||||
|
||||
list.AppendInteger(pos_value);
|
||||
EXPECT_TRUE(WebUIMessageHandler::ExtractIntegerValue(&list, &value));
|
||||
EXPECT_EQ(value, pos_value);
|
||||
list.Clear();
|
||||
list.ClearList();
|
||||
|
||||
list.AppendString(zero_string);
|
||||
EXPECT_TRUE(WebUIMessageHandler::ExtractIntegerValue(&list, &value));
|
||||
EXPECT_EQ(value, zero_value);
|
||||
list.Clear();
|
||||
list.ClearList();
|
||||
|
||||
list.AppendString(neg_string);
|
||||
EXPECT_TRUE(WebUIMessageHandler::ExtractIntegerValue(&list, &value));
|
||||
EXPECT_EQ(value, neg_value);
|
||||
list.Clear();
|
||||
list.ClearList();
|
||||
|
||||
list.AppendString(pos_string);
|
||||
EXPECT_TRUE(WebUIMessageHandler::ExtractIntegerValue(&list, &value));
|
||||
@ -66,27 +66,27 @@ TEST(WebUIMessageHandlerTest, ExtractDoubleValue) {
|
||||
list.Append(zero_value);
|
||||
EXPECT_TRUE(WebUIMessageHandler::ExtractDoubleValue(&list, &value));
|
||||
EXPECT_DOUBLE_EQ(value, zero_value);
|
||||
list.Clear();
|
||||
list.ClearList();
|
||||
|
||||
list.Append(neg_value);
|
||||
EXPECT_TRUE(WebUIMessageHandler::ExtractDoubleValue(&list, &value));
|
||||
EXPECT_DOUBLE_EQ(value, neg_value);
|
||||
list.Clear();
|
||||
list.ClearList();
|
||||
|
||||
list.Append(pos_value);
|
||||
EXPECT_TRUE(WebUIMessageHandler::ExtractDoubleValue(&list, &value));
|
||||
EXPECT_DOUBLE_EQ(value, pos_value);
|
||||
list.Clear();
|
||||
list.ClearList();
|
||||
|
||||
list.AppendString(zero_string);
|
||||
EXPECT_TRUE(WebUIMessageHandler::ExtractDoubleValue(&list, &value));
|
||||
EXPECT_DOUBLE_EQ(value, zero_value);
|
||||
list.Clear();
|
||||
list.ClearList();
|
||||
|
||||
list.AppendString(neg_string);
|
||||
EXPECT_TRUE(WebUIMessageHandler::ExtractDoubleValue(&list, &value));
|
||||
EXPECT_DOUBLE_EQ(value, neg_value);
|
||||
list.Clear();
|
||||
list.ClearList();
|
||||
|
||||
list.AppendString(pos_string);
|
||||
EXPECT_TRUE(WebUIMessageHandler::ExtractDoubleValue(&list, &value));
|
||||
|
@ -124,7 +124,7 @@ TEST(WebRequestConditionAttributeTest, ContentType) {
|
||||
EXPECT_FALSE(attribute_exclude->IsFulfilled(WebRequestData(
|
||||
&request_info, ON_HEADERS_RECEIVED, response_headers.get())));
|
||||
|
||||
content_types.Clear();
|
||||
content_types.ClearList();
|
||||
content_types.AppendString("something/invalid");
|
||||
scoped_refptr<const WebRequestConditionAttribute> attribute_unincluded =
|
||||
WebRequestConditionAttribute::Create(
|
||||
|
@ -2385,7 +2385,7 @@ void ExtensionPrefs::SetExtensionPrefFromContainer(
|
||||
const ExtensionIdContainer& strings) {
|
||||
ListPrefUpdate update(prefs_, pref);
|
||||
base::ListValue* list_of_values = update.Get();
|
||||
list_of_values->Clear();
|
||||
list_of_values->ClearList();
|
||||
for (auto iter = strings.cbegin(); iter != strings.cend(); ++iter) {
|
||||
list_of_values->AppendString(*iter);
|
||||
}
|
||||
|
@ -400,7 +400,7 @@ TEST_F(FileUtilTest, BackgroundScriptsMustExist) {
|
||||
error);
|
||||
EXPECT_EQ(0U, warnings.size());
|
||||
|
||||
scripts->Clear();
|
||||
scripts->ClearList();
|
||||
scripts->AppendString("http://google.com/foo.js");
|
||||
|
||||
extension = LoadExtensionManifest(*value, temp.GetPath(),
|
||||
|
@ -678,7 +678,7 @@ void HostCache::GetAsListValue(base::ListValue* entry_list,
|
||||
bool include_staleness,
|
||||
SerializationType serialization_type) const {
|
||||
DCHECK(entry_list);
|
||||
entry_list->Clear();
|
||||
entry_list->ClearList();
|
||||
|
||||
for (const auto& pair : entries_) {
|
||||
const Key& key = pair.first;
|
||||
|
@ -46,7 +46,7 @@ TEST(IdlCompiler, Basics) {
|
||||
EXPECT_EQ(5, f2_params->x);
|
||||
|
||||
// Test Function3, which takes a MyType1 parameter.
|
||||
list.Clear();
|
||||
list.ClearList();
|
||||
std::unique_ptr<base::DictionaryValue> tmp(new base::DictionaryValue());
|
||||
tmp->SetInteger("x", 17);
|
||||
tmp->SetString("y", "hello");
|
||||
@ -93,7 +93,7 @@ TEST(IdlCompiler, OptionalArguments) {
|
||||
|
||||
// Similar to above, but a function with one required and one optional
|
||||
// argument.
|
||||
list.Clear();
|
||||
list.ClearList();
|
||||
list.AppendInteger(8);
|
||||
std::unique_ptr<Function8::Params> f8_params =
|
||||
Function8::Params::Create(list);
|
||||
@ -105,11 +105,11 @@ TEST(IdlCompiler, OptionalArguments) {
|
||||
EXPECT_EQ("foo", *(f8_params->arg2));
|
||||
|
||||
// Test a function with an optional argument of custom type.
|
||||
list.Clear();
|
||||
list.ClearList();
|
||||
std::unique_ptr<Function9::Params> f9_params =
|
||||
Function9::Params::Create(list);
|
||||
EXPECT_EQ(NULL, f9_params->arg.get());
|
||||
list.Clear();
|
||||
list.ClearList();
|
||||
std::unique_ptr<base::DictionaryValue> tmp(new base::DictionaryValue());
|
||||
tmp->SetInteger("x", 17);
|
||||
tmp->SetString("y", "hello");
|
||||
@ -138,7 +138,7 @@ TEST(IdlCompiler, ArrayTypes) {
|
||||
EXPECT_TRUE(f10_params->y.empty());
|
||||
|
||||
// Same function, but this time with 2 values in the array.
|
||||
list.Clear();
|
||||
list.ClearList();
|
||||
list.AppendInteger(33);
|
||||
std::unique_ptr<base::ListValue> sublist(new base::ListValue);
|
||||
sublist->AppendInteger(34);
|
||||
@ -152,7 +152,7 @@ TEST(IdlCompiler, ArrayTypes) {
|
||||
EXPECT_EQ(35, f10_params->y[1]);
|
||||
|
||||
// Now test a function which takes an array of a defined type.
|
||||
list.Clear();
|
||||
list.ClearList();
|
||||
MyType1 a;
|
||||
MyType1 b;
|
||||
a.x = 5;
|
||||
|
@ -161,7 +161,7 @@ void AddItemToList(const T& from, base::ListValue* out) {
|
||||
// implemented for |T|.
|
||||
template <class T>
|
||||
void PopulateListFromArray(const std::vector<T>& from, base::ListValue* out) {
|
||||
out->Clear();
|
||||
out->ClearList();
|
||||
for (const T& item : from)
|
||||
AddItemToList(item, out);
|
||||
}
|
||||
|
Reference in New Issue
Block a user