Remove std::to_string() //components
removes std::to_string() and uses either base::NumberToString() or base::FormatNumber() Bug: 335672557 Change-Id: Ic6f7f0e8b86835da20fa2836943574a5c314e5f9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5517569 Reviewed-by: Ted Choc <tedchoc@chromium.org> Commit-Queue: Helmut Januschka <helmut@januschka.com> Cr-Commit-Position: refs/heads/main@{#1297834}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
293252f518
commit
1a06c58fa1
components
chromeos_camera
cronet
native
perftest
download
internal
gcm_driver
history
core
history_clusters
language
content
browser
ulp_language_code_locator
live_caption
offline_pages
omnibox
payments
policy
core
sync_bookmarks
tracing
ui_devtools
url_pattern_index
@ -237,8 +237,9 @@ JpegEncodeAcceleratorTestEnvironment::CreateTestYuvImage(
|
||||
// Fill in U and V values.
|
||||
std::fill(image_data.begin() + num_pixels, image_data.end(), 128);
|
||||
|
||||
base::FilePath output_filename(std::to_string(image_size.width()) + "x" +
|
||||
std::to_string(image_size.height()) +
|
||||
base::FilePath output_filename(base::NumberToString(image_size.width()) +
|
||||
"x" +
|
||||
base::NumberToString(image_size.height()) +
|
||||
(is_black ? "_black.jpg" : "_white.jpg"));
|
||||
return std::make_unique<TestImage>(std::move(image_data), image_size,
|
||||
output_filename);
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "base/memory/scoped_refptr.h"
|
||||
#include "base/run_loop.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "base/task/single_thread_task_runner.h"
|
||||
#include "base/test/task_environment.h"
|
||||
@ -84,7 +85,8 @@ std::string BuildBenchmarkName(ExecutorType executor,
|
||||
name += "Q_";
|
||||
break;
|
||||
}
|
||||
name += std::to_string(iterations) + "_" + std::to_string(concurrency) + "_";
|
||||
name += base::NumberToString(iterations) + "_" +
|
||||
base::NumberToString(concurrency) + "_";
|
||||
switch (executor) {
|
||||
case EXECUTOR_DIRECT:
|
||||
name += "ExDir";
|
||||
@ -303,8 +305,8 @@ class Benchmark {
|
||||
port = GetConfigInt("QUIC_PORT");
|
||||
break;
|
||||
}
|
||||
std::string url =
|
||||
scheme + "://" + host + ":" + std::to_string(port) + "/" + resource;
|
||||
std::string url = scheme + "://" + host + ":" + base::NumberToString(port) +
|
||||
"/" + resource;
|
||||
size_t buffer_size = length > (size_t)GetConfigInt("MAX_BUFFER_SIZE")
|
||||
? GetConfigInt("MAX_BUFFER_SIZE")
|
||||
: length;
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "base/functional/callback_helpers.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/task/single_thread_task_runner.h"
|
||||
#include "base/test/gmock_move_support.h"
|
||||
#include "base/test/metrics/histogram_tester.h"
|
||||
@ -246,7 +247,7 @@ class DownloadItemTest : public testing::Test {
|
||||
scoped_refptr<const net::HttpResponseHeaders> CreateResponseHeaders(
|
||||
int response_code) {
|
||||
return base::MakeRefCounted<net::HttpResponseHeaders>(
|
||||
"HTTP/1.1 " + std::to_string(response_code));
|
||||
"HTTP/1.1 " + base::NumberToString(response_code));
|
||||
}
|
||||
|
||||
// This class keeps ownership of the created download item; it will
|
||||
|
@ -496,7 +496,7 @@ void GCMClientImplTest::SetFeatureParams(const base::Feature& feature,
|
||||
void GCMClientImplTest::InitializeInvalidationFieldTrial() {
|
||||
std::map<std::string, std::string> params;
|
||||
params[features::kParamNameTokenInvalidationPeriodDays] =
|
||||
std::to_string(kTestTokenInvalidationPeriod);
|
||||
base::NumberToString(kTestTokenInvalidationPeriod);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
SetFeatureParams(features::kInvalidateTokenFeature, std::move(params)));
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ const std::string& FakeWebHistoryService::FakeRequest::GetResponseBody() {
|
||||
&more_results_left);
|
||||
std::vector<std::string> results;
|
||||
for (const FakeWebHistoryService::Visit& visit : visits) {
|
||||
std::string unix_time = std::to_string(
|
||||
std::string unix_time = base::NumberToString(
|
||||
(visit.timestamp - base::Time::UnixEpoch()).InMicroseconds());
|
||||
results.push_back(base::StringPrintf(
|
||||
"{\"result\":[{\"id\":[{\"timestamp_usec\":\"%s\"}"
|
||||
|
@ -3,9 +3,11 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "components/history_clusters/core/clustering_test_utils.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
@ -42,11 +44,11 @@ VisitResult::~VisitResult() = default;
|
||||
|
||||
std::string VisitResult::ToString() const {
|
||||
std::vector<std::string> duplicate_visits_strings;
|
||||
base::ranges::transform(duplicate_visits_,
|
||||
std::back_inserter(duplicate_visits_strings),
|
||||
[&](const auto& duplicate_visit) {
|
||||
return std::to_string(duplicate_visit.visit_id);
|
||||
});
|
||||
base::ranges::transform(
|
||||
duplicate_visits_, std::back_inserter(duplicate_visits_strings),
|
||||
[&](const auto& duplicate_visit) {
|
||||
return base::NumberToString(duplicate_visit.visit_id);
|
||||
});
|
||||
return base::StringPrintf(
|
||||
"VisitResult(visit_id=%d, score=%f, duplicate_visits=[%s], "
|
||||
"search_terms=%s)",
|
||||
|
@ -31,7 +31,7 @@ const std::map<S2LatLng, std::string> GetData(int rank) {
|
||||
base::FilePath data_dir =
|
||||
source_dir.AppendASCII("components/test/data/language/");
|
||||
base::FilePath data_filepath = data_dir.AppendASCII(
|
||||
"celltolang-data_rank" + std::to_string(rank) + ".csv");
|
||||
"celltolang-data_rank" + base::NumberToString(rank) + ".csv");
|
||||
|
||||
if (!base::ReadFileToString(data_filepath, &data))
|
||||
LOG(FATAL) << "Could not read data from `" << data_filepath << "`.";
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <unordered_map>
|
||||
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "components/live_caption/caption_bubble_context.h"
|
||||
#include "components/live_caption/live_caption_controller.h"
|
||||
@ -271,7 +272,7 @@ void CaptionBubbleControllerViews::OnSodaProgress(
|
||||
IDS_LIVE_CAPTION_DOWNLOAD_PROGRESS,
|
||||
speech::GetLanguageDisplayName(speech::GetLanguageName(language_code),
|
||||
application_locale_),
|
||||
base::UTF8ToUTF16(std::to_string(progress))));
|
||||
base::UTF8ToUTF16(base::NumberToString(progress))));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "components/offline_pages/core/offline_event_logger.h"
|
||||
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
namespace offline_pages {
|
||||
@ -40,13 +41,13 @@ TEST(OfflineEventLoggerTest, SettingClientAndLog) {
|
||||
|
||||
logger.SetIsLogging(true);
|
||||
for (size_t i = 0; i < kMaxLogCount + 1; ++i)
|
||||
logger.RecordActivity(kMessage + std::to_string(i));
|
||||
logger.RecordActivity(kMessage + base::NumberToString(i));
|
||||
std::vector<std::string> log;
|
||||
logger.GetLogs(&log);
|
||||
|
||||
EXPECT_EQ(kMaxLogCount, log.size());
|
||||
EXPECT_EQ(client.last_log_message(), log[0].substr(kTimeLength));
|
||||
EXPECT_EQ(std::string(kMessage) + std::to_string(kMaxLogCount),
|
||||
EXPECT_EQ(std::string(kMessage) + base::NumberToString(kMaxLogCount),
|
||||
client.last_log_message());
|
||||
}
|
||||
|
||||
|
@ -4,17 +4,19 @@
|
||||
|
||||
#include "components/offline_pages/core/offline_page_model_event_logger.h"
|
||||
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
|
||||
namespace offline_pages {
|
||||
|
||||
void OfflinePageModelEventLogger::RecordPageSaved(const std::string& name_space,
|
||||
const std::string& url,
|
||||
int64_t offline_id) {
|
||||
std::string id_str = std::to_string(offline_id);
|
||||
std::string id_str = base::NumberToString(offline_id);
|
||||
RecordActivity(url + " is saved at " + name_space + " with id " + id_str);
|
||||
}
|
||||
|
||||
void OfflinePageModelEventLogger::RecordPageDeleted(int64_t offline_id) {
|
||||
std::string id_str = std::to_string(offline_id);
|
||||
std::string id_str = base::NumberToString(offline_id);
|
||||
RecordActivity("Page with ID " + id_str + " has been deleted");
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <string_view>
|
||||
|
||||
#include "base/run_loop.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/task/thread_pool/thread_pool_instance.h"
|
||||
@ -167,7 +168,8 @@ void HQPPerfTestOnePopularURL::PrintMeasurements(
|
||||
|
||||
std::string durations;
|
||||
for (const auto& measurement : measurements)
|
||||
durations += std::to_string(measurement.InMillisecondsRoundedUp()) + ',';
|
||||
durations +=
|
||||
base::NumberToString(measurement.InMillisecondsRoundedUp()) + ',';
|
||||
// Strip off trailing comma.
|
||||
durations.pop_back();
|
||||
|
||||
@ -208,8 +210,8 @@ void HQPPerfTestOnePopularURL::RunAllTests(PieceIt first, PieceIt last) {
|
||||
return RunTest(base::UTF8ToUTF16(prefix));
|
||||
});
|
||||
|
||||
PrintMeasurements(std::to_string(group_start->size()) + '-' +
|
||||
std::to_string((group_end - 1)->size()),
|
||||
PrintMeasurements(base::NumberToString(group_start->size()) + '-' +
|
||||
base::NumberToString((group_end - 1)->size()),
|
||||
measurements);
|
||||
|
||||
measurements.clear();
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "base/path_service.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/string_split.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
@ -726,7 +727,7 @@ TEST_F(InMemoryURLIndexTest, TrimHistoryIds) {
|
||||
group.min_id = row_id;
|
||||
for (size_t i = 0; i < kAlmostLimit; ++i) {
|
||||
history::URLRow new_row(
|
||||
GURL("http://www.fake_url" + std::to_string(row_id) + ".com"),
|
||||
GURL("http://www.fake_url" + base::NumberToString(row_id) + ".com"),
|
||||
row_id);
|
||||
new_row.set_typed_count(group.typed_count);
|
||||
new_row.set_visit_count(group.visit_count);
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "base/containers/contains.h"
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/files/scoped_temp_dir.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/test/scoped_feature_list.h"
|
||||
#include "base/time/time.h"
|
||||
@ -492,7 +493,7 @@ TEST_F(PaymentMethodManifestTableTest, CredentialTableUserIdMigration) {
|
||||
" 'relying-party.example',"
|
||||
" '',"
|
||||
" x''," +
|
||||
std::to_string(
|
||||
base::NumberToString(
|
||||
base::Time::Now().ToDeltaSinceWindowsEpoch().InMicroseconds()) +
|
||||
")")
|
||||
.c_str()));
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "base/run_loop.h"
|
||||
#include "base/strings/escape.h"
|
||||
#include "base/strings/strcat.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/string_split.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "base/test/metrics/histogram_tester.h"
|
||||
@ -988,8 +989,9 @@ TEST_F(DeviceManagementServiceTest, RetryOnProxyError) {
|
||||
EXPECT_TRUE(request->request.load_flags & net::LOAD_BYPASS_PROXY);
|
||||
EXPECT_EQ(upload_data, network::GetUploadData(request->request));
|
||||
// Retry with last error net::ERR_PROXY_CONNECTION_FAILED.
|
||||
CheckURLAndQueryParams(request, dm_protocol::kValueRequestRegister, kClientID,
|
||||
std::to_string(net::ERR_PROXY_CONNECTION_FAILED));
|
||||
CheckURLAndQueryParams(
|
||||
request, dm_protocol::kValueRequestRegister, kClientID,
|
||||
base::NumberToString(net::ERR_PROXY_CONNECTION_FAILED));
|
||||
}
|
||||
|
||||
TEST_F(DeviceManagementServiceTest, RetryOnBadResponseFromProxy) {
|
||||
@ -1063,7 +1065,7 @@ TEST_F(DeviceManagementServiceTest, RetryOnNetworkChanges) {
|
||||
EXPECT_EQ(original_upload_data, network::GetUploadData(request->request));
|
||||
// Retry with last error net::ERR_NETWORK_CHANGED.
|
||||
CheckURLAndQueryParams(request, dm_protocol::kValueRequestRegister, kClientID,
|
||||
std::to_string(net::ERR_NETWORK_CHANGED));
|
||||
base::NumberToString(net::ERR_NETWORK_CHANGED));
|
||||
}
|
||||
|
||||
TEST_F(DeviceManagementServiceTest, PolicyFetchRetryImmediately) {
|
||||
@ -1095,7 +1097,7 @@ TEST_F(DeviceManagementServiceTest, PolicyFetchRetryImmediately) {
|
||||
EXPECT_EQ(original_upload_data, network::GetUploadData(request->request));
|
||||
// Retry with last error net::ERR_NETWORK_CHANGED.
|
||||
CheckURLAndQueryParams(request, dm_protocol::kValueRequestPolicy, kClientID,
|
||||
std::to_string(net::ERR_NETWORK_CHANGED));
|
||||
base::NumberToString(net::ERR_NETWORK_CHANGED));
|
||||
|
||||
// Request is succeeded with retry.
|
||||
EXPECT_CALL(*this, OnJobDone(_, DM_STATUS_SUCCESS, _, _));
|
||||
@ -1126,7 +1128,7 @@ TEST_F(DeviceManagementServiceTest, RetryLimit) {
|
||||
// Retry with last error net::ERR_NETWORK_CHANGED.
|
||||
CheckURLAndQueryParams(request, dm_protocol::kValueRequestRegister,
|
||||
kClientID,
|
||||
std::to_string(net::ERR_NETWORK_CHANGED));
|
||||
base::NumberToString(net::ERR_NETWORK_CHANGED));
|
||||
}
|
||||
SendResponse(net::ERR_NETWORK_CHANGED, 0, std::string());
|
||||
Mock::VerifyAndClearExpectations(this);
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/notreached.h"
|
||||
#include "base/strings/strcat.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "base/values.h"
|
||||
#include "components/policy/core/common/json_schema_constants.h"
|
||||
@ -857,7 +858,7 @@ bool Schema::InternalStorage::Parse(const base::Value::Dict& schema,
|
||||
|
||||
if (schema_nodes_.size() > std::numeric_limits<short>::max()) {
|
||||
*error = "Can't have more than " +
|
||||
std::to_string(std::numeric_limits<short>::max()) +
|
||||
base::NumberToString(std::numeric_limits<short>::max()) +
|
||||
" schema nodes.";
|
||||
return false;
|
||||
}
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "base/functional/callback_helpers.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/test/mock_callback.h"
|
||||
#include "base/test/scoped_feature_list.h"
|
||||
@ -953,7 +954,7 @@ TEST_P(BookmarkModelObserverImplTest, ShouldAddChildrenInArbitraryOrder) {
|
||||
for (size_t i = 0; i < 5; i++) {
|
||||
nodes[i] = bookmark_model()->AddFolder(
|
||||
/*parent=*/bookmark_bar_node, /*index=*/i,
|
||||
base::UTF8ToUTF16("folder" + std::to_string(i)));
|
||||
base::UTF8ToUTF16("folder" + base::NumberToString(i)));
|
||||
}
|
||||
|
||||
// Now simulate calling the observer as if the nodes are added in that order.
|
||||
|
@ -2,6 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "base/trace_event/trace_event.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "base/functional/bind.h"
|
||||
@ -9,11 +11,11 @@
|
||||
#include "base/memory/ref_counted_memory.h"
|
||||
#include "base/pending_task.h"
|
||||
#include "base/run_loop.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/task/common/task_annotator.h"
|
||||
#include "base/test/task_environment.h"
|
||||
#include "base/threading/thread.h"
|
||||
#include "base/time/time.h"
|
||||
#include "base/trace_event/trace_event.h"
|
||||
#include "base/trace_event/traced_value.h"
|
||||
#include "perf_test_helpers.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
@ -150,7 +152,8 @@ TEST_F(TraceEventPerfTest, Submit_10000_TRACE_EVENT0_multithreaded) {
|
||||
std::vector<std::unique_ptr<WaitableEvent>> complete_events;
|
||||
|
||||
for (int i = 0; i < kNumThreads; i++) {
|
||||
Thread* thread = new Thread(std::string("thread_%d") + std::to_string(i));
|
||||
Thread* thread =
|
||||
new Thread(std::string("thread_%d") + base::NumberToString(i));
|
||||
WaitableEvent* complete_event =
|
||||
new WaitableEvent(WaitableEvent::ResetPolicy::AUTOMATIC,
|
||||
WaitableEvent::InitialState::NOT_SIGNALED);
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "build/build_config.h"
|
||||
#include "components/ui_devtools/ui_element.h"
|
||||
@ -69,7 +70,7 @@ void DrawRulers(const gfx::Rect& screen_bounds,
|
||||
canvas->Draw1pxLine(gfx::PointF(x, 0.0f), gfx::PointF(x, long_stroke),
|
||||
SK_ColorMAGENTA);
|
||||
// Draw ruler marks.
|
||||
std::u16string utf16_text = base::UTF8ToUTF16(std::to_string(x));
|
||||
std::u16string utf16_text = base::UTF8ToUTF16(base::NumberToString(x));
|
||||
DrawRulerText(utf16_text, gfx::Point(x + 2, long_stroke), canvas,
|
||||
render_text_);
|
||||
|
||||
@ -88,7 +89,7 @@ void DrawRulers(const gfx::Rect& screen_bounds,
|
||||
canvas->Draw1pxLine(gfx::PointF(0.0f, y), gfx::PointF(long_stroke, y),
|
||||
SK_ColorMAGENTA);
|
||||
// Draw ruler marks.
|
||||
std::u16string utf16_text = base::UTF8ToUTF16(std::to_string(y));
|
||||
std::u16string utf16_text = base::UTF8ToUTF16(base::NumberToString(y));
|
||||
DrawRulerText(utf16_text, gfx::Point(short_stroke + 1, y + 2), canvas,
|
||||
render_text_);
|
||||
} else {
|
||||
@ -112,10 +113,11 @@ void DrawSizeOfRectangle(const gfx::Rect& hovered_rect,
|
||||
} else if (hovered_rect.height()) {
|
||||
// Draw only height() if height() is not empty.
|
||||
utf16_text =
|
||||
base::UTF8ToUTF16(std::to_string(hovered_rect.height()) + unit);
|
||||
base::UTF8ToUTF16(base::NumberToString(hovered_rect.height()) + unit);
|
||||
} else if (hovered_rect.width()) {
|
||||
// Draw only width() if width() is not empty.
|
||||
utf16_text = base::UTF8ToUTF16(std::to_string(hovered_rect.width()) + unit);
|
||||
utf16_text =
|
||||
base::UTF8ToUTF16(base::NumberToString(hovered_rect.width()) + unit);
|
||||
} else {
|
||||
// If both width() and height() are empty, canvas won't draw size.
|
||||
return;
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "components/url_pattern_index/uint64_hasher.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
@ -96,7 +97,7 @@ TEST(ClosedHashMapTest, InsertManyKeysWithCustomHasher) {
|
||||
|
||||
std::vector<std::pair<uint64_t, std::string>> entries;
|
||||
for (int key = 10, i = 0; key < 1000000; key += ++i) {
|
||||
entries.push_back(std::make_pair(key, std::to_string(key)));
|
||||
entries.push_back(std::make_pair(key, base::NumberToString(key)));
|
||||
}
|
||||
|
||||
uint32_t expected_size = 0;
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "base/functional/callback.h"
|
||||
#include "base/rand_util.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "components/url_pattern_index/url_pattern.h"
|
||||
#include "components/url_pattern_index/url_rule_test_support.h"
|
||||
#include "testing/gmock/include/gmock/gmock.h"
|
||||
@ -620,7 +621,7 @@ TEST_F(UrlPatternIndexTest, OneRuleWithLongDomainList) {
|
||||
|
||||
std::vector<std::string> domains;
|
||||
for (size_t i = 0; i < kDomains; ++i) {
|
||||
const std::string domain = "domain" + std::to_string(i) + ".com";
|
||||
const std::string domain = "domain" + base::NumberToString(i) + ".com";
|
||||
domains.push_back(domain);
|
||||
domains.push_back("~sub." + domain);
|
||||
domains.push_back("a.sub." + domain);
|
||||
@ -640,7 +641,7 @@ TEST_F(UrlPatternIndexTest, OneRuleWithLongDomainList) {
|
||||
|
||||
for (size_t i = 0; i < kDomains; ++i) {
|
||||
SCOPED_TRACE(::testing::Message() << "Iteration: " << i);
|
||||
const std::string domain = "domain" + std::to_string(i) + ".com";
|
||||
const std::string domain = "domain" + base::NumberToString(i) + ".com";
|
||||
|
||||
EXPECT_TRUE(FindMatch(kUrl, "http://" + domain));
|
||||
EXPECT_FALSE(FindMatch(kUrl, "http://sub." + domain));
|
||||
@ -974,7 +975,7 @@ TEST_F(UrlPatternIndexTest, FindMatchReturnsCorrectRules) {
|
||||
|
||||
std::vector<std::string> url_patterns(kNumOfPatterns);
|
||||
for (size_t i = 0; i < kNumOfPatterns; ++i) {
|
||||
url_patterns[i] = "http://example." + std::to_string(i) + ".com";
|
||||
url_patterns[i] = "http://example." + base::NumberToString(i) + ".com";
|
||||
ASSERT_TRUE(
|
||||
AddUrlRule(MakeUrlRule(UrlPattern(url_patterns[i], kSubstring))))
|
||||
<< "Rule #" << i;
|
||||
@ -995,8 +996,8 @@ TEST_F(UrlPatternIndexTest, FindMatchReturnsCorrectRules) {
|
||||
std::string_view(rule_pattern->data(), rule_pattern->size()));
|
||||
}
|
||||
|
||||
EXPECT_FALSE(
|
||||
FindMatch("http://example." + std::to_string(kNumOfPatterns) + ".com"));
|
||||
EXPECT_FALSE(FindMatch("http://example." +
|
||||
base::NumberToString(kNumOfPatterns) + ".com"));
|
||||
}
|
||||
|
||||
// Tests UrlPatternIndexMatcher::FindMatch works with the kHighestPriority match
|
||||
@ -1006,7 +1007,7 @@ TEST_F(UrlPatternIndexTest, FindMatchHighestPriority) {
|
||||
|
||||
int id = 1;
|
||||
auto pattern_for_number = [](size_t num) {
|
||||
return "http://" + std::to_string(num) + ".com";
|
||||
return "http://" + base::NumberToString(num) + ".com";
|
||||
};
|
||||
|
||||
for (size_t i = 1; i <= kNumPatternTypes; i++) {
|
||||
|
Reference in New Issue
Block a user