[Code Health] Remove ListValue::GetSize in //components
This was an automated change done with a slightly modified copy of //tools/clang/value_cleanup. Bug: 1187064 Change-Id: Ia4cad3eb393798a00a39577411076f3e614c1bb9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3138835 Auto-Submit: Clark DuVall <cduvall@chromium.org> Commit-Queue: Colin Blundell <blundell@chromium.org> Reviewed-by: Colin Blundell <blundell@chromium.org> Cr-Commit-Position: refs/heads/main@{#917646}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
c8916d5ab0
commit
23192259d2
components
accuracy_tips
data_reduction_proxy
core
embedder_support
origin_trials
login
metrics
file_metrics_provider.ccmetrics_log_store_unittest.ccunsent_log_store.ccunsent_log_store_unittest.cc
net_log
ntp_snippets
category_rankers
ntp_tiles
omnibox
payments
content
utility
policy
core
safe_browsing
safe_search_api
safe_search
search_engines
signin
internal
identity_manager
spellcheck
browser
sync
base
protocol
test
fake_server
ukm
user_manager
variations
webcrypto
@ -160,7 +160,8 @@ void AccuracyService::MaybeShowAccuracyTip(content::WebContents* web_contents) {
|
||||
|
||||
bool show_opt_out =
|
||||
pref_service_->GetList(GetPreviousInteractionsPrefName(disable_ui_))
|
||||
->GetSize() >= static_cast<size_t>(features::kNumIgnorePrompts.Get());
|
||||
->GetList()
|
||||
.size() >= static_cast<size_t>(features::kNumIgnorePrompts.Get());
|
||||
|
||||
url_for_last_shown_tip_ = web_contents->GetLastCommittedURL();
|
||||
|
||||
@ -283,7 +284,8 @@ bool AccuracyService::CanShowSurvey() {
|
||||
|
||||
int interactions_count =
|
||||
pref_service_->GetList(GetPreviousInteractionsPrefName(disable_ui_))
|
||||
->GetSize();
|
||||
->GetList()
|
||||
.size();
|
||||
return interactions_count >= features::kMinPromptCountRequiredForSurvey.Get();
|
||||
}
|
||||
|
||||
|
@ -484,7 +484,7 @@ ContentLengthList DataReductionProxyCompressionStats::GetDailyContentLengths(
|
||||
const char* pref_name) {
|
||||
ContentLengthList content_lengths;
|
||||
const base::ListValue* list_value = GetList(pref_name);
|
||||
if (list_value->GetSize() == kNumDaysInHistory) {
|
||||
if (list_value->GetList().size() == kNumDaysInHistory) {
|
||||
for (size_t i = 0; i < kNumDaysInHistory; ++i)
|
||||
content_lengths.push_back(GetInt64PrefValue(*list_value, i));
|
||||
}
|
||||
@ -503,8 +503,8 @@ void DataReductionProxyCompressionStats::GetContentLengths(
|
||||
const base::ListValue* received_list =
|
||||
GetList(prefs::kDailyHttpReceivedContentLength);
|
||||
|
||||
if (original_list->GetSize() != kNumDaysInHistory ||
|
||||
received_list->GetSize() != kNumDaysInHistory) {
|
||||
if (original_list->GetList().size() != kNumDaysInHistory ||
|
||||
received_list->GetList().size() != kNumDaysInHistory) {
|
||||
*original_content_length = 0L;
|
||||
*received_content_length = 0L;
|
||||
*last_update_time = 0L;
|
||||
|
@ -186,8 +186,8 @@ class DataReductionProxyCompressionStatsTest : public testing::Test {
|
||||
void VerifyPrefListWasWritten(const char* pref) {
|
||||
const base::ListValue* delayed_list = compression_stats_->GetList(pref);
|
||||
const base::ListValue* written_list = pref_service()->GetList(pref);
|
||||
ASSERT_EQ(delayed_list->GetSize(), written_list->GetSize());
|
||||
size_t count = delayed_list->GetSize();
|
||||
ASSERT_EQ(delayed_list->GetList().size(), written_list->GetList().size());
|
||||
size_t count = delayed_list->GetList().size();
|
||||
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
EXPECT_EQ(GetListPrefInt64Value(*delayed_list, i),
|
||||
@ -231,7 +231,8 @@ class DataReductionProxyCompressionStatsTest : public testing::Test {
|
||||
size_t num_days_in_history) {
|
||||
ASSERT_GE(num_days_in_history, count);
|
||||
base::ListValue* update = compression_stats_->GetList(pref);
|
||||
ASSERT_EQ(num_days_in_history, update->GetSize()) << "Pref: " << pref;
|
||||
ASSERT_EQ(num_days_in_history, update->GetList().size())
|
||||
<< "Pref: " << pref;
|
||||
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
EXPECT_EQ(values[i],
|
||||
|
@ -96,7 +96,7 @@ class OriginTrialsComponentInstallerTest : public PlatformTest {
|
||||
embedder_support::prefs::kOriginTrialDisabledFeatures);
|
||||
ASSERT_TRUE(disabled_feature_list);
|
||||
|
||||
ASSERT_EQ(features.size(), disabled_feature_list->GetSize());
|
||||
ASSERT_EQ(features.size(), disabled_feature_list->GetList().size());
|
||||
|
||||
std::string disabled_feature;
|
||||
for (size_t i = 0; i < features.size(); ++i) {
|
||||
@ -130,7 +130,7 @@ class OriginTrialsComponentInstallerTest : public PlatformTest {
|
||||
embedder_support::prefs::kOriginTrialDisabledTokens);
|
||||
ASSERT_TRUE(disabled_token_list);
|
||||
|
||||
ASSERT_EQ(tokens.size(), disabled_token_list->GetSize());
|
||||
ASSERT_EQ(tokens.size(), disabled_token_list->GetList().size());
|
||||
|
||||
std::string disabled_token;
|
||||
for (size_t i = 0; i < tokens.size(); ++i) {
|
||||
|
@ -16,8 +16,8 @@ bool ParseStringList(const base::Value* value, StringListType* out_value) {
|
||||
const base::ListValue* list = nullptr;
|
||||
if (!value->GetAsList(&list))
|
||||
return false;
|
||||
out_value->resize(list->GetSize());
|
||||
for (size_t i = 0; i < list->GetSize(); ++i) {
|
||||
out_value->resize(list->GetList().size());
|
||||
for (size_t i = 0; i < list->GetList().size(); ++i) {
|
||||
if (!list->GetString(i, &((*out_value)[i])))
|
||||
return false;
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ inline void DispatchToCallback(
|
||||
const base::ListValue* args,
|
||||
std::index_sequence<Ns...> indexes) {
|
||||
DCHECK(args);
|
||||
DCHECK_EQ(sizeof...(Args), args->GetSize());
|
||||
DCHECK_EQ(sizeof...(Args), args->GetList().size());
|
||||
|
||||
callback.Run(ParseArg<Args, Ns>(args)...);
|
||||
}
|
||||
|
@ -943,7 +943,7 @@ bool FileMetricsProvider::SimulateIndependentMetrics() {
|
||||
mutable_list[0].GetInt() + count);
|
||||
pref_service_->SetInteger(
|
||||
metrics::prefs::kStabilityFileMetricsUnsentFilesCount,
|
||||
list_value->GetSize() - 1);
|
||||
list_value->GetList().size() - 1);
|
||||
list_value->EraseListIter(mutable_list.begin());
|
||||
|
||||
return true;
|
||||
|
@ -55,7 +55,7 @@ class MetricsLogStoreTest : public testing::Test {
|
||||
const char* pref = log_type == MetricsLog::INITIAL_STABILITY_LOG
|
||||
? prefs::kMetricsInitialLogs
|
||||
: prefs::kMetricsOngoingLogs;
|
||||
return pref_service_.GetList(pref)->GetSize();
|
||||
return pref_service_.GetList(pref)->GetList().size();
|
||||
}
|
||||
|
||||
TestMetricsServiceClient client_;
|
||||
|
@ -243,7 +243,7 @@ void UnsentLogStore::ReadLogsFromPrefList(const base::ListValue& list_value) {
|
||||
return;
|
||||
}
|
||||
|
||||
const size_t log_count = list_value.GetSize();
|
||||
const size_t log_count = list_value.GetList().size();
|
||||
|
||||
DCHECK(list_.empty());
|
||||
list_.resize(log_count);
|
||||
|
@ -140,7 +140,7 @@ TEST_F(UnsentLogStoreTest, EmptyLogList) {
|
||||
|
||||
unsent_log_store.TrimAndPersistUnsentLogs();
|
||||
const base::ListValue* list_value = prefs_.GetList(kTestPrefName);
|
||||
EXPECT_EQ(0U, list_value->GetSize());
|
||||
EXPECT_EQ(0U, list_value->GetList().size());
|
||||
|
||||
TestUnsentLogStore result_unsent_log_store(&prefs_, kLogByteLimit);
|
||||
result_unsent_log_store.LoadPersistedUnsentLogs();
|
||||
|
@ -802,7 +802,7 @@ TEST_F(NetExportFileWriterTest, StartWithNetworkContextActive) {
|
||||
ASSERT_TRUE(root->GetList("events", &events));
|
||||
|
||||
// Check there is at least one event as a result of the ongoing request.
|
||||
ASSERT_GE(events->GetSize(), 1u);
|
||||
ASSERT_GE(events->GetList().size(), 1u);
|
||||
|
||||
// Check the URL in the params of the first event.
|
||||
base::DictionaryValue* event;
|
||||
|
@ -349,7 +349,7 @@ bool ClickBasedCategoryRanker::ReadOrderFromPrefs(
|
||||
result_categories->clear();
|
||||
const base::ListValue* list =
|
||||
pref_service_->GetList(prefs::kClickBasedCategoryRankerOrderWithClicks);
|
||||
if (!list || list->GetSize() == 0) {
|
||||
if (!list || list->GetList().size() == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@ std::string GetVariationDirectory() {
|
||||
|
||||
PopularSites::SitesVector ParseSiteList(const base::ListValue& list) {
|
||||
PopularSites::SitesVector sites;
|
||||
for (size_t i = 0; i < list.GetSize(); i++) {
|
||||
for (size_t i = 0; i < list.GetList().size(); i++) {
|
||||
const base::DictionaryValue* item;
|
||||
if (!list.GetDictionary(i, &item))
|
||||
continue;
|
||||
@ -159,7 +159,7 @@ std::map<SectionType, PopularSites::SitesVector> ParseVersion6OrAbove(
|
||||
// Valid lists would have contained at least the PERSONALIZED section.
|
||||
std::map<SectionType, PopularSites::SitesVector> sections = {
|
||||
std::make_pair(SectionType::PERSONALIZED, PopularSites::SitesVector{})};
|
||||
for (size_t i = 0; i < list.GetSize(); i++) {
|
||||
for (size_t i = 0; i < list.GetList().size(); i++) {
|
||||
const base::DictionaryValue* item;
|
||||
if (!list.GetDictionary(i, &item)) {
|
||||
LOG(WARNING) << "Parsed SitesExploration list contained an invalid "
|
||||
|
@ -98,7 +98,7 @@ void NTPTilesInternalsMessageHandler::HandleRegisterForEvents(
|
||||
SendTiles(NTPTilesVector(), FaviconResultMap());
|
||||
return;
|
||||
}
|
||||
DCHECK_EQ(0u, args->GetSize());
|
||||
DCHECK_EQ(0u, args->GetList().size());
|
||||
|
||||
popular_sites_json_.clear();
|
||||
most_visited_sites_ = client_->MakeMostVisitedSites();
|
||||
@ -113,7 +113,7 @@ void NTPTilesInternalsMessageHandler::HandleUpdate(
|
||||
}
|
||||
|
||||
const base::Value* dict = nullptr;
|
||||
DCHECK_EQ(1u, args->GetSize());
|
||||
DCHECK_EQ(1u, args->GetList().size());
|
||||
args->Get(0, &dict);
|
||||
DCHECK(dict && dict->is_dict());
|
||||
|
||||
@ -169,7 +169,7 @@ void NTPTilesInternalsMessageHandler::HandleUpdate(
|
||||
|
||||
void NTPTilesInternalsMessageHandler::HandleViewPopularSitesJson(
|
||||
const base::ListValue* args) {
|
||||
DCHECK_EQ(0u, args->GetSize());
|
||||
DCHECK_EQ(0u, args->GetList().size());
|
||||
if (!most_visited_sites_ ||
|
||||
!most_visited_sites_->DoesSourceExist(ntp_tiles::TileSource::POPULAR)) {
|
||||
return;
|
||||
|
@ -697,7 +697,7 @@ ACMatches DocumentProvider::ParseDocumentSearchResults(
|
||||
if (!root_dict->GetList("results", &results_list)) {
|
||||
return matches;
|
||||
}
|
||||
size_t num_results = results_list->GetSize();
|
||||
size_t num_results = results_list->GetList().size();
|
||||
UMA_HISTOGRAM_COUNTS_1M("Omnibox.DocumentSuggest.ResultCount", num_results);
|
||||
|
||||
// During development/quality iteration we may wish to defeat server scores.
|
||||
|
@ -506,7 +506,8 @@ bool SearchSuggestionParser::ParseSuggestResults(
|
||||
results->experiment_stats.clear();
|
||||
if (extras->GetList("google:experimentstats", &experiment_stats) &&
|
||||
experiment_stats) {
|
||||
for (size_t index = 0; index < experiment_stats->GetSize(); index++) {
|
||||
for (size_t index = 0; index < experiment_stats->GetList().size();
|
||||
index++) {
|
||||
const base::Value* experiment_stat = nullptr;
|
||||
if (experiment_stats->Get(index, &experiment_stat) && experiment_stat) {
|
||||
results->experiment_stats.push_back(experiment_stat->Clone());
|
||||
@ -541,7 +542,7 @@ bool SearchSuggestionParser::ParseSuggestResults(
|
||||
client_data->GetInteger("phi", &prefetch_index);
|
||||
|
||||
if (extras->GetList("google:suggestdetail", &suggestion_details) &&
|
||||
suggestion_details->GetSize() != results_list.size())
|
||||
suggestion_details->GetList().size() != results_list.size())
|
||||
suggestion_details = nullptr;
|
||||
|
||||
// Legacy code: Get subtype identifiers.
|
||||
|
@ -86,7 +86,7 @@ bool ParseDefaultApplications(const GURL& manifest_url,
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t apps_number = list->GetSize();
|
||||
size_t apps_number = list->GetList().size();
|
||||
if (apps_number > kMaximumNumberOfItems) {
|
||||
log.Error(base::StringPrintf("\"%s\" must contain at most %zu entries.",
|
||||
kDefaultApplications, kMaximumNumberOfItems));
|
||||
@ -140,7 +140,7 @@ bool ParseSupportedOrigins(base::DictionaryValue* dict,
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t supported_origins_number = list->GetSize();
|
||||
size_t supported_origins_number = list->GetList().size();
|
||||
if (supported_origins_number > kMaximumNumberOfSupportedOrigins) {
|
||||
log.Error(base::StringPrintf("\"%s\" must contain at most %zu entires.",
|
||||
kSupportedOrigins,
|
||||
@ -270,7 +270,7 @@ void ParsePreferredRelatedApplicationIdentifiers(
|
||||
return;
|
||||
}
|
||||
|
||||
size_t size = related_applications->GetSize();
|
||||
size_t size = related_applications->GetList().size();
|
||||
if (size == 0) {
|
||||
log.Warn(base::StringPrintf(
|
||||
"Did not find any entries in \"%s\", even though \"%s\" is true.",
|
||||
@ -413,7 +413,7 @@ bool PaymentManifestParser::ParseWebAppManifestIntoVector(
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t related_applications_size = list->GetSize();
|
||||
size_t related_applications_size = list->GetList().size();
|
||||
for (size_t i = 0; i < related_applications_size; ++i) {
|
||||
base::DictionaryValue* related_application = nullptr;
|
||||
if (!list->GetDictionary(i, &related_application) || !related_application) {
|
||||
@ -472,7 +472,7 @@ bool PaymentManifestParser::ParseWebAppManifestIntoVector(
|
||||
base::ListValue* fingerprints_list = nullptr;
|
||||
if (!related_application->GetList(kFingerprints, &fingerprints_list) ||
|
||||
fingerprints_list->GetList().empty() ||
|
||||
fingerprints_list->GetSize() > kMaximumNumberOfItems) {
|
||||
fingerprints_list->GetList().size() > kMaximumNumberOfItems) {
|
||||
log.Error(base::StringPrintf(
|
||||
"\"%s\" must be a non-empty list of at most %zu items.",
|
||||
kFingerprints, kMaximumNumberOfItems));
|
||||
@ -480,7 +480,7 @@ bool PaymentManifestParser::ParseWebAppManifestIntoVector(
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t fingerprints_size = fingerprints_list->GetSize();
|
||||
size_t fingerprints_size = fingerprints_list->GetList().size();
|
||||
for (size_t j = 0; j < fingerprints_size; ++j) {
|
||||
base::DictionaryValue* fingerprint_dict = nullptr;
|
||||
std::string fingerprint_type;
|
||||
@ -575,7 +575,8 @@ bool PaymentManifestParser::ParseWebAppInstallationInfoIntoStructs(
|
||||
const base::ListValue* delegation_list = nullptr;
|
||||
if (payment_dict->GetList(kSupportedDelegations, &delegation_list)) {
|
||||
if (delegation_list->GetList().empty() ||
|
||||
delegation_list->GetSize() > kMaximumNumberOfSupportedDelegations) {
|
||||
delegation_list->GetList().size() >
|
||||
kMaximumNumberOfSupportedDelegations) {
|
||||
log.Error(base::StringPrintf(
|
||||
"\"%s.%s\" must be a non-empty list of at most %zu entries.",
|
||||
kPayment, kSupportedDelegations,
|
||||
|
@ -400,7 +400,7 @@ POLICY_EXPORT void AddFilters(URLMatcher* matcher,
|
||||
std::map<url_matcher::URLMatcherConditionSet::ID,
|
||||
url_util::FilterComponents>* filters) {
|
||||
URLMatcherConditionSet::Vector all_conditions;
|
||||
size_t size = std::min(kMaxFiltersPerPolicy, patterns->GetSize());
|
||||
size_t size = std::min(kMaxFiltersPerPolicy, patterns->GetList().size());
|
||||
std::string pattern;
|
||||
scoped_refptr<URLMatcherConditionSet> condition_set;
|
||||
for (size_t i = 0; i < size; ++i) {
|
||||
|
@ -42,7 +42,7 @@ TEST(PolicyMacUtilTest, PropertyToValue) {
|
||||
base::ListValue list;
|
||||
for (base::DictionaryValue::Iterator it(root); !it.IsAtEnd(); it.Advance())
|
||||
list.Append(std::make_unique<base::Value>(it.value().Clone()));
|
||||
EXPECT_EQ(root.DictSize(), list.GetSize());
|
||||
EXPECT_EQ(root.DictSize(), list.GetList().size());
|
||||
list.Append(std::make_unique<base::Value>(root.Clone()));
|
||||
root.SetKey("list", list.Clone());
|
||||
|
||||
|
@ -149,7 +149,7 @@ UmaRemoteCallResult ParseJsonFromGMSCore(const std::string& metadata_str,
|
||||
// Go through each matched threat type and pick the most severe.
|
||||
JavaThreatTypes worst_threat_type = JAVA_THREAT_TYPE_MAX_VALUE;
|
||||
const base::DictionaryValue* worst_match = nullptr;
|
||||
for (size_t i = 0; i < matches->GetSize(); i++) {
|
||||
for (size_t i = 0; i < matches->GetList().size(); i++) {
|
||||
// Get the threat number
|
||||
const base::DictionaryValue* match;
|
||||
std::string threat_num_str;
|
||||
|
@ -52,7 +52,7 @@ bool ParseResponse(const std::string& response, bool* is_porn) {
|
||||
DLOG(WARNING) << "ParseResponse failed to parse classifications list";
|
||||
return false;
|
||||
}
|
||||
if (classifications_list->GetSize() != 1) {
|
||||
if (classifications_list->GetList().size() != 1) {
|
||||
DLOG(WARNING) << "ParseResponse expected exactly one result";
|
||||
return false;
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ TemplateURLData::TemplateURLData(const std::u16string& name,
|
||||
SetKeyword(keyword);
|
||||
SetURL(std::string(search_url));
|
||||
input_encodings.push_back(std::string(encoding));
|
||||
for (size_t i = 0; i < alternate_urls_list.GetSize(); ++i) {
|
||||
for (size_t i = 0; i < alternate_urls_list.GetList().size(); ++i) {
|
||||
std::string alternate_url;
|
||||
alternate_urls_list.GetString(i, &alternate_url);
|
||||
DCHECK(!alternate_url.empty());
|
||||
|
@ -1338,7 +1338,7 @@ std::vector<std::unique_ptr<TemplateURLData>> GetPrepopulatedTemplateURLData(
|
||||
if (!list)
|
||||
return t_urls;
|
||||
|
||||
size_t num_engines = list->GetSize();
|
||||
size_t num_engines = list->GetList().size();
|
||||
for (size_t i = 0; i != num_engines; ++i) {
|
||||
const base::DictionaryValue* engine;
|
||||
if (list->GetDictionary(i, &engine)) {
|
||||
|
@ -524,7 +524,7 @@ void AccountTrackerService::OnAccountImageUpdated(
|
||||
|
||||
base::DictionaryValue* dict = nullptr;
|
||||
ListPrefUpdate update(pref_service_, prefs::kAccountInfo);
|
||||
for (size_t i = 0; i < update->GetSize(); ++i, dict = nullptr) {
|
||||
for (size_t i = 0; i < update->GetList().size(); ++i, dict = nullptr) {
|
||||
if (update->GetDictionary(i, &dict)) {
|
||||
std::string value;
|
||||
if (dict->GetString(kAccountKeyPath, &value) &&
|
||||
@ -550,7 +550,7 @@ void AccountTrackerService::RemoveAccountImageFromDisk(
|
||||
void AccountTrackerService::LoadFromPrefs() {
|
||||
const base::ListValue* list = pref_service_->GetList(prefs::kAccountInfo);
|
||||
std::set<CoreAccountId> to_remove;
|
||||
for (size_t i = 0; i < list->GetSize(); ++i) {
|
||||
for (size_t i = 0; i < list->GetList().size(); ++i) {
|
||||
const base::DictionaryValue* dict = nullptr;
|
||||
if (list->GetDictionary(i, &dict)) {
|
||||
std::string value;
|
||||
@ -659,7 +659,7 @@ void AccountTrackerService::SaveToPrefs(const AccountInfo& account_info) {
|
||||
|
||||
base::DictionaryValue* dict = nullptr;
|
||||
ListPrefUpdate update(pref_service_, prefs::kAccountInfo);
|
||||
for (size_t i = 0; i < update->GetSize(); ++i, dict = nullptr) {
|
||||
for (size_t i = 0; i < update->GetList().size(); ++i, dict = nullptr) {
|
||||
if (update->GetDictionary(i, &dict)) {
|
||||
std::string value;
|
||||
if (dict->GetString(kAccountKeyPath, &value) &&
|
||||
@ -672,7 +672,7 @@ void AccountTrackerService::SaveToPrefs(const AccountInfo& account_info) {
|
||||
dict = new base::DictionaryValue();
|
||||
update->Append(base::WrapUnique(dict));
|
||||
// |dict| is invalidated at this point, so it needs to be reset.
|
||||
update->GetDictionary(update->GetSize() - 1, &dict);
|
||||
update->GetDictionary(update->GetList().size() - 1, &dict);
|
||||
dict->SetString(kAccountKeyPath, account_info.account_id.ToString());
|
||||
}
|
||||
|
||||
|
@ -264,7 +264,7 @@ bool SpellingServiceClient::ParseResponse(
|
||||
if (!value->GetList(kMisspellingsRestPath, &misspellings))
|
||||
return true;
|
||||
|
||||
for (size_t i = 0; i < misspellings->GetSize(); ++i) {
|
||||
for (size_t i = 0; i < misspellings->GetList().size(); ++i) {
|
||||
// Retrieve the i-th misspelling region and put it to the given vector. When
|
||||
// the Spelling service sends two or more suggestions, we read only the
|
||||
// first one because SpellCheckResult can store only one suggestion.
|
||||
|
@ -30,7 +30,7 @@ TEST_F(ModelTypeTest, ModelTypeSetToValue) {
|
||||
const ModelTypeSet model_types(BOOKMARKS, APPS);
|
||||
|
||||
std::unique_ptr<base::ListValue> value(ModelTypeSetToValue(model_types));
|
||||
EXPECT_EQ(2u, value->GetSize());
|
||||
EXPECT_EQ(2u, value->GetList().size());
|
||||
std::string types[2];
|
||||
EXPECT_TRUE(value->GetString(0, &types[0]));
|
||||
EXPECT_TRUE(value->GetString(1, &types[1]));
|
||||
|
@ -168,7 +168,7 @@ TEST(ProtoValueConversionsTest, BookmarkSpecificsData) {
|
||||
EXPECT_EQ(icon_url, encoded_icon_url);
|
||||
base::ListValue* meta_info_list;
|
||||
ASSERT_TRUE(value->GetList("meta_info", &meta_info_list));
|
||||
EXPECT_EQ(2u, meta_info_list->GetSize());
|
||||
EXPECT_EQ(2u, meta_info_list->GetList().size());
|
||||
base::DictionaryValue* meta_info;
|
||||
std::string meta_key;
|
||||
std::string meta_value;
|
||||
|
@ -80,8 +80,8 @@ AssertionResult FakeServerVerifier::VerifyEntityCountByType(
|
||||
base::ListValue* entity_list = nullptr;
|
||||
if (!entities->GetList(model_type_string, &entity_list)) {
|
||||
return UnknownTypeAssertionFailure(model_type_string);
|
||||
} else if (expected_count != entity_list->GetSize()) {
|
||||
return VerificationCountAssertionFailure(entity_list->GetSize(),
|
||||
} else if (expected_count != entity_list->GetList().size()) {
|
||||
return VerificationCountAssertionFailure(entity_list->GetList().size(),
|
||||
expected_count)
|
||||
<< "\n\n"
|
||||
<< ConvertFakeServerContentsToString(*entities);
|
||||
|
@ -141,7 +141,7 @@ class UkmServiceTest : public testing::Test {
|
||||
int GetPersistedLogCount() {
|
||||
const base::ListValue* list_value =
|
||||
prefs_.GetList(prefs::kUkmUnsentLogStore);
|
||||
return list_value->GetSize();
|
||||
return list_value->GetList().size();
|
||||
}
|
||||
|
||||
Report GetPersistedReport() {
|
||||
|
@ -223,7 +223,7 @@ bool KnownUser::FindPrefs(const AccountId& account_id,
|
||||
return false;
|
||||
|
||||
const base::ListValue* known_users = local_state_->GetList(kKnownUsers);
|
||||
for (size_t i = 0; i < known_users->GetSize(); ++i) {
|
||||
for (size_t i = 0; i < known_users->GetList().size(); ++i) {
|
||||
const base::DictionaryValue* element = nullptr;
|
||||
if (known_users->GetDictionary(i, &element)) {
|
||||
if (UserMatches(account_id, *element)) {
|
||||
@ -249,7 +249,7 @@ void KnownUser::UpdatePrefs(const AccountId& account_id,
|
||||
return;
|
||||
|
||||
ListPrefUpdate update(local_state_, kKnownUsers);
|
||||
for (size_t i = 0; i < update->GetSize(); ++i) {
|
||||
for (size_t i = 0; i < update->GetList().size(); ++i) {
|
||||
base::DictionaryValue* element = nullptr;
|
||||
if (update->GetDictionary(i, &element)) {
|
||||
if (UserMatches(account_id, *element)) {
|
||||
@ -425,7 +425,7 @@ std::vector<AccountId> KnownUser::GetKnownAccountIds() {
|
||||
std::vector<AccountId> result;
|
||||
|
||||
const base::ListValue* known_users = local_state_->GetList(kKnownUsers);
|
||||
for (size_t i = 0; i < known_users->GetSize(); ++i) {
|
||||
for (size_t i = 0; i < known_users->GetList().size(); ++i) {
|
||||
const base::DictionaryValue* element = nullptr;
|
||||
if (known_users->GetDictionary(i, &element)) {
|
||||
std::string email;
|
||||
|
@ -514,7 +514,7 @@ void UserManagerBase::ParseUserList(const base::ListValue& users_list,
|
||||
std::set<AccountId>* users_set) {
|
||||
users_vector->clear();
|
||||
users_set->clear();
|
||||
for (size_t i = 0; i < users_list.GetSize(); ++i) {
|
||||
for (size_t i = 0; i < users_list.GetList().size(); ++i) {
|
||||
std::string email;
|
||||
if (!users_list.GetString(i, &email) || email.empty()) {
|
||||
LOG(ERROR) << "Corrupt entry in user list at index " << i << ".";
|
||||
@ -864,7 +864,7 @@ const User* UserManagerBase::FindUserInList(const AccountId& account_id) const {
|
||||
bool UserManagerBase::UserExistsInList(const AccountId& account_id) const {
|
||||
const base::ListValue* user_list =
|
||||
GetLocalState()->GetList(kRegularUsersPref);
|
||||
for (size_t i = 0; i < user_list->GetSize(); ++i) {
|
||||
for (size_t i = 0; i < user_list->GetList().size(); ++i) {
|
||||
std::string email;
|
||||
if (user_list->GetString(i, &email) && (account_id.GetUserEmail() == email))
|
||||
return true;
|
||||
|
@ -354,7 +354,7 @@ std::string VariationsFieldTrialCreator::LoadPermanentConsistencyCountry(
|
||||
|
||||
// Determine if the saved pref value is present and valid.
|
||||
const bool is_pref_empty = list_value->GetList().empty();
|
||||
const bool is_pref_valid = list_value->GetSize() == 2 &&
|
||||
const bool is_pref_valid = list_value->GetList().size() == 2 &&
|
||||
list_value->GetString(0, &stored_version_string) &&
|
||||
list_value->GetString(1, &stored_country) &&
|
||||
base::Version(stored_version_string).IsValid();
|
||||
|
@ -1016,7 +1016,7 @@ std::string VariationsService::GetStoredPermanentCountry() {
|
||||
local_state_->GetList(prefs::kVariationsPermanentConsistencyCountry);
|
||||
std::string stored_country;
|
||||
|
||||
if (list_value->GetSize() == 2) {
|
||||
if (list_value->GetList().size() == 2) {
|
||||
list_value->GetString(1, &stored_country);
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,8 @@ TEST_F(WebCryptoAesCbcTest, KnownAnswerEncryptDecrypt) {
|
||||
base::ListValue tests;
|
||||
ASSERT_TRUE(ReadJsonTestFileToList("aes_cbc.json", &tests));
|
||||
|
||||
for (size_t test_index = 0; test_index < tests.GetSize(); ++test_index) {
|
||||
for (size_t test_index = 0; test_index < tests.GetList().size();
|
||||
++test_index) {
|
||||
SCOPED_TRACE(test_index);
|
||||
base::DictionaryValue* test;
|
||||
ASSERT_TRUE(tests.GetDictionary(test_index, &test));
|
||||
|
@ -33,7 +33,8 @@ TEST_F(WebCryptoAesCtrTest, EncryptDecryptKnownAnswer) {
|
||||
base::ListValue tests;
|
||||
ASSERT_TRUE(ReadJsonTestFileToList("aes_ctr.json", &tests));
|
||||
|
||||
for (size_t test_index = 0; test_index < tests.GetSize(); ++test_index) {
|
||||
for (size_t test_index = 0; test_index < tests.GetList().size();
|
||||
++test_index) {
|
||||
SCOPED_TRACE(test_index);
|
||||
base::DictionaryValue* test;
|
||||
ASSERT_TRUE(tests.GetDictionary(test_index, &test));
|
||||
|
@ -137,7 +137,8 @@ TEST_F(WebCryptoAesGcmTest, SampleSets) {
|
||||
ASSERT_TRUE(ReadJsonTestFileToList("aes_gcm.json", &tests));
|
||||
|
||||
// Note that WebCrypto appends the authentication tag to the ciphertext.
|
||||
for (size_t test_index = 0; test_index < tests.GetSize(); ++test_index) {
|
||||
for (size_t test_index = 0; test_index < tests.GetList().size();
|
||||
++test_index) {
|
||||
SCOPED_TRACE(test_index);
|
||||
base::DictionaryValue* test;
|
||||
ASSERT_TRUE(tests.GetDictionary(test_index, &test));
|
||||
|
@ -189,7 +189,8 @@ TEST_F(WebCryptoAesKwTest, AesKwRawSymkeyWrapUnwrapKnownAnswer) {
|
||||
base::ListValue tests;
|
||||
ASSERT_TRUE(ReadJsonTestFileToList("aes_kw.json", &tests));
|
||||
|
||||
for (size_t test_index = 0; test_index < tests.GetSize(); ++test_index) {
|
||||
for (size_t test_index = 0; test_index < tests.GetList().size();
|
||||
++test_index) {
|
||||
SCOPED_TRACE(test_index);
|
||||
base::DictionaryValue* test;
|
||||
ASSERT_TRUE(tests.GetDictionary(test_index, &test));
|
||||
|
@ -78,7 +78,8 @@ TEST_F(WebCryptoEcdhTest, DeriveBitsKnownAnswer) {
|
||||
base::ListValue tests;
|
||||
ASSERT_TRUE(ReadJsonTestFileToList("ecdh.json", &tests));
|
||||
|
||||
for (size_t test_index = 0; test_index < tests.GetSize(); ++test_index) {
|
||||
for (size_t test_index = 0; test_index < tests.GetList().size();
|
||||
++test_index) {
|
||||
SCOPED_TRACE(test_index);
|
||||
|
||||
const base::DictionaryValue* test;
|
||||
@ -123,7 +124,8 @@ TEST_F(WebCryptoEcdhTest, DeriveBitsKnownAnswer) {
|
||||
|
||||
const base::DictionaryValue* test = nullptr;
|
||||
bool valid_p521_keys = false;
|
||||
for (size_t test_index = 0; test_index < tests.GetSize(); ++test_index) {
|
||||
for (size_t test_index = 0; test_index < tests.GetList().size();
|
||||
++test_index) {
|
||||
SCOPED_TRACE(test_index);
|
||||
EXPECT_TRUE(tests.GetDictionary(test_index, &test));
|
||||
absl::optional<bool> keys = test->FindBoolKey("valid_p521_keys");
|
||||
|
@ -154,7 +154,8 @@ TEST_F(WebCryptoEcdsaTest, VerifyKnownAnswer) {
|
||||
base::ListValue tests;
|
||||
ASSERT_TRUE(ReadJsonTestFileToList("ecdsa.json", &tests));
|
||||
|
||||
for (size_t test_index = 0; test_index < tests.GetSize(); ++test_index) {
|
||||
for (size_t test_index = 0; test_index < tests.GetList().size();
|
||||
++test_index) {
|
||||
SCOPED_TRACE(test_index);
|
||||
|
||||
const base::DictionaryValue* test;
|
||||
@ -235,7 +236,8 @@ TEST_F(WebCryptoEcdsaTest, ImportBadKeys) {
|
||||
base::ListValue tests;
|
||||
ASSERT_TRUE(ReadJsonTestFileToList("bad_ec_keys.json", &tests));
|
||||
|
||||
for (size_t test_index = 0; test_index < tests.GetSize(); ++test_index) {
|
||||
for (size_t test_index = 0; test_index < tests.GetList().size();
|
||||
++test_index) {
|
||||
SCOPED_TRACE(test_index);
|
||||
|
||||
const base::DictionaryValue* test;
|
||||
@ -265,7 +267,8 @@ TEST_F(WebCryptoEcdsaTest, ImportExportPrivateKey) {
|
||||
base::ListValue tests;
|
||||
ASSERT_TRUE(ReadJsonTestFileToList("ec_private_keys.json", &tests));
|
||||
|
||||
for (size_t test_index = 0; test_index < tests.GetSize(); ++test_index) {
|
||||
for (size_t test_index = 0; test_index < tests.GetList().size();
|
||||
++test_index) {
|
||||
SCOPED_TRACE(test_index);
|
||||
|
||||
const base::DictionaryValue* test;
|
||||
|
@ -52,7 +52,8 @@ class WebCryptoHmacTest : public WebCryptoTestBase {};
|
||||
TEST_F(WebCryptoHmacTest, HMACSampleSets) {
|
||||
base::ListValue tests;
|
||||
ASSERT_TRUE(ReadJsonTestFileToList("hmac.json", &tests));
|
||||
for (size_t test_index = 0; test_index < tests.GetSize(); ++test_index) {
|
||||
for (size_t test_index = 0; test_index < tests.GetList().size();
|
||||
++test_index) {
|
||||
SCOPED_TRACE(test_index);
|
||||
base::DictionaryValue* test;
|
||||
ASSERT_TRUE(tests.GetDictionary(test_index, &test));
|
||||
|
@ -158,7 +158,8 @@ TEST_F(WebCryptoRsaOaepTest, EncryptDecryptKnownAnswerTest) {
|
||||
base::ListValue tests;
|
||||
ASSERT_TRUE(ReadJsonTestFileToList("rsa_oaep.json", &tests));
|
||||
|
||||
for (size_t test_index = 0; test_index < tests.GetSize(); ++test_index) {
|
||||
for (size_t test_index = 0; test_index < tests.GetList().size();
|
||||
++test_index) {
|
||||
SCOPED_TRACE(test_index);
|
||||
|
||||
base::DictionaryValue* test = nullptr;
|
||||
|
@ -175,7 +175,8 @@ TEST_F(WebCryptoRsaPssTest, VerifyKnownAnswer) {
|
||||
const base::ListValue* tests = nullptr;
|
||||
ASSERT_TRUE(test_data.GetList("tests", &tests));
|
||||
|
||||
for (size_t test_index = 0; test_index < tests->GetSize(); ++test_index) {
|
||||
for (size_t test_index = 0; test_index < tests->GetList().size();
|
||||
++test_index) {
|
||||
SCOPED_TRACE(test_index);
|
||||
|
||||
const base::DictionaryValue* test;
|
||||
|
@ -209,7 +209,8 @@ TEST_F(WebCryptoRsaSsaTest, ImportMultipleRSAPrivateKeysJwk) {
|
||||
// new keys.
|
||||
std::vector<blink::WebCryptoKey> live_keys;
|
||||
|
||||
for (size_t key_index = 0; key_index < key_list.GetSize(); ++key_index) {
|
||||
for (size_t key_index = 0; key_index < key_list.GetList().size();
|
||||
++key_index) {
|
||||
SCOPED_TRACE(key_index);
|
||||
|
||||
base::DictionaryValue* key_values;
|
||||
@ -651,7 +652,8 @@ TEST_F(WebCryptoRsaSsaTest, SignVerifyKnownAnswer) {
|
||||
|
||||
// Validate the signatures are computed and verified as expected.
|
||||
std::vector<uint8_t> signature;
|
||||
for (size_t test_index = 0; test_index < tests.GetSize(); ++test_index) {
|
||||
for (size_t test_index = 0; test_index < tests.GetList().size();
|
||||
++test_index) {
|
||||
SCOPED_TRACE(test_index);
|
||||
|
||||
base::DictionaryValue* test;
|
||||
@ -989,7 +991,8 @@ TEST_F(WebCryptoRsaSsaTest, ImportInvalidKeyData) {
|
||||
base::ListValue tests;
|
||||
ASSERT_TRUE(ReadJsonTestFileToList("bad_rsa_keys.json", &tests));
|
||||
|
||||
for (size_t test_index = 0; test_index < tests.GetSize(); ++test_index) {
|
||||
for (size_t test_index = 0; test_index < tests.GetList().size();
|
||||
++test_index) {
|
||||
SCOPED_TRACE(test_index);
|
||||
|
||||
const base::DictionaryValue* test;
|
||||
|
@ -25,7 +25,8 @@ TEST_F(WebCryptoShaTest, DigestSampleSets) {
|
||||
base::ListValue tests;
|
||||
ASSERT_TRUE(ReadJsonTestFileToList("sha.json", &tests));
|
||||
|
||||
for (size_t test_index = 0; test_index < tests.GetSize(); ++test_index) {
|
||||
for (size_t test_index = 0; test_index < tests.GetList().size();
|
||||
++test_index) {
|
||||
SCOPED_TRACE(test_index);
|
||||
base::DictionaryValue* test;
|
||||
ASSERT_TRUE(tests.GetDictionary(test_index, &test));
|
||||
|
Reference in New Issue
Block a user