Migrate base::{size,empty,data} to STL equivalents in //content.
Bug: 1299695 Change-Id: Iefec40ecc9327c04732785eaed5a3214d17e552f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3491685 Reviewed-by: Lei Zhang <thestig@chromium.org> Owners-Override: Lei Zhang <thestig@chromium.org> Commit-Queue: Daniel Cheng <dcheng@chromium.org> Cr-Commit-Position: refs/heads/main@{#975485}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
7b7aaecca4
commit
ad44af2f53
content
app
app_shim_remote_cocoa
browser
accessibility
accessibility_event_recorder_auralinux.ccaccessibility_tree_formatter_android.ccaccessibility_tree_formatter_fuchsia.ccbrowser_accessibility_state_impl_win.cc
android
attribution_reporting
blob_storage
browser_child_process_host_impl.ccbrowser_main_loop.ccbrowser_url_handler_impl.ccbrowsing_data
code_cache
devtools
download
file_system
file_system_access
font_unique_name_lookup
gpu
host_zoom_map_impl_unittest.ccindexed_db
indexed_db_backing_store_unittest.ccindexed_db_leveldb_coding_unittest.ccindexed_db_leveldb_operations.cc
interest_group
launch_as_mojo_client_browsertest.ccmedia
notifications
ppapi_plugin_process_host.ccrenderer_host
dwrite_font_proxy_impl_win.cc
sandbox_ipc_linux.ccservice_process_host_browsertest.ccinput
media
navigator_unittest.ccpepper
render_process_host_impl.ccrender_widget_host_view_mac_editcommand_helper.mmservice_worker
embedded_worker_test_helper.ccservice_worker_cache_writer_unittest.ccservice_worker_file_upload_browsertest.ccservice_worker_job_unittest.ccservice_worker_registry_unittest.ccservice_worker_version_browsertest.cc
storage_partition_impl_unittest.ccutility_process_host.ccweb_package
webauth
webui
common
renderer
services
auction_worklet
shell
browser
test
web_test
@@ -292,7 +292,7 @@ pid_t LaunchZygoteHelper(base::CommandLine* cmd_line,
|
|||||||
switches::kVModule,
|
switches::kVModule,
|
||||||
};
|
};
|
||||||
cmd_line->CopySwitchesFrom(*base::CommandLine::ForCurrentProcess(),
|
cmd_line->CopySwitchesFrom(*base::CommandLine::ForCurrentProcess(),
|
||||||
kForwardSwitches, base::size(kForwardSwitches));
|
kForwardSwitches, std::size(kForwardSwitches));
|
||||||
|
|
||||||
GetContentClient()->browser()->AppendExtraCommandLineSwitches(cmd_line, -1);
|
GetContentClient()->browser()->AppendExtraCommandLineSwitches(cmd_line, -1);
|
||||||
|
|
||||||
@@ -606,7 +606,7 @@ int NO_STACK_PROTECTOR RunZygote(ContentMainDelegate* delegate) {
|
|||||||
|
|
||||||
mojo::core::InitFeatures();
|
mojo::core::InitFeatures();
|
||||||
|
|
||||||
for (size_t i = 0; i < base::size(kMainFunctions); ++i) {
|
for (size_t i = 0; i < std::size(kMainFunctions); ++i) {
|
||||||
if (process_type == kMainFunctions[i].name)
|
if (process_type == kMainFunctions[i].name)
|
||||||
return kMainFunctions[i].function(std::move(main_params));
|
return kMainFunctions[i].function(std::move(main_params));
|
||||||
}
|
}
|
||||||
@@ -673,7 +673,7 @@ RunOtherNamedProcessTypeMain(const std::string& process_type,
|
|||||||
base::HangWatcher::GetInstance()->Start();
|
base::HangWatcher::GetInstance()->Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < base::size(kMainFunctions); ++i) {
|
for (size_t i = 0; i < std::size(kMainFunctions); ++i) {
|
||||||
if (process_type == kMainFunctions[i].name) {
|
if (process_type == kMainFunctions[i].name) {
|
||||||
auto exit_code =
|
auto exit_code =
|
||||||
delegate->RunProcess(process_type, std::move(main_function_params));
|
delegate->RunProcess(process_type, std::move(main_function_params));
|
||||||
|
@@ -317,7 +317,7 @@ IN_PROC_BROWSER_TEST_F(
|
|||||||
const NSSize window_offsets[] = {
|
const NSSize window_offsets[] = {
|
||||||
{1.0, 0.0}, {-1.0, 0.0}, {0.0, 1.0}, {0.0, -1.0}};
|
{1.0, 0.0}, {-1.0, 0.0}, {0.0, 1.0}, {0.0, -1.0}};
|
||||||
NSRect window_b_frame = [window_b frame];
|
NSRect window_b_frame = [window_b frame];
|
||||||
for (size_t i = 0; i < base::size(window_offsets); i++) {
|
for (size_t i = 0; i < std::size(window_offsets); i++) {
|
||||||
// Move window b so that it no longer completely covers
|
// Move window b so that it no longer completely covers
|
||||||
// window_a's webcontents.
|
// window_a's webcontents.
|
||||||
NSRect offset_window_frame = NSOffsetRect(
|
NSRect offset_window_frame = NSOffsetRect(
|
||||||
|
@@ -8,7 +8,6 @@
|
|||||||
#include <atk/atkutil.h>
|
#include <atk/atkutil.h>
|
||||||
#include <atspi/atspi.h>
|
#include <atspi/atspi.h>
|
||||||
|
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/no_destructor.h"
|
#include "base/no_destructor.h"
|
||||||
#include "base/process/process_handle.h"
|
#include "base/process/process_handle.h"
|
||||||
#include "base/strings/stringprintf.h"
|
#include "base/strings/stringprintf.h"
|
||||||
@@ -294,7 +293,7 @@ void AccessibilityEventRecorderAuraLinux::AddATSPIEventListeners() {
|
|||||||
atspi_event_listener_new(OnATSPIEventReceived, this, nullptr);
|
atspi_event_listener_new(OnATSPIEventReceived, this, nullptr);
|
||||||
|
|
||||||
GError* error = nullptr;
|
GError* error = nullptr;
|
||||||
for (size_t i = 0; i < base::size(kEventNames); i++) {
|
for (size_t i = 0; i < std::size(kEventNames); i++) {
|
||||||
atspi_event_listener_register(atspi_event_listener_, kEventNames[i],
|
atspi_event_listener_register(atspi_event_listener_, kEventNames[i],
|
||||||
&error);
|
&error);
|
||||||
if (error) {
|
if (error) {
|
||||||
@@ -309,7 +308,7 @@ void AccessibilityEventRecorderAuraLinux::RemoveATSPIEventListeners() {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
GError* error = nullptr;
|
GError* error = nullptr;
|
||||||
for (size_t i = 0; i < base::size(kEventNames); i++) {
|
for (size_t i = 0; i < std::size(kEventNames); i++) {
|
||||||
atspi_event_listener_deregister(atspi_event_listener_, kEventNames[i],
|
atspi_event_listener_deregister(atspi_event_listener_, kEventNames[i],
|
||||||
nullptr);
|
nullptr);
|
||||||
if (error) {
|
if (error) {
|
||||||
|
@@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
#include "base/android/jni_android.h"
|
#include "base/android/jni_android.h"
|
||||||
#include "base/android/jni_string.h"
|
#include "base/android/jni_string.h"
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/files/file_path.h"
|
#include "base/files/file_path.h"
|
||||||
#include "base/json/json_writer.h"
|
#include "base/json/json_writer.h"
|
||||||
#include "base/strings/string_number_conversions.h"
|
#include "base/strings/string_number_conversions.h"
|
||||||
@@ -256,14 +255,14 @@ std::string AccessibilityTreeFormatterAndroid::ProcessTreeForOutput(
|
|||||||
&line);
|
&line);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned i = 0; i < base::size(BOOL_ATTRIBUTES); i++) {
|
for (unsigned i = 0; i < std::size(BOOL_ATTRIBUTES); i++) {
|
||||||
const char* attribute_name = BOOL_ATTRIBUTES[i];
|
const char* attribute_name = BOOL_ATTRIBUTES[i];
|
||||||
absl::optional<bool> value = dict.FindBoolPath(attribute_name);
|
absl::optional<bool> value = dict.FindBoolPath(attribute_name);
|
||||||
if (value && *value)
|
if (value && *value)
|
||||||
WriteAttribute(true, attribute_name, &line);
|
WriteAttribute(true, attribute_name, &line);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned i = 0; i < base::size(STRING_ATTRIBUTES); i++) {
|
for (unsigned i = 0; i < std::size(STRING_ATTRIBUTES); i++) {
|
||||||
const char* attribute_name = STRING_ATTRIBUTES[i];
|
const char* attribute_name = STRING_ATTRIBUTES[i];
|
||||||
std::string value;
|
std::string value;
|
||||||
if (!dict.GetString(attribute_name, &value) || value.empty())
|
if (!dict.GetString(attribute_name, &value) || value.empty())
|
||||||
@@ -272,7 +271,7 @@ std::string AccessibilityTreeFormatterAndroid::ProcessTreeForOutput(
|
|||||||
&line);
|
&line);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned i = 0; i < base::size(INT_ATTRIBUTES); i++) {
|
for (unsigned i = 0; i < std::size(INT_ATTRIBUTES); i++) {
|
||||||
const char* attribute_name = INT_ATTRIBUTES[i];
|
const char* attribute_name = INT_ATTRIBUTES[i];
|
||||||
int value = dict.FindIntKey(attribute_name).value_or(0);
|
int value = dict.FindIntKey(attribute_name).value_or(0);
|
||||||
if (value == 0)
|
if (value == 0)
|
||||||
@@ -280,7 +279,7 @@ std::string AccessibilityTreeFormatterAndroid::ProcessTreeForOutput(
|
|||||||
WriteAttribute(true, StringPrintf("%s=%d", attribute_name, value), &line);
|
WriteAttribute(true, StringPrintf("%s=%d", attribute_name, value), &line);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned i = 0; i < base::size(ACTION_ATTRIBUTES); i++) {
|
for (unsigned i = 0; i < std::size(ACTION_ATTRIBUTES); i++) {
|
||||||
const char* attribute_name = ACTION_ATTRIBUTES[i];
|
const char* attribute_name = ACTION_ATTRIBUTES[i];
|
||||||
absl::optional<bool> value = dict.FindBoolPath(attribute_name);
|
absl::optional<bool> value = dict.FindBoolPath(attribute_name);
|
||||||
if (value && *value) {
|
if (value && *value) {
|
||||||
|
@@ -398,14 +398,14 @@ std::string AccessibilityTreeFormatterFuchsia::ProcessTreeForOutput(
|
|||||||
node.GetString("role", &role_value);
|
node.GetString("role", &role_value);
|
||||||
WriteAttribute(true, role_value, &line);
|
WriteAttribute(true, role_value, &line);
|
||||||
|
|
||||||
for (unsigned i = 0; i < base::size(kBoolAttributes); i++) {
|
for (unsigned i = 0; i < std::size(kBoolAttributes); i++) {
|
||||||
const char* bool_attribute = kBoolAttributes[i];
|
const char* bool_attribute = kBoolAttributes[i];
|
||||||
absl::optional<bool> value = node.FindBoolPath(bool_attribute);
|
absl::optional<bool> value = node.FindBoolPath(bool_attribute);
|
||||||
if (value && *value)
|
if (value && *value)
|
||||||
WriteAttribute(/*include_by_default=*/true, bool_attribute, &line);
|
WriteAttribute(/*include_by_default=*/true, bool_attribute, &line);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned i = 0; i < base::size(kStringAttributes); i++) {
|
for (unsigned i = 0; i < std::size(kStringAttributes); i++) {
|
||||||
const char* string_attribute = kStringAttributes[i];
|
const char* string_attribute = kStringAttributes[i];
|
||||||
std::string value;
|
std::string value;
|
||||||
if (!node.GetString(string_attribute, &value) || value.empty())
|
if (!node.GetString(string_attribute, &value) || value.empty())
|
||||||
@@ -416,7 +416,7 @@ std::string AccessibilityTreeFormatterFuchsia::ProcessTreeForOutput(
|
|||||||
base::StringPrintf("%s='%s'", string_attribute, value.c_str()), &line);
|
base::StringPrintf("%s='%s'", string_attribute, value.c_str()), &line);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned i = 0; i < base::size(kIntAttributes); i++) {
|
for (unsigned i = 0; i < std::size(kIntAttributes); i++) {
|
||||||
const char* attribute_name = kIntAttributes[i];
|
const char* attribute_name = kIntAttributes[i];
|
||||||
int value = node.FindIntKey(attribute_name).value_or(0);
|
int value = node.FindIntKey(attribute_name).value_or(0);
|
||||||
if (value == 0)
|
if (value == 0)
|
||||||
@@ -425,7 +425,7 @@ std::string AccessibilityTreeFormatterFuchsia::ProcessTreeForOutput(
|
|||||||
&line);
|
&line);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned i = 0; i < base::size(kDoubleAttributes); i++) {
|
for (unsigned i = 0; i < std::size(kDoubleAttributes); i++) {
|
||||||
const char* attribute_name = kDoubleAttributes[i];
|
const char* attribute_name = kDoubleAttributes[i];
|
||||||
int value = node.FindIntKey(attribute_name).value_or(0);
|
int value = node.FindIntKey(attribute_name).value_or(0);
|
||||||
if (value == 0)
|
if (value == 0)
|
||||||
|
@@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/files/file_path.h"
|
#include "base/files/file_path.h"
|
||||||
#include "base/metrics/histogram_macros.h"
|
#include "base/metrics/histogram_macros.h"
|
||||||
#include "base/no_destructor.h"
|
#include "base/no_destructor.h"
|
||||||
@@ -204,7 +203,7 @@ void BrowserAccessibilityStateImplWin::UpdateHistogramsOnOtherThread() {
|
|||||||
bool satogo = false; // Very few users -- do not need uniques
|
bool satogo = false; // Very few users -- do not need uniques
|
||||||
for (size_t i = 0; i < module_count; i++) {
|
for (size_t i = 0; i < module_count; i++) {
|
||||||
TCHAR filename[MAX_PATH];
|
TCHAR filename[MAX_PATH];
|
||||||
GetModuleFileName(modules[i], filename, base::size(filename));
|
GetModuleFileName(modules[i], filename, std::size(filename));
|
||||||
std::string module_name(base::FilePath(filename).BaseName().AsUTF8Unsafe());
|
std::string module_name(base::FilePath(filename).BaseName().AsUTF8Unsafe());
|
||||||
if (base::LowerCaseEqualsASCII(module_name, "fsdomsrv.dll"))
|
if (base::LowerCaseEqualsASCII(module_name, "fsdomsrv.dll"))
|
||||||
g_jaws = true;
|
g_jaws = true;
|
||||||
|
@@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "testing/gtest/include/gtest/gtest.h"
|
#include "testing/gtest/include/gtest/gtest.h"
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
@@ -38,7 +37,7 @@ TEST_F(JavaTypeTest, ScalarTypes) {
|
|||||||
"Ljava/lang/Object;"},
|
"Ljava/lang/Object;"},
|
||||||
{"my.nested.Type$Foo", JavaType::TypeObject, "my/nested/Type$Foo",
|
{"my.nested.Type$Foo", JavaType::TypeObject, "my/nested/Type$Foo",
|
||||||
"Lmy/nested/Type$Foo;"}};
|
"Lmy/nested/Type$Foo;"}};
|
||||||
for (size_t i = 0; i < base::size(scalar_types); ++i) {
|
for (size_t i = 0; i < std::size(scalar_types); ++i) {
|
||||||
JavaType jt = JavaType::CreateFromBinaryName(scalar_types[i].binary_type);
|
JavaType jt = JavaType::CreateFromBinaryName(scalar_types[i].binary_type);
|
||||||
EXPECT_EQ(scalar_types[i].java_type, jt.type);
|
EXPECT_EQ(scalar_types[i].java_type, jt.type);
|
||||||
EXPECT_FALSE(jt.inner_type);
|
EXPECT_FALSE(jt.inner_type);
|
||||||
|
@@ -7,11 +7,9 @@
|
|||||||
// /third_party/blink/public/common/messaging/message_port_descriptor.h.
|
// /third_party/blink/public/common/messaging/message_port_descriptor.h.
|
||||||
|
|
||||||
#include "third_party/blink/public/common/messaging/message_port_descriptor.h"
|
#include "third_party/blink/public/common/messaging/message_port_descriptor.h"
|
||||||
|
|
||||||
#include "base/android/jni_android.h"
|
#include "base/android/jni_android.h"
|
||||||
#include "base/android/jni_array.h"
|
#include "base/android/jni_array.h"
|
||||||
#include "base/android/scoped_java_ref.h"
|
#include "base/android/scoped_java_ref.h"
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/unguessable_token.h"
|
#include "base/unguessable_token.h"
|
||||||
#include "content/public/android/content_jni_headers/AppWebMessagePortDescriptor_jni.h"
|
#include "content/public/android/content_jni_headers/AppWebMessagePortDescriptor_jni.h"
|
||||||
#include "mojo/public/cpp/system/message_pipe.h"
|
#include "mojo/public/cpp/system/message_pipe.h"
|
||||||
@@ -43,7 +41,7 @@ JNI_AppWebMessagePortDescriptor_CreatePair(JNIEnv* env) {
|
|||||||
uint64_t pointers[2] = {reinterpret_cast<uint64_t>(port0),
|
uint64_t pointers[2] = {reinterpret_cast<uint64_t>(port0),
|
||||||
reinterpret_cast<uint64_t>(port1)};
|
reinterpret_cast<uint64_t>(port1)};
|
||||||
return base::android::ToJavaLongArray(
|
return base::android::ToJavaLongArray(
|
||||||
env, reinterpret_cast<const int64_t*>(pointers), base::size(pointers));
|
env, reinterpret_cast<const int64_t*>(pointers), std::size(pointers));
|
||||||
}
|
}
|
||||||
|
|
||||||
JNI_EXPORT jlong JNI_AppWebMessagePortDescriptor_Create(JNIEnv* env,
|
JNI_EXPORT jlong JNI_AppWebMessagePortDescriptor_Create(JNIEnv* env,
|
||||||
@@ -134,8 +132,7 @@ JNI_AppWebMessagePortDescriptor_PassSerialized(
|
|||||||
id.GetLowForSerialization(),
|
id.GetLowForSerialization(),
|
||||||
id.GetHighForSerialization(), sequence_number};
|
id.GetHighForSerialization(), sequence_number};
|
||||||
return base::android::ToJavaLongArray(
|
return base::android::ToJavaLongArray(
|
||||||
env, reinterpret_cast<const int64_t*>(serialized),
|
env, reinterpret_cast<const int64_t*>(serialized), std::size(serialized));
|
||||||
base::size(serialized));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JNI_EXPORT void JNI_AppWebMessagePortDescriptor_CloseAndDestroy(
|
JNI_EXPORT void JNI_AppWebMessagePortDescriptor_CloseAndDestroy(
|
||||||
@@ -171,4 +168,4 @@ JNI_EXPORT void JNI_AppWebMessagePortDescriptor_DisentangleCloseAndDestroy(
|
|||||||
// Reset it and finally delete the object.
|
// Reset it and finally delete the object.
|
||||||
message_port_descriptor->Reset();
|
message_port_descriptor->Reset();
|
||||||
delete message_port_descriptor;
|
delete message_port_descriptor;
|
||||||
}
|
}
|
||||||
|
@@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
#include "base/check.h"
|
#include "base/check.h"
|
||||||
#include "base/check_op.h"
|
#include "base/check_op.h"
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/memory/raw_ptr.h"
|
#include "base/memory/raw_ptr.h"
|
||||||
#include "base/strings/string_number_conversions.h"
|
#include "base/strings/string_number_conversions.h"
|
||||||
#include "base/values.h"
|
#include "base/values.h"
|
||||||
@@ -242,7 +241,7 @@ std::string AttributionReport::PrivacyBudgetKey() const {
|
|||||||
ctx->Update(kVersion, sizeof(kVersion));
|
ctx->Update(kVersion, sizeof(kVersion));
|
||||||
|
|
||||||
std::string output(crypto::kSHA256Length, 0);
|
std::string output(crypto::kSHA256Length, 0);
|
||||||
ctx->Finish(base::data(output), output.size());
|
ctx->Finish(std::data(output), output.size());
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
@@ -8,7 +8,6 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/files/file_path.h"
|
#include "base/files/file_path.h"
|
||||||
#include "base/files/file_util.h"
|
#include "base/files/file_util.h"
|
||||||
#include "base/files/scoped_temp_dir.h"
|
#include "base/files/scoped_temp_dir.h"
|
||||||
@@ -136,12 +135,12 @@ class BlobURLTest : public testing::Test {
|
|||||||
const char kFilename1[] = "FileSystemFile1.dat";
|
const char kFilename1[] = "FileSystemFile1.dat";
|
||||||
temp_file_system_file1_ = GetFileSystemURL(kFilename1);
|
temp_file_system_file1_ = GetFileSystemURL(kFilename1);
|
||||||
WriteFileSystemFile(kFilename1, kTestFileSystemFileData1,
|
WriteFileSystemFile(kFilename1, kTestFileSystemFileData1,
|
||||||
base::size(kTestFileSystemFileData1) - 1,
|
std::size(kTestFileSystemFileData1) - 1,
|
||||||
&temp_file_system_file_modification_time1_);
|
&temp_file_system_file_modification_time1_);
|
||||||
const char kFilename2[] = "FileSystemFile2.dat";
|
const char kFilename2[] = "FileSystemFile2.dat";
|
||||||
temp_file_system_file2_ = GetFileSystemURL(kFilename2);
|
temp_file_system_file2_ = GetFileSystemURL(kFilename2);
|
||||||
WriteFileSystemFile(kFilename2, kTestFileSystemFileData2,
|
WriteFileSystemFile(kFilename2, kTestFileSystemFileData2,
|
||||||
base::size(kTestFileSystemFileData2) - 1,
|
std::size(kTestFileSystemFileData2) - 1,
|
||||||
&temp_file_system_file_modification_time2_);
|
&temp_file_system_file_modification_time2_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -355,13 +354,13 @@ class BlobURLTest : public testing::Test {
|
|||||||
|
|
||||||
TEST_F(BlobURLTest, TestGetSimpleDataRequest) {
|
TEST_F(BlobURLTest, TestGetSimpleDataRequest) {
|
||||||
blob_data_->AppendData(kTestData1);
|
blob_data_->AppendData(kTestData1);
|
||||||
TestSuccessNonrangeRequest(kTestData1, base::size(kTestData1) - 1);
|
TestSuccessNonrangeRequest(kTestData1, std::size(kTestData1) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(BlobURLTest, TestGetSimpleFileRequest) {
|
TEST_F(BlobURLTest, TestGetSimpleFileRequest) {
|
||||||
blob_data_->AppendFile(temp_file1_, 0, std::numeric_limits<uint64_t>::max(),
|
blob_data_->AppendFile(temp_file1_, 0, std::numeric_limits<uint64_t>::max(),
|
||||||
base::Time());
|
base::Time());
|
||||||
TestSuccessNonrangeRequest(kTestFileData1, base::size(kTestFileData1) - 1);
|
TestSuccessNonrangeRequest(kTestFileData1, std::size(kTestFileData1) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(BlobURLTest, TestGetLargeFileRequest) {
|
TEST_F(BlobURLTest, TestGetLargeFileRequest) {
|
||||||
@@ -405,7 +404,7 @@ TEST_F(BlobURLTest, TestGetSimpleFileSystemFileRequest) {
|
|||||||
0, std::numeric_limits<uint64_t>::max(), base::Time(),
|
0, std::numeric_limits<uint64_t>::max(), base::Time(),
|
||||||
file_system_context_);
|
file_system_context_);
|
||||||
TestSuccessNonrangeRequest(kTestFileSystemFileData1,
|
TestSuccessNonrangeRequest(kTestFileSystemFileData1,
|
||||||
base::size(kTestFileSystemFileData1) - 1);
|
std::size(kTestFileSystemFileData1) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(BlobURLTest, TestGetLargeFileSystemFileRequest) {
|
TEST_F(BlobURLTest, TestGetLargeFileSystemFileRequest) {
|
||||||
@@ -470,7 +469,7 @@ TEST_F(BlobURLTest, TestGetSimpleDataHandleRequest) {
|
|||||||
base::MakeRefCounted<storage::FakeBlobDataHandle>(kTestDataHandleData1,
|
base::MakeRefCounted<storage::FakeBlobDataHandle>(kTestDataHandleData1,
|
||||||
""));
|
""));
|
||||||
TestSuccessNonrangeRequest(kTestDataHandleData1,
|
TestSuccessNonrangeRequest(kTestDataHandleData1,
|
||||||
base::size(kTestDataHandleData1) - 1);
|
std::size(kTestDataHandleData1) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(BlobURLTest, TestGetComplicatedDataFileAndDiskCacheRequest) {
|
TEST_F(BlobURLTest, TestGetComplicatedDataFileAndDiskCacheRequest) {
|
||||||
@@ -570,7 +569,7 @@ TEST_F(BlobURLTest, TestSideData) {
|
|||||||
expected_status_code_ = 200;
|
expected_status_code_ = 200;
|
||||||
expected_response_ = kTestDataHandleData2;
|
expected_response_ = kTestDataHandleData2;
|
||||||
TestRequest("GET", net::HttpRequestHeaders());
|
TestRequest("GET", net::HttpRequestHeaders());
|
||||||
EXPECT_EQ(static_cast<int>(base::size(kTestDataHandleData2) - 1),
|
EXPECT_EQ(static_cast<int>(std::size(kTestDataHandleData2) - 1),
|
||||||
response_headers_->GetContentLength());
|
response_headers_->GetContentLength());
|
||||||
|
|
||||||
EXPECT_EQ(std::string(kTestDiskCacheSideData), response_metadata_);
|
EXPECT_EQ(std::string(kTestDiskCacheSideData), response_metadata_);
|
||||||
@@ -583,7 +582,7 @@ TEST_F(BlobURLTest, TestZeroSizeSideData) {
|
|||||||
expected_status_code_ = 200;
|
expected_status_code_ = 200;
|
||||||
expected_response_ = kTestDataHandleData2;
|
expected_response_ = kTestDataHandleData2;
|
||||||
TestRequest("GET", net::HttpRequestHeaders());
|
TestRequest("GET", net::HttpRequestHeaders());
|
||||||
EXPECT_EQ(static_cast<int>(base::size(kTestDataHandleData2) - 1),
|
EXPECT_EQ(static_cast<int>(std::size(kTestDataHandleData2) - 1),
|
||||||
response_headers_->GetContentLength());
|
response_headers_->GetContentLength());
|
||||||
|
|
||||||
EXPECT_TRUE(response_metadata_.empty());
|
EXPECT_TRUE(response_metadata_.empty());
|
||||||
|
@@ -10,7 +10,6 @@
|
|||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/clang_profiling_buildflags.h"
|
#include "base/clang_profiling_buildflags.h"
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/debug/dump_without_crashing.h"
|
#include "base/debug/dump_without_crashing.h"
|
||||||
#include "base/feature_list.h"
|
#include "base/feature_list.h"
|
||||||
#include "base/files/file_path.h"
|
#include "base/files/file_path.h"
|
||||||
@@ -303,7 +302,7 @@ void BrowserChildProcessHostImpl::LaunchWithoutExtraCommandLineSwitches(
|
|||||||
switches::kVModule,
|
switches::kVModule,
|
||||||
};
|
};
|
||||||
cmd_line->CopySwitchesFrom(browser_command_line, kForwardSwitches,
|
cmd_line->CopySwitchesFrom(browser_command_line, kForwardSwitches,
|
||||||
base::size(kForwardSwitches));
|
std::size(kForwardSwitches));
|
||||||
|
|
||||||
// All processes should have a non-empty metrics name.
|
// All processes should have a non-empty metrics name.
|
||||||
if (data_.metrics_name.empty())
|
if (data_.metrics_name.empty())
|
||||||
|
@@ -16,7 +16,6 @@
|
|||||||
#include "base/base_switches.h"
|
#include "base/base_switches.h"
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/feature_list.h"
|
#include "base/feature_list.h"
|
||||||
#include "base/location.h"
|
#include "base/location.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
@@ -284,7 +283,7 @@ static void SetUpGLibLogHandler() {
|
|||||||
// Register GLib-handled assertions to go through our logging system.
|
// Register GLib-handled assertions to go through our logging system.
|
||||||
const char* const kLogDomains[] = {nullptr, "Gtk", "Gdk", "GLib",
|
const char* const kLogDomains[] = {nullptr, "Gtk", "Gdk", "GLib",
|
||||||
"GLib-GObject"};
|
"GLib-GObject"};
|
||||||
for (size_t i = 0; i < base::size(kLogDomains); i++) {
|
for (size_t i = 0; i < std::size(kLogDomains); i++) {
|
||||||
g_log_set_handler(
|
g_log_set_handler(
|
||||||
kLogDomains[i],
|
kLogDomains[i],
|
||||||
static_cast<GLogLevelFlags>(G_LOG_FLAG_RECURSION | G_LOG_FLAG_FATAL |
|
static_cast<GLogLevelFlags>(G_LOG_FLAG_RECURSION | G_LOG_FLAG_FATAL |
|
||||||
|
@@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/ranges/algorithm.h"
|
#include "base/ranges/algorithm.h"
|
||||||
#include "base/strings/string_util.h"
|
#include "base/strings/string_util.h"
|
||||||
#include "content/browser/renderer_host/debug_urls.h"
|
#include "content/browser/renderer_host/debug_urls.h"
|
||||||
@@ -39,7 +38,7 @@ static bool HandleViewSource(GURL* url, BrowserContext* browser_context) {
|
|||||||
// Merge all the schemes for which view-source is allowed by default, with
|
// Merge all the schemes for which view-source is allowed by default, with
|
||||||
// the view-source schemes defined by the ContentBrowserClient.
|
// the view-source schemes defined by the ContentBrowserClient.
|
||||||
std::vector<std::string> all_allowed_sub_schemes;
|
std::vector<std::string> all_allowed_sub_schemes;
|
||||||
for (size_t i = 0; i < base::size(default_allowed_sub_schemes); ++i)
|
for (size_t i = 0; i < std::size(default_allowed_sub_schemes); ++i)
|
||||||
all_allowed_sub_schemes.push_back(default_allowed_sub_schemes[i]);
|
all_allowed_sub_schemes.push_back(default_allowed_sub_schemes[i]);
|
||||||
GetContentClient()->browser()->GetAdditionalViewSourceSchemes(
|
GetContentClient()->browser()->GetAdditionalViewSourceSchemes(
|
||||||
&all_allowed_sub_schemes);
|
&all_allowed_sub_schemes);
|
||||||
|
@@ -479,7 +479,7 @@ TEST_F(ClearSiteDataHandlerTest, FormattedConsoleOutput) {
|
|||||||
|
|
||||||
// |NetworkServiceClient| creates a new |ClearSiteDataHandler| for each
|
// |NetworkServiceClient| creates a new |ClearSiteDataHandler| for each
|
||||||
// navigation, redirect, or subresource header responses.
|
// navigation, redirect, or subresource header responses.
|
||||||
for (size_t i = 0; i < base::size(kTestCases); i++) {
|
for (size_t i = 0; i < std::size(kTestCases); i++) {
|
||||||
TestHandler handler(
|
TestHandler handler(
|
||||||
base::BindRepeating(&FakeBrowserContextGetter),
|
base::BindRepeating(&FakeBrowserContextGetter),
|
||||||
base::BindRepeating(&FakeWebContentsGetter), GURL(kTestCases[i].url),
|
base::BindRepeating(&FakeWebContentsGetter), GURL(kTestCases[i].url),
|
||||||
|
@@ -195,7 +195,7 @@ bool GeneratedCodeCache::IsValidHeader(
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string GeneratedCodeCache::GetResourceURLFromKey(const std::string& key) {
|
std::string GeneratedCodeCache::GetResourceURLFromKey(const std::string& key) {
|
||||||
constexpr size_t kPrefixStringLen = base::size(kPrefix) - 1;
|
constexpr size_t kPrefixStringLen = std::size(kPrefix) - 1;
|
||||||
// |key| may not have a prefix and separator (e.g. for deduplicated entries).
|
// |key| may not have a prefix and separator (e.g. for deduplicated entries).
|
||||||
// In that case, return an empty string.
|
// In that case, return an empty string.
|
||||||
const size_t separator_index = key.find(kSeparator);
|
const size_t separator_index = key.find(kSeparator);
|
||||||
@@ -404,8 +404,8 @@ void GeneratedCodeCache::WriteEntry(const GURL& url,
|
|||||||
uint8_t result[crypto::kSHA256Length];
|
uint8_t result[crypto::kSHA256Length];
|
||||||
crypto::SHA256HashString(
|
crypto::SHA256HashString(
|
||||||
base::StringPiece(reinterpret_cast<char*>(copy.data()), copy.size()),
|
base::StringPiece(reinterpret_cast<char*>(copy.data()), copy.size()),
|
||||||
result, base::size(result));
|
result, std::size(result));
|
||||||
std::string checksum_key = base::HexEncode(result, base::size(result));
|
std::string checksum_key = base::HexEncode(result, std::size(result));
|
||||||
small_buffer = base::MakeRefCounted<net::IOBufferWithSize>(
|
small_buffer = base::MakeRefCounted<net::IOBufferWithSize>(
|
||||||
kHeaderSizeInBytes + kSHAKeySizeInBytes);
|
kHeaderSizeInBytes + kSHAKeySizeInBytes);
|
||||||
// Copy |checksum_key| into the small buffer.
|
// Copy |checksum_key| into the small buffer.
|
||||||
|
@@ -5,7 +5,6 @@
|
|||||||
#include "content/browser/devtools/devtools_io_context.h"
|
#include "content/browser/devtools/devtools_io_context.h"
|
||||||
|
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/strings/string_number_conversions.h"
|
#include "base/strings/string_number_conversions.h"
|
||||||
#include "base/task/sequenced_task_runner.h"
|
#include "base/task/sequenced_task_runner.h"
|
||||||
#include "content/browser/blob_storage/chrome_blob_storage_context.h"
|
#include "content/browser/blob_storage/chrome_blob_storage_context.h"
|
||||||
@@ -67,7 +66,7 @@ bool DevToolsIOContext::IsTextMimeType(const std::string& mime_type) {
|
|||||||
static const char* kTextMIMETypePrefixes[] = {
|
static const char* kTextMIMETypePrefixes[] = {
|
||||||
"text/", "application/x-javascript", "application/json",
|
"text/", "application/x-javascript", "application/json",
|
||||||
"application/xml"};
|
"application/xml"};
|
||||||
for (size_t i = 0; i < base::size(kTextMIMETypePrefixes); ++i) {
|
for (size_t i = 0; i < std::size(kTextMIMETypePrefixes); ++i) {
|
||||||
if (base::StartsWith(mime_type, kTextMIMETypePrefixes[i],
|
if (base::StartsWith(mime_type, kTextMIMETypePrefixes[i],
|
||||||
base::CompareCase::INSENSITIVE_ASCII))
|
base::CompareCase::INSENSITIVE_ASCII))
|
||||||
return true;
|
return true;
|
||||||
|
@@ -2,12 +2,13 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#include "content/browser/download/save_package.h"
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/files/file_path.h"
|
#include "base/files/file_path.h"
|
||||||
#include "base/files/scoped_temp_dir.h"
|
#include "base/files/scoped_temp_dir.h"
|
||||||
#include "base/run_loop.h"
|
#include "base/run_loop.h"
|
||||||
@@ -15,7 +16,6 @@
|
|||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
#include "build/build_config.h"
|
#include "build/build_config.h"
|
||||||
#include "content/browser/download/save_file_manager.h"
|
#include "content/browser/download/save_file_manager.h"
|
||||||
#include "content/browser/download/save_package.h"
|
|
||||||
#include "content/public/browser/browser_context.h"
|
#include "content/public/browser/browser_context.h"
|
||||||
#include "content/public/common/url_constants.h"
|
#include "content/public/common/url_constants.h"
|
||||||
#include "content/test/test_render_view_host.h"
|
#include "content/test/test_render_view_host.h"
|
||||||
@@ -187,7 +187,7 @@ static const struct {
|
|||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(SavePackageTest, TestSuccessfullyGenerateSavePackageFilename) {
|
TEST_F(SavePackageTest, TestSuccessfullyGenerateSavePackageFilename) {
|
||||||
for (size_t i = 0; i < base::size(kGeneratedFiles); ++i) {
|
for (size_t i = 0; i < std::size(kGeneratedFiles); ++i) {
|
||||||
base::FilePath::StringType file_name;
|
base::FilePath::StringType file_name;
|
||||||
bool ok = GetGeneratedFilename(true,
|
bool ok = GetGeneratedFilename(true,
|
||||||
kGeneratedFiles[i].disposition,
|
kGeneratedFiles[i].disposition,
|
||||||
@@ -200,7 +200,7 @@ TEST_F(SavePackageTest, TestSuccessfullyGenerateSavePackageFilename) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SavePackageTest, TestUnSuccessfullyGenerateSavePackageFilename) {
|
TEST_F(SavePackageTest, TestUnSuccessfullyGenerateSavePackageFilename) {
|
||||||
for (size_t i = 0; i < base::size(kGeneratedFiles); ++i) {
|
for (size_t i = 0; i < std::size(kGeneratedFiles); ++i) {
|
||||||
base::FilePath::StringType file_name;
|
base::FilePath::StringType file_name;
|
||||||
bool ok = GetGeneratedFilename(false,
|
bool ok = GetGeneratedFilename(false,
|
||||||
kGeneratedFiles[i].disposition,
|
kGeneratedFiles[i].disposition,
|
||||||
|
@@ -685,7 +685,7 @@ IN_PROC_BROWSER_TEST_P(FileSystemURLLoaderFactoryTest, AutoMountNoHandler) {
|
|||||||
|
|
||||||
IN_PROC_BROWSER_TEST_P(FileSystemURLLoaderFactoryTest, FileTest) {
|
IN_PROC_BROWSER_TEST_P(FileSystemURLLoaderFactoryTest, FileTest) {
|
||||||
base::ScopedAllowBlockingForTesting allow_blocking;
|
base::ScopedAllowBlockingForTesting allow_blocking;
|
||||||
WriteFile("file1.dat", kTestFileData, base::size(kTestFileData) - 1);
|
WriteFile("file1.dat", kTestFileData, std::size(kTestFileData) - 1);
|
||||||
auto client = TestLoad(CreateFileSystemURL("file1.dat"));
|
auto client = TestLoad(CreateFileSystemURL("file1.dat"));
|
||||||
|
|
||||||
EXPECT_TRUE(client->has_received_response());
|
EXPECT_TRUE(client->has_received_response());
|
||||||
@@ -707,7 +707,7 @@ IN_PROC_BROWSER_TEST_P(FileSystemURLLoaderFactoryTest, CrossOriginFileBlocked) {
|
|||||||
IsolateAllSitesForTesting(base::CommandLine::ForCurrentProcess());
|
IsolateAllSitesForTesting(base::CommandLine::ForCurrentProcess());
|
||||||
|
|
||||||
base::ScopedAllowBlockingForTesting allow_blocking;
|
base::ScopedAllowBlockingForTesting allow_blocking;
|
||||||
WriteFile("file1.dat", kTestFileData, base::size(kTestFileData) - 1);
|
WriteFile("file1.dat", kTestFileData, std::size(kTestFileData) - 1);
|
||||||
|
|
||||||
// Navigate main frame to foo.com.
|
// Navigate main frame to foo.com.
|
||||||
ASSERT_TRUE(embedded_test_server()->Start());
|
ASSERT_TRUE(embedded_test_server()->Start());
|
||||||
@@ -781,7 +781,7 @@ IN_PROC_BROWSER_TEST_P(FileSystemURLLoaderFactoryTest,
|
|||||||
IN_PROC_BROWSER_TEST_P(FileSystemURLLoaderFactoryTest,
|
IN_PROC_BROWSER_TEST_P(FileSystemURLLoaderFactoryTest,
|
||||||
FileTestMultipleRangesNotSupported) {
|
FileTestMultipleRangesNotSupported) {
|
||||||
base::ScopedAllowBlockingForTesting allow_blocking;
|
base::ScopedAllowBlockingForTesting allow_blocking;
|
||||||
WriteFile("file1.dat", kTestFileData, base::size(kTestFileData) - 1);
|
WriteFile("file1.dat", kTestFileData, std::size(kTestFileData) - 1);
|
||||||
net::HttpRequestHeaders headers;
|
net::HttpRequestHeaders headers;
|
||||||
headers.SetHeader(net::HttpRequestHeaders::kRange,
|
headers.SetHeader(net::HttpRequestHeaders::kRange,
|
||||||
"bytes=0-5,10-200,200-300");
|
"bytes=0-5,10-200,200-300");
|
||||||
@@ -794,7 +794,7 @@ IN_PROC_BROWSER_TEST_P(FileSystemURLLoaderFactoryTest,
|
|||||||
|
|
||||||
IN_PROC_BROWSER_TEST_P(FileSystemURLLoaderFactoryTest, FileRangeOutOfBounds) {
|
IN_PROC_BROWSER_TEST_P(FileSystemURLLoaderFactoryTest, FileRangeOutOfBounds) {
|
||||||
base::ScopedAllowBlockingForTesting allow_blocking;
|
base::ScopedAllowBlockingForTesting allow_blocking;
|
||||||
WriteFile("file1.dat", kTestFileData, base::size(kTestFileData) - 1);
|
WriteFile("file1.dat", kTestFileData, std::size(kTestFileData) - 1);
|
||||||
net::HttpRequestHeaders headers;
|
net::HttpRequestHeaders headers;
|
||||||
headers.SetHeader(net::HttpRequestHeaders::kRange,
|
headers.SetHeader(net::HttpRequestHeaders::kRange,
|
||||||
net::HttpByteRange::Bounded(500, 1000).GetHeaderValue());
|
net::HttpByteRange::Bounded(500, 1000).GetHeaderValue());
|
||||||
@@ -838,7 +838,7 @@ IN_PROC_BROWSER_TEST_P(FileSystemURLLoaderFactoryTest, NoSuchFile) {
|
|||||||
|
|
||||||
IN_PROC_BROWSER_TEST_P(FileSystemURLLoaderFactoryTest, FileCancel) {
|
IN_PROC_BROWSER_TEST_P(FileSystemURLLoaderFactoryTest, FileCancel) {
|
||||||
base::ScopedAllowBlockingForTesting allow_blocking;
|
base::ScopedAllowBlockingForTesting allow_blocking;
|
||||||
WriteFile("file1.dat", kTestFileData, base::size(kTestFileData) - 1);
|
WriteFile("file1.dat", kTestFileData, std::size(kTestFileData) - 1);
|
||||||
auto client = TestLoadNoRun(CreateFileSystemURL("file1.dat"));
|
auto client = TestLoadNoRun(CreateFileSystemURL("file1.dat"));
|
||||||
|
|
||||||
// client.reset();
|
// client.reset();
|
||||||
@@ -872,7 +872,7 @@ IN_PROC_BROWSER_TEST_P(FileSystemURLLoaderFactoryTest, FileGetMimeType) {
|
|||||||
|
|
||||||
IN_PROC_BROWSER_TEST_P(FileSystemURLLoaderFactoryTest, FileIncognito) {
|
IN_PROC_BROWSER_TEST_P(FileSystemURLLoaderFactoryTest, FileIncognito) {
|
||||||
base::ScopedAllowBlockingForTesting allow_blocking;
|
base::ScopedAllowBlockingForTesting allow_blocking;
|
||||||
WriteFile("file", kTestFileData, base::size(kTestFileData) - 1);
|
WriteFile("file", kTestFileData, std::size(kTestFileData) - 1);
|
||||||
|
|
||||||
// Creates a new filesystem context for incognito mode.
|
// Creates a new filesystem context for incognito mode.
|
||||||
scoped_refptr<FileSystemContext> file_system_context =
|
scoped_refptr<FileSystemContext> file_system_context =
|
||||||
|
@@ -99,7 +99,7 @@ class HashCalculator : public base::RefCounted<HashCalculator> {
|
|||||||
}
|
}
|
||||||
if (bytes_read == 0) {
|
if (bytes_read == 0) {
|
||||||
std::string hash_str(hash_->GetHashLength(), 0);
|
std::string hash_str(hash_->GetHashLength(), 0);
|
||||||
hash_->Finish(base::data(hash_str), hash_str.size());
|
hash_->Finish(std::data(hash_str), hash_str.size());
|
||||||
std::move(callback_).Run(base::File::FILE_OK, hash_str, file_size_);
|
std::move(callback_).Run(base::File::FILE_OK, hash_str, file_size_);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/test/scoped_feature_list.h"
|
#include "base/test/scoped_feature_list.h"
|
||||||
#include "base/threading/thread_restrictions.h"
|
#include "base/threading/thread_restrictions.h"
|
||||||
#include "build/build_config.h"
|
#include "build/build_config.h"
|
||||||
@@ -157,7 +156,7 @@ IN_PROC_BROWSER_TEST_F(FontUniqueNameBrowserTest,
|
|||||||
|
|
||||||
unsigned num_added_nodes = static_cast<unsigned>(
|
unsigned num_added_nodes = static_cast<unsigned>(
|
||||||
content::EvalJs(shell(), "addTestNodes()").ExtractInt());
|
content::EvalJs(shell(), "addTestNodes()").ExtractInt());
|
||||||
ASSERT_EQ(num_added_nodes, base::size(kExpectedFontFamilyNames));
|
ASSERT_EQ(num_added_nodes, std::size(kExpectedFontFamilyNames));
|
||||||
|
|
||||||
std::unique_ptr<base::DictionaryValue> params =
|
std::unique_ptr<base::DictionaryValue> params =
|
||||||
std::make_unique<base::DictionaryValue>();
|
std::make_unique<base::DictionaryValue>();
|
||||||
@@ -177,7 +176,7 @@ IN_PROC_BROWSER_TEST_F(FontUniqueNameBrowserTest,
|
|||||||
result->FindKeyOfType("nodeIds", base::Value::Type::LIST)->Clone();
|
result->FindKeyOfType("nodeIds", base::Value::Type::LIST)->Clone();
|
||||||
base::Value::ConstListView nodes_view = node_list.GetListDeprecated();
|
base::Value::ConstListView nodes_view = node_list.GetListDeprecated();
|
||||||
ASSERT_EQ(nodes_view.size(), num_added_nodes);
|
ASSERT_EQ(nodes_view.size(), num_added_nodes);
|
||||||
ASSERT_EQ(nodes_view.size(), base::size(kExpectedFontFamilyNames));
|
ASSERT_EQ(nodes_view.size(), std::size(kExpectedFontFamilyNames));
|
||||||
for (size_t i = 0; i < nodes_view.size(); ++i) {
|
for (size_t i = 0; i < nodes_view.size(); ++i) {
|
||||||
const base::Value& nodeId = nodes_view[i];
|
const base::Value& nodeId = nodes_view[i];
|
||||||
params = std::make_unique<base::DictionaryValue>();
|
params = std::make_unique<base::DictionaryValue>();
|
||||||
|
@@ -2,21 +2,20 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#include "testing/gtest/include/gtest/gtest.h"
|
#include "content/browser/font_unique_name_lookup/font_unique_name_lookup.h"
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "base/android/build_info.h"
|
#include "base/android/build_info.h"
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/files/file.h"
|
#include "base/files/file.h"
|
||||||
#include "base/files/file_enumerator.h"
|
#include "base/files/file_enumerator.h"
|
||||||
#include "base/files/file_util.h"
|
#include "base/files/file_util.h"
|
||||||
#include "base/files/scoped_temp_dir.h"
|
#include "base/files/scoped_temp_dir.h"
|
||||||
#include "base/strings/string_util.h"
|
#include "base/strings/string_util.h"
|
||||||
#include "content/browser/font_unique_name_lookup/font_unique_name_lookup.h"
|
#include "testing/gtest/include/gtest/gtest.h"
|
||||||
#include "third_party/blink/public/common/font_unique_name_lookup/font_table_matcher.h"
|
#include "third_party/blink/public/common/font_unique_name_lookup/font_table_matcher.h"
|
||||||
|
|
||||||
#include <functional>
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
static const char* const kAndroidFontPaths[] = {"/system/fonts",
|
static const char* const kAndroidFontPaths[] = {"/system/fonts",
|
||||||
@@ -231,7 +230,7 @@ size_t GetNumTables(base::File& font_file) {
|
|||||||
font_file.Seek(base::File::FROM_BEGIN, 5);
|
font_file.Seek(base::File::FROM_BEGIN, 5);
|
||||||
uint8_t num_tables_bytes[2] = {};
|
uint8_t num_tables_bytes[2] = {};
|
||||||
font_file.ReadAtCurrentPos(reinterpret_cast<char*>(num_tables_bytes),
|
font_file.ReadAtCurrentPos(reinterpret_cast<char*>(num_tables_bytes),
|
||||||
base::size(num_tables_bytes));
|
std::size(num_tables_bytes));
|
||||||
uint16_t num_tables =
|
uint16_t num_tables =
|
||||||
static_cast<uint16_t>(num_tables_bytes[0] + (num_tables_bytes[1] << 8));
|
static_cast<uint16_t>(num_tables_bytes[0] + (num_tables_bytes[1] << 8));
|
||||||
return num_tables;
|
return num_tables;
|
||||||
@@ -265,7 +264,7 @@ class FontFileCorruptor {
|
|||||||
for (size_t i = 0; i < num_tables; ++i) {
|
for (size_t i = 0; i < num_tables; ++i) {
|
||||||
CHECK_EQ(static_cast<int>(kSizeOneTableRecord),
|
CHECK_EQ(static_cast<int>(kSizeOneTableRecord),
|
||||||
font_file.Write(kOffsetTableRecords + i * kSizeOneTableRecord,
|
font_file.Write(kOffsetTableRecords + i * kSizeOneTableRecord,
|
||||||
garbage, base::size(garbage)));
|
garbage, std::size(garbage)));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -221,8 +221,8 @@ const GpuFeatureData GetGpuFeatureData(
|
|||||||
{"direct_rendering_display_compositor", gpu::kGpuFeatureStatusEnabled,
|
{"direct_rendering_display_compositor", gpu::kGpuFeatureStatusEnabled,
|
||||||
!features::IsDrDcEnabled(), DisableInfo::NotProblem(), false},
|
!features::IsDrDcEnabled(), DisableInfo::NotProblem(), false},
|
||||||
};
|
};
|
||||||
DCHECK(index < base::size(kGpuFeatureData));
|
DCHECK(index < std::size(kGpuFeatureData));
|
||||||
*eof = (index == base::size(kGpuFeatureData) - 1);
|
*eof = (index == std::size(kGpuFeatureData) - 1);
|
||||||
return kGpuFeatureData[index];
|
return kGpuFeatureData[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -19,8 +19,8 @@ const GpuControlList::Entry kGpuDataManagerTestingEntries[] = {
|
|||||||
{
|
{
|
||||||
1, // id
|
1, // id
|
||||||
"GpuDataManagerImplPrivateTest.GpuSideBlocklisting.0",
|
"GpuDataManagerImplPrivateTest.GpuSideBlocklisting.0",
|
||||||
base::size(kFeatureListForGpuManagerTestingEntry1), // features size
|
std::size(kFeatureListForGpuManagerTestingEntry1), // features size
|
||||||
kFeatureListForGpuManagerTestingEntry1, // features
|
kFeatureListForGpuManagerTestingEntry1, // features
|
||||||
0, // DisabledExtensions size
|
0, // DisabledExtensions size
|
||||||
nullptr, // DisabledExtensions
|
nullptr, // DisabledExtensions
|
||||||
0, // DisabledWebGLExtensions size
|
0, // DisabledWebGLExtensions size
|
||||||
@@ -53,8 +53,8 @@ const GpuControlList::Entry kGpuDataManagerTestingEntries[] = {
|
|||||||
{
|
{
|
||||||
2, // id
|
2, // id
|
||||||
"GpuDataManagerImplPrivateTest.GpuSideBlocklisting.1",
|
"GpuDataManagerImplPrivateTest.GpuSideBlocklisting.1",
|
||||||
base::size(kFeatureListForGpuManagerTestingEntry2), // features size
|
std::size(kFeatureListForGpuManagerTestingEntry2), // features size
|
||||||
kFeatureListForGpuManagerTestingEntry2, // features
|
kFeatureListForGpuManagerTestingEntry2, // features
|
||||||
0, // DisabledExtensions size
|
0, // DisabledExtensions size
|
||||||
nullptr, // DisabledExtensions
|
nullptr, // DisabledExtensions
|
||||||
0, // DisabledWebGLExtensions size
|
0, // DisabledWebGLExtensions size
|
||||||
@@ -87,8 +87,8 @@ const GpuControlList::Entry kGpuDataManagerTestingEntries[] = {
|
|||||||
{
|
{
|
||||||
3, // id
|
3, // id
|
||||||
"GpuDataManagerImplPrivateTest.GpuSideBlocklistingWebGL.0",
|
"GpuDataManagerImplPrivateTest.GpuSideBlocklistingWebGL.0",
|
||||||
base::size(kFeatureListForGpuManagerTestingEntry3), // features size
|
std::size(kFeatureListForGpuManagerTestingEntry3), // features size
|
||||||
kFeatureListForGpuManagerTestingEntry3, // features
|
kFeatureListForGpuManagerTestingEntry3, // features
|
||||||
0, // DisabledExtensions size
|
0, // DisabledExtensions size
|
||||||
nullptr, // DisabledExtensions
|
nullptr, // DisabledExtensions
|
||||||
0, // DisabledWebGLExtensions size
|
0, // DisabledWebGLExtensions size
|
||||||
@@ -121,8 +121,8 @@ const GpuControlList::Entry kGpuDataManagerTestingEntries[] = {
|
|||||||
{
|
{
|
||||||
4, // id
|
4, // id
|
||||||
"GpuDataManagerImplPrivateTest.GpuSideBlocklistingWebGL.1",
|
"GpuDataManagerImplPrivateTest.GpuSideBlocklistingWebGL.1",
|
||||||
base::size(kFeatureListForGpuManagerTestingEntry4), // features size
|
std::size(kFeatureListForGpuManagerTestingEntry4), // features size
|
||||||
kFeatureListForGpuManagerTestingEntry4, // features
|
kFeatureListForGpuManagerTestingEntry4, // features
|
||||||
0, // DisabledExtensions size
|
0, // DisabledExtensions size
|
||||||
nullptr, // DisabledExtensions
|
nullptr, // DisabledExtensions
|
||||||
0, // DisabledWebGLExtensions size
|
0, // DisabledWebGLExtensions size
|
||||||
@@ -155,8 +155,8 @@ const GpuControlList::Entry kGpuDataManagerTestingEntries[] = {
|
|||||||
{
|
{
|
||||||
5, // id
|
5, // id
|
||||||
"GpuDataManagerImplPrivateTest.GpuSideException",
|
"GpuDataManagerImplPrivateTest.GpuSideException",
|
||||||
base::size(kFeatureListForGpuManagerTestingEntry5), // features size
|
std::size(kFeatureListForGpuManagerTestingEntry5), // features size
|
||||||
kFeatureListForGpuManagerTestingEntry5, // features
|
kFeatureListForGpuManagerTestingEntry5, // features
|
||||||
0, // DisabledExtensions size
|
0, // DisabledExtensions size
|
||||||
nullptr, // DisabledExtensions
|
nullptr, // DisabledExtensions
|
||||||
0, // DisabledWebGLExtensions size
|
0, // DisabledWebGLExtensions size
|
||||||
@@ -183,14 +183,14 @@ const GpuControlList::Entry kGpuDataManagerTestingEntries[] = {
|
|||||||
nullptr}, // intel_gpu_generation
|
nullptr}, // intel_gpu_generation
|
||||||
&kMoreForEntry5_572251052, // more data
|
&kMoreForEntry5_572251052, // more data
|
||||||
},
|
},
|
||||||
base::size(kExceptionsForEntry5), // exceptions count
|
std::size(kExceptionsForEntry5), // exceptions count
|
||||||
kExceptionsForEntry5, // exceptions
|
kExceptionsForEntry5, // exceptions
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
6, // id
|
6, // id
|
||||||
"GpuDataManagerImplPrivateTest.BlocklistAllFeatures",
|
"GpuDataManagerImplPrivateTest.BlocklistAllFeatures",
|
||||||
base::size(kFeatureListForGpuManagerTestingEntry6), // features size
|
std::size(kFeatureListForGpuManagerTestingEntry6), // features size
|
||||||
kFeatureListForGpuManagerTestingEntry6, // features
|
kFeatureListForGpuManagerTestingEntry6, // features
|
||||||
0, // DisabledExtensions size
|
0, // DisabledExtensions size
|
||||||
nullptr, // DisabledExtensions
|
nullptr, // DisabledExtensions
|
||||||
0, // DisabledWebGLExtensions size
|
0, // DisabledWebGLExtensions size
|
||||||
|
@@ -619,7 +619,7 @@ void GpuProcessHost::GetHasGpuProcess(base::OnceCallback<void(bool)> callback) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bool has_gpu = false;
|
bool has_gpu = false;
|
||||||
for (size_t i = 0; i < base::size(g_gpu_process_hosts); ++i) {
|
for (size_t i = 0; i < std::size(g_gpu_process_hosts); ++i) {
|
||||||
GpuProcessHost* host = g_gpu_process_hosts[i];
|
GpuProcessHost* host = g_gpu_process_hosts[i];
|
||||||
if (host && ValidateHost(host)) {
|
if (host && ValidateHost(host)) {
|
||||||
has_gpu = true;
|
has_gpu = true;
|
||||||
@@ -1198,7 +1198,7 @@ bool GpuProcessHost::LaunchGpuProcess() {
|
|||||||
// If you want a browser command-line switch passed to the GPU process
|
// If you want a browser command-line switch passed to the GPU process
|
||||||
// you need to add it to |kSwitchNames| at the beginning of this file.
|
// you need to add it to |kSwitchNames| at the beginning of this file.
|
||||||
cmd_line->CopySwitchesFrom(browser_command_line, kSwitchNames,
|
cmd_line->CopySwitchesFrom(browser_command_line, kSwitchNames,
|
||||||
base::size(kSwitchNames));
|
std::size(kSwitchNames));
|
||||||
cmd_line->CopySwitchesFrom(
|
cmd_line->CopySwitchesFrom(
|
||||||
browser_command_line, switches::kGLSwitchesCopiedFromGpuProcessHost,
|
browser_command_line, switches::kGLSwitchesCopiedFromGpuProcessHost,
|
||||||
switches::kGLSwitchesCopiedFromGpuProcessHostNumSwitches);
|
switches::kGLSwitchesCopiedFromGpuProcessHostNumSwitches);
|
||||||
|
@@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/memory/ref_counted.h"
|
#include "base/memory/ref_counted.h"
|
||||||
#include "base/test/simple_test_clock.h"
|
#include "base/test/simple_test_clock.h"
|
||||||
#include "content/public/test/browser_task_environment.h"
|
#include "content/public/test/browser_task_environment.h"
|
||||||
@@ -72,8 +71,8 @@ TEST_F(HostZoomMapTest, GetAllZoomLevels) {
|
|||||||
zoomed},
|
zoomed},
|
||||||
{HostZoomMap::ZOOM_CHANGED_FOR_SCHEME_AND_HOST, "zoomed.com", "https",
|
{HostZoomMap::ZOOM_CHANGED_FOR_SCHEME_AND_HOST, "zoomed.com", "https",
|
||||||
zoomed}, };
|
zoomed}, };
|
||||||
ASSERT_EQ(base::size(expected), levels.size());
|
ASSERT_EQ(std::size(expected), levels.size());
|
||||||
for (size_t i = 0; i < base::size(expected); ++i) {
|
for (size_t i = 0; i < std::size(expected); ++i) {
|
||||||
SCOPED_TRACE(testing::Message() << "levels[" << i << "]");
|
SCOPED_TRACE(testing::Message() << "levels[" << i << "]");
|
||||||
EXPECT_EQ(expected[i].mode, levels[i].mode);
|
EXPECT_EQ(expected[i].mode, levels[i].mode);
|
||||||
EXPECT_EQ(expected[i].scheme, levels[i].scheme);
|
EXPECT_EQ(expected[i].scheme, levels[i].scheme);
|
||||||
@@ -108,8 +107,8 @@ TEST_F(HostZoomMapTest, LastModifiedTimestamp) {
|
|||||||
{HostZoomMap::ZOOM_CHANGED_FOR_SCHEME_AND_HOST, "login", "chrome", 3.0,
|
{HostZoomMap::ZOOM_CHANGED_FOR_SCHEME_AND_HOST, "login", "chrome", 3.0,
|
||||||
base::Time()},
|
base::Time()},
|
||||||
};
|
};
|
||||||
ASSERT_EQ(base::size(expected), levels.size());
|
ASSERT_EQ(std::size(expected), levels.size());
|
||||||
for (size_t i = 0; i < base::size(expected); ++i) {
|
for (size_t i = 0; i < std::size(expected); ++i) {
|
||||||
SCOPED_TRACE(testing::Message() << "levels[" << i << "]");
|
SCOPED_TRACE(testing::Message() << "levels[" << i << "]");
|
||||||
EXPECT_EQ(expected[i].mode, levels[i].mode);
|
EXPECT_EQ(expected[i].mode, levels[i].mode);
|
||||||
EXPECT_EQ(expected[i].scheme, levels[i].scheme);
|
EXPECT_EQ(expected[i].scheme, levels[i].scheme);
|
||||||
|
@@ -16,7 +16,6 @@
|
|||||||
#include "base/callback.h"
|
#include "base/callback.h"
|
||||||
#include "base/check_op.h"
|
#include "base/check_op.h"
|
||||||
#include "base/containers/span.h"
|
#include "base/containers/span.h"
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/files/file_util.h"
|
#include "base/files/file_util.h"
|
||||||
#include "base/files/scoped_temp_dir.h"
|
#include "base/files/scoped_temp_dir.h"
|
||||||
#include "base/guid.h"
|
#include "base/guid.h"
|
||||||
@@ -1009,7 +1008,7 @@ TEST_P(IndexedDBBackingStoreTestWithExternalObjects, DeleteRange) {
|
|||||||
IndexedDBKeyRange(keys[1], keys[3], false, true),
|
IndexedDBKeyRange(keys[1], keys[3], false, true),
|
||||||
IndexedDBKeyRange(keys[0], keys[3], true, true)};
|
IndexedDBKeyRange(keys[0], keys[3], true, true)};
|
||||||
|
|
||||||
for (size_t i = 0; i < base::size(ranges); ++i) {
|
for (size_t i = 0; i < std::size(ranges); ++i) {
|
||||||
const int64_t database_id = 1;
|
const int64_t database_id = 1;
|
||||||
const int64_t object_store_id = i + 1;
|
const int64_t object_store_id = i + 1;
|
||||||
const IndexedDBKeyRange& range = ranges[i];
|
const IndexedDBKeyRange& range = ranges[i];
|
||||||
@@ -1104,7 +1103,7 @@ TEST_P(IndexedDBBackingStoreTestWithExternalObjects, DeleteRangeEmptyRange) {
|
|||||||
IndexedDBKeyRange(keys[2], keys[1], false, false),
|
IndexedDBKeyRange(keys[2], keys[1], false, false),
|
||||||
IndexedDBKeyRange(keys[2], keys[1], true, true)};
|
IndexedDBKeyRange(keys[2], keys[1], true, true)};
|
||||||
|
|
||||||
for (size_t i = 0; i < base::size(ranges); ++i) {
|
for (size_t i = 0; i < std::size(ranges); ++i) {
|
||||||
const int64_t database_id = 1;
|
const int64_t database_id = 1;
|
||||||
const int64_t object_store_id = i + 1;
|
const int64_t object_store_id = i + 1;
|
||||||
const IndexedDBKeyRange& range = ranges[i];
|
const IndexedDBKeyRange& range = ranges[i];
|
||||||
|
@@ -12,7 +12,6 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/strings/string_piece.h"
|
#include "base/strings/string_piece.h"
|
||||||
#include "components/services/storage/indexed_db/scopes/varint_coding.h"
|
#include "components/services/storage/indexed_db/scopes/varint_coding.h"
|
||||||
#include "testing/gtest/include/gtest/gtest.h"
|
#include "testing/gtest/include/gtest/gtest.h"
|
||||||
@@ -557,7 +556,7 @@ TEST(IndexedDBLevelDBCodingTest, EncodeDecodeIDBKeyPath) {
|
|||||||
0 // Type is null
|
0 // Type is null
|
||||||
};
|
};
|
||||||
encoded_paths.push_back(
|
encoded_paths.push_back(
|
||||||
std::string(expected, expected + base::size(expected)));
|
std::string(expected, expected + std::size(expected)));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -567,7 +566,7 @@ TEST(IndexedDBLevelDBCodingTest, EncodeDecodeIDBKeyPath) {
|
|||||||
0 // Length is 0
|
0 // Length is 0
|
||||||
};
|
};
|
||||||
encoded_paths.push_back(
|
encoded_paths.push_back(
|
||||||
std::string(expected, expected + base::size(expected)));
|
std::string(expected, expected + std::size(expected)));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -577,7 +576,7 @@ TEST(IndexedDBLevelDBCodingTest, EncodeDecodeIDBKeyPath) {
|
|||||||
3, 0, 'f', 0, 'o', 0, 'o' // String length 3, UTF-16BE
|
3, 0, 'f', 0, 'o', 0, 'o' // String length 3, UTF-16BE
|
||||||
};
|
};
|
||||||
encoded_paths.push_back(
|
encoded_paths.push_back(
|
||||||
std::string(expected, expected + base::size(expected)));
|
std::string(expected, expected + std::size(expected)));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -588,7 +587,7 @@ TEST(IndexedDBLevelDBCodingTest, EncodeDecodeIDBKeyPath) {
|
|||||||
'r' // String length 7, UTF-16BE
|
'r' // String length 7, UTF-16BE
|
||||||
};
|
};
|
||||||
encoded_paths.push_back(
|
encoded_paths.push_back(
|
||||||
std::string(expected, expected + base::size(expected)));
|
std::string(expected, expected + std::size(expected)));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -603,7 +602,7 @@ TEST(IndexedDBLevelDBCodingTest, EncodeDecodeIDBKeyPath) {
|
|||||||
'r' // Member 3 (String length 7)
|
'r' // Member 3 (String length 7)
|
||||||
};
|
};
|
||||||
encoded_paths.push_back(
|
encoded_paths.push_back(
|
||||||
std::string(expected, expected + base::size(expected)));
|
std::string(expected, expected + std::size(expected)));
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT_EQ(key_paths.size(), encoded_paths.size());
|
ASSERT_EQ(key_paths.size(), encoded_paths.size());
|
||||||
@@ -685,12 +684,12 @@ TEST(IndexedDBLevelDBCodingTest, DecodeLegacyIDBKeyPath) {
|
|||||||
{
|
{
|
||||||
key_paths.emplace_back(u"foo");
|
key_paths.emplace_back(u"foo");
|
||||||
char expected[] = {0, 'f', 0, 'o', 0, 'o'};
|
char expected[] = {0, 'f', 0, 'o', 0, 'o'};
|
||||||
encoded_paths.push_back(std::string(expected, base::size(expected)));
|
encoded_paths.push_back(std::string(expected, std::size(expected)));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
key_paths.emplace_back(u"foo.bar");
|
key_paths.emplace_back(u"foo.bar");
|
||||||
char expected[] = {0, 'f', 0, 'o', 0, 'o', 0, '.', 0, 'b', 0, 'a', 0, 'r'};
|
char expected[] = {0, 'f', 0, 'o', 0, 'o', 0, '.', 0, 'b', 0, 'a', 0, 'r'};
|
||||||
encoded_paths.push_back(std::string(expected, base::size(expected)));
|
encoded_paths.push_back(std::string(expected, std::size(expected)));
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT_EQ(key_paths.size(), encoded_paths.size());
|
ASSERT_EQ(key_paths.size(), encoded_paths.size());
|
||||||
|
@@ -137,7 +137,7 @@ std::string ReadCorruptionInfo(storage::FilesystemProxy* filesystem_proxy,
|
|||||||
if (file.IsValid()) {
|
if (file.IsValid()) {
|
||||||
std::string input_js(file_info->size, '\0');
|
std::string input_js(file_info->size, '\0');
|
||||||
if (file_info->size ==
|
if (file_info->size ==
|
||||||
file.Read(0, base::data(input_js), file_info->size)) {
|
file.Read(0, std::data(input_js), file_info->size)) {
|
||||||
absl::optional<base::Value> val = base::JSONReader::Read(input_js);
|
absl::optional<base::Value> val = base::JSONReader::Read(input_js);
|
||||||
if (val && val->is_dict()) {
|
if (val && val->is_dict()) {
|
||||||
std::string* s = val->FindStringKey("message");
|
std::string* s = val->FindStringKey("message");
|
||||||
|
@@ -12,7 +12,6 @@
|
|||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/callback.h"
|
#include "base/callback.h"
|
||||||
#include "base/check.h"
|
#include "base/check.h"
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/run_loop.h"
|
#include "base/run_loop.h"
|
||||||
#include "base/strings/stringprintf.h"
|
#include "base/strings/stringprintf.h"
|
||||||
#include "base/test/bind.h"
|
#include "base/test/bind.h"
|
||||||
@@ -1301,7 +1300,7 @@ TEST_F(AuctionWorkletManagerTest, BidderWorkletUrlRequestProtection) {
|
|||||||
"application/json"},
|
"application/json"},
|
||||||
};
|
};
|
||||||
|
|
||||||
for (size_t i = 0; i < base::size(kAllowedUrls); ++i) {
|
for (size_t i = 0; i < std::size(kAllowedUrls); ++i) {
|
||||||
network::ResourceRequest request;
|
network::ResourceRequest request;
|
||||||
request.url = kAllowedUrls[i].url;
|
request.url = kAllowedUrls[i].url;
|
||||||
request.headers.SetHeader(net::HttpRequestHeaders::kAccept,
|
request.headers.SetHeader(net::HttpRequestHeaders::kAccept,
|
||||||
@@ -1332,7 +1331,7 @@ TEST_F(AuctionWorkletManagerTest, BidderWorkletUrlRequestProtection) {
|
|||||||
net::MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS));
|
net::MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS));
|
||||||
bidder_worklet->url_loader_factory().FlushForTesting();
|
bidder_worklet->url_loader_factory().FlushForTesting();
|
||||||
EXPECT_FALSE(bidder_worklet->url_loader_factory().is_connected());
|
EXPECT_FALSE(bidder_worklet->url_loader_factory().is_connected());
|
||||||
EXPECT_EQ(base::size(kAllowedUrls),
|
EXPECT_EQ(std::size(kAllowedUrls),
|
||||||
url_loader_factory_.pending_requests()->size());
|
url_loader_factory_.pending_requests()->size());
|
||||||
EXPECT_EQ("Unexpected request", TakeBadMessage());
|
EXPECT_EQ("Unexpected request", TakeBadMessage());
|
||||||
}
|
}
|
||||||
@@ -1361,7 +1360,7 @@ TEST_F(AuctionWorkletManagerTest, SellerWorkletUrlRequestProtection) {
|
|||||||
"application/json"},
|
"application/json"},
|
||||||
};
|
};
|
||||||
|
|
||||||
for (size_t i = 0; i < base::size(kAllowedUrls); ++i) {
|
for (size_t i = 0; i < std::size(kAllowedUrls); ++i) {
|
||||||
network::ResourceRequest request;
|
network::ResourceRequest request;
|
||||||
request.url = kAllowedUrls[i].url;
|
request.url = kAllowedUrls[i].url;
|
||||||
request.headers.SetHeader(net::HttpRequestHeaders::kAccept,
|
request.headers.SetHeader(net::HttpRequestHeaders::kAccept,
|
||||||
@@ -1392,7 +1391,7 @@ TEST_F(AuctionWorkletManagerTest, SellerWorkletUrlRequestProtection) {
|
|||||||
net::MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS));
|
net::MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS));
|
||||||
seller_worklet->url_loader_factory().FlushForTesting();
|
seller_worklet->url_loader_factory().FlushForTesting();
|
||||||
EXPECT_FALSE(seller_worklet->url_loader_factory().is_connected());
|
EXPECT_FALSE(seller_worklet->url_loader_factory().is_connected());
|
||||||
EXPECT_EQ(base::size(kAllowedUrls),
|
EXPECT_EQ(std::size(kAllowedUrls),
|
||||||
url_loader_factory_.pending_requests()->size());
|
url_loader_factory_.pending_requests()->size());
|
||||||
EXPECT_EQ("Unexpected request", TakeBadMessage());
|
EXPECT_EQ("Unexpected request", TakeBadMessage());
|
||||||
}
|
}
|
||||||
|
@@ -72,7 +72,7 @@ class LaunchAsMojoClientBrowserTest : public ContentBrowserTest {
|
|||||||
switches::kOzonePlatform,
|
switches::kOzonePlatform,
|
||||||
};
|
};
|
||||||
command_line.CopySwitchesFrom(cmdline, kSwitchesToCopy,
|
command_line.CopySwitchesFrom(cmdline, kSwitchesToCopy,
|
||||||
base::size(kSwitchesToCopy));
|
std::size(kSwitchesToCopy));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||||
|
@@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
#include "base/base64.h"
|
#include "base/base64.h"
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/location.h"
|
#include "base/location.h"
|
||||||
#include "base/no_destructor.h"
|
#include "base/no_destructor.h"
|
||||||
#include "base/time/time.h"
|
#include "base/time/time.h"
|
||||||
@@ -22,9 +21,9 @@ const int kApprovedStreamTimeToLiveSeconds = 10;
|
|||||||
|
|
||||||
std::string GenerateRandomStreamId() {
|
std::string GenerateRandomStreamId() {
|
||||||
char buffer[kStreamIdLengthBytes];
|
char buffer[kStreamIdLengthBytes];
|
||||||
crypto::RandBytes(buffer, base::size(buffer));
|
crypto::RandBytes(buffer, std::size(buffer));
|
||||||
std::string result;
|
std::string result;
|
||||||
base::Base64Encode(base::StringPiece(buffer, base::size(buffer)), &result);
|
base::Base64Encode(base::StringPiece(buffer, std::size(buffer)), &result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -13,7 +13,6 @@
|
|||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/containers/adapters.h"
|
#include "base/containers/adapters.h"
|
||||||
#include "base/containers/cxx20_erase.h"
|
#include "base/containers/cxx20_erase.h"
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/feature_list.h"
|
#include "base/feature_list.h"
|
||||||
#include "base/memory/raw_ptr.h"
|
#include "base/memory/raw_ptr.h"
|
||||||
#include "base/metrics/field_trial_params.h"
|
#include "base/metrics/field_trial_params.h"
|
||||||
@@ -74,7 +73,7 @@ std::string EffectsToString(int effects) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
std::string ret;
|
std::string ret;
|
||||||
for (size_t i = 0; i < base::size(flags); ++i) {
|
for (size_t i = 0; i < std::size(flags); ++i) {
|
||||||
if (effects & flags[i].flag) {
|
if (effects & flags[i].flag) {
|
||||||
if (!ret.empty())
|
if (!ret.empty())
|
||||||
ret += " | ";
|
ret += " | ";
|
||||||
|
@@ -130,7 +130,7 @@ class MidiSessionClientForTesting : public midi::mojom::MidiSessionClient {
|
|||||||
|
|
||||||
class MidiHostTest : public testing::Test {
|
class MidiHostTest : public testing::Test {
|
||||||
public:
|
public:
|
||||||
MidiHostTest() : data_(kNoteOn, kNoteOn + base::size(kNoteOn)), port_id_(0) {
|
MidiHostTest() : data_(kNoteOn, kNoteOn + std::size(kNoteOn)), port_id_(0) {
|
||||||
browser_context_ = std::make_unique<TestBrowserContext>();
|
browser_context_ = std::make_unique<TestBrowserContext>();
|
||||||
rph_ = std::make_unique<MockRenderProcessHost>(browser_context_.get());
|
rph_ = std::make_unique<MockRenderProcessHost>(browser_context_.get());
|
||||||
std::unique_ptr<FakeMidiManagerFactory> factory =
|
std::unique_ptr<FakeMidiManagerFactory> factory =
|
||||||
|
@@ -2,14 +2,14 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#include "content/browser/notifications/notification_database_conversions.h"
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/strings/string_number_conversions.h"
|
#include "base/strings/string_number_conversions.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
#include "base/time/time.h"
|
#include "base/time/time.h"
|
||||||
#include "content/browser/notifications/notification_database_conversions.h"
|
|
||||||
#include "content/browser/notifications/notification_database_data.pb.h"
|
#include "content/browser/notifications/notification_database_data.pb.h"
|
||||||
#include "content/browser/notifications/notification_database_resources.pb.h"
|
#include "content/browser/notifications/notification_database_resources.pb.h"
|
||||||
#include "content/public/browser/notification_database_data.h"
|
#include "content/public/browser/notification_database_data.h"
|
||||||
@@ -64,11 +64,10 @@ const bool kHasTriggered = true;
|
|||||||
TEST(NotificationDatabaseConversionsTest, SerializeAndDeserializeData) {
|
TEST(NotificationDatabaseConversionsTest, SerializeAndDeserializeData) {
|
||||||
std::vector<int> vibration_pattern(
|
std::vector<int> vibration_pattern(
|
||||||
kNotificationVibrationPattern,
|
kNotificationVibrationPattern,
|
||||||
kNotificationVibrationPattern +
|
kNotificationVibrationPattern + std::size(kNotificationVibrationPattern));
|
||||||
base::size(kNotificationVibrationPattern));
|
|
||||||
|
|
||||||
std::vector<char> developer_data(
|
std::vector<char> developer_data(
|
||||||
kNotificationData, kNotificationData + base::size(kNotificationData));
|
kNotificationData, kNotificationData + std::size(kNotificationData));
|
||||||
|
|
||||||
blink::PlatformNotificationData notification_data;
|
blink::PlatformNotificationData notification_data;
|
||||||
notification_data.title = kNotificationTitle;
|
notification_data.title = kNotificationTitle;
|
||||||
@@ -256,7 +255,7 @@ TEST(NotificationDatabaseConversionsTest, SerializeAndDeserializeDirections) {
|
|||||||
blink::mojom::NotificationDirection::RIGHT_TO_LEFT,
|
blink::mojom::NotificationDirection::RIGHT_TO_LEFT,
|
||||||
blink::mojom::NotificationDirection::AUTO};
|
blink::mojom::NotificationDirection::AUTO};
|
||||||
|
|
||||||
for (size_t i = 0; i < base::size(directions); ++i) {
|
for (size_t i = 0; i < std::size(directions); ++i) {
|
||||||
blink::PlatformNotificationData notification_data;
|
blink::PlatformNotificationData notification_data;
|
||||||
notification_data.direction = directions[i];
|
notification_data.direction = directions[i];
|
||||||
|
|
||||||
@@ -282,7 +281,7 @@ TEST(NotificationDatabaseConversionsTest,
|
|||||||
NotificationDatabaseData::ClosedReason::DEVELOPER,
|
NotificationDatabaseData::ClosedReason::DEVELOPER,
|
||||||
NotificationDatabaseData::ClosedReason::UNKNOWN};
|
NotificationDatabaseData::ClosedReason::UNKNOWN};
|
||||||
|
|
||||||
for (size_t i = 0; i < base::size(closed_reasons); ++i) {
|
for (size_t i = 0; i < std::size(closed_reasons); ++i) {
|
||||||
NotificationDatabaseData database_data;
|
NotificationDatabaseData database_data;
|
||||||
database_data.closed_reason = closed_reasons[i];
|
database_data.closed_reason = closed_reasons[i];
|
||||||
|
|
||||||
|
@@ -12,7 +12,6 @@
|
|||||||
#include "base/base_switches.h"
|
#include "base/base_switches.h"
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/files/file_path.h"
|
#include "base/files/file_path.h"
|
||||||
#include "base/memory/raw_ptr.h"
|
#include "base/memory/raw_ptr.h"
|
||||||
#include "base/strings/string_number_conversions.h"
|
#include "base/strings/string_number_conversions.h"
|
||||||
@@ -244,7 +243,7 @@ bool PpapiPluginProcessHost::Init(const PepperPluginInfo& info) {
|
|||||||
switches::kVModule
|
switches::kVModule
|
||||||
};
|
};
|
||||||
cmd_line->CopySwitchesFrom(browser_command_line, kCommonForwardSwitches,
|
cmd_line->CopySwitchesFrom(browser_command_line, kCommonForwardSwitches,
|
||||||
base::size(kCommonForwardSwitches));
|
std::size(kCommonForwardSwitches));
|
||||||
|
|
||||||
static const char* const kPluginForwardSwitches[] = {
|
static const char* const kPluginForwardSwitches[] = {
|
||||||
sandbox::policy::switches::kDisableSeccompFilterSandbox,
|
sandbox::policy::switches::kDisableSeccompFilterSandbox,
|
||||||
@@ -256,7 +255,7 @@ bool PpapiPluginProcessHost::Init(const PepperPluginInfo& info) {
|
|||||||
switches::kTimeZoneForTesting,
|
switches::kTimeZoneForTesting,
|
||||||
};
|
};
|
||||||
cmd_line->CopySwitchesFrom(browser_command_line, kPluginForwardSwitches,
|
cmd_line->CopySwitchesFrom(browser_command_line, kPluginForwardSwitches,
|
||||||
base::size(kPluginForwardSwitches));
|
std::size(kPluginForwardSwitches));
|
||||||
|
|
||||||
std::string locale = GetContentClient()->browser()->GetApplicationLocale();
|
std::string locale = GetContentClient()->browser()->GetApplicationLocale();
|
||||||
if (!locale.empty()) {
|
if (!locale.empty()) {
|
||||||
|
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
#include "base/callback_helpers.h"
|
#include "base/callback_helpers.h"
|
||||||
#include "base/check_op.h"
|
#include "base/check_op.h"
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/feature_list.h"
|
#include "base/feature_list.h"
|
||||||
#include "base/i18n/case_conversion.h"
|
#include "base/i18n/case_conversion.h"
|
||||||
#include "base/metrics/histogram_functions.h"
|
#include "base/metrics/histogram_functions.h"
|
||||||
@@ -596,7 +595,7 @@ void DWriteFontProxyImpl::InitializeDirectWrite() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Temp code to help track down crbug.com/561873
|
// Temp code to help track down crbug.com/561873
|
||||||
for (size_t font = 0; font < base::size(kLastResortFontNames); font++) {
|
for (size_t font = 0; font < std::size(kLastResortFontNames); font++) {
|
||||||
uint32_t font_index = 0;
|
uint32_t font_index = 0;
|
||||||
BOOL exists = FALSE;
|
BOOL exists = FALSE;
|
||||||
if (SUCCEEDED(collection_->FindFamilyName(kLastResortFontNames[font],
|
if (SUCCEEDED(collection_->FindFamilyName(kLastResortFontNames[font],
|
||||||
|
@@ -13,7 +13,6 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/location.h"
|
#include "base/location.h"
|
||||||
#include "base/run_loop.h"
|
#include "base/run_loop.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
@@ -1007,7 +1006,7 @@ TEST_F(InputRouterImplTest, MAYBE_GestureTypesIgnoringAck) {
|
|||||||
WebInputEvent::Type::kGesturePinchUpdate,
|
WebInputEvent::Type::kGesturePinchUpdate,
|
||||||
WebInputEvent::Type::kGesturePinchEnd,
|
WebInputEvent::Type::kGesturePinchEnd,
|
||||||
WebInputEvent::Type::kGestureScrollEnd};
|
WebInputEvent::Type::kGestureScrollEnd};
|
||||||
for (size_t i = 0; i < base::size(eventTypes); ++i) {
|
for (size_t i = 0; i < std::size(eventTypes); ++i) {
|
||||||
WebInputEvent::Type type = eventTypes[i];
|
WebInputEvent::Type type = eventTypes[i];
|
||||||
if (type == WebInputEvent::Type::kGestureFlingStart ||
|
if (type == WebInputEvent::Type::kGestureFlingStart ||
|
||||||
type == WebInputEvent::Type::kGestureFlingCancel) {
|
type == WebInputEvent::Type::kGestureFlingCancel) {
|
||||||
@@ -1105,7 +1104,7 @@ TEST_F(InputRouterImplTest, RequiredEventAckTypes) {
|
|||||||
WebInputEvent::Type::kGestureScrollUpdate,
|
WebInputEvent::Type::kGestureScrollUpdate,
|
||||||
WebInputEvent::Type::kTouchStart,
|
WebInputEvent::Type::kTouchStart,
|
||||||
WebInputEvent::Type::kTouchMove};
|
WebInputEvent::Type::kTouchMove};
|
||||||
for (size_t i = 0; i < base::size(kRequiredEventAckTypes); ++i) {
|
for (size_t i = 0; i < std::size(kRequiredEventAckTypes); ++i) {
|
||||||
const WebInputEvent::Type required_ack_type = kRequiredEventAckTypes[i];
|
const WebInputEvent::Type required_ack_type = kRequiredEventAckTypes[i];
|
||||||
ASSERT_TRUE(ShouldBlockEventStream(GetEventWithType(required_ack_type)))
|
ASSERT_TRUE(ShouldBlockEventStream(GetEventWithType(required_ack_type)))
|
||||||
<< WebInputEvent::GetName(required_ack_type);
|
<< WebInputEvent::GetName(required_ack_type);
|
||||||
|
@@ -2,11 +2,11 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#include "content/browser/renderer_host/input/motion_event_web.h"
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/numerics/math_constants.h"
|
#include "base/numerics/math_constants.h"
|
||||||
#include "content/browser/renderer_host/input/motion_event_web.h"
|
|
||||||
#include "testing/gtest/include/gtest/gtest.h"
|
#include "testing/gtest/include/gtest/gtest.h"
|
||||||
#include "ui/events/blink/blink_event_util.h"
|
#include "ui/events/blink/blink_event_util.h"
|
||||||
#include "ui/events/gesture_detection/motion_event_generic.h"
|
#include "ui/events/gesture_detection/motion_event_generic.h"
|
||||||
@@ -33,7 +33,7 @@ TEST(MotionEventWebTest, Constructor) {
|
|||||||
PointerProperties pp;
|
PointerProperties pp;
|
||||||
MotionEventGeneric generic_event(MotionEvent::Action::MOVE, event_time, pp);
|
MotionEventGeneric generic_event(MotionEvent::Action::MOVE, event_time, pp);
|
||||||
for (MotionEvent::ToolType tool_type : tool_types) {
|
for (MotionEvent::ToolType tool_type : tool_types) {
|
||||||
for (size_t i = 0; i < base::size(tilts_x); ++i) {
|
for (size_t i = 0; i < std::size(tilts_x); ++i) {
|
||||||
const float tilt_x = tilts_x[i];
|
const float tilt_x = tilts_x[i];
|
||||||
const float tilt_y = tilts_y[i];
|
const float tilt_y = tilts_y[i];
|
||||||
const float orientation = orientations[i];
|
const float orientation = orientations[i];
|
||||||
|
@@ -8,7 +8,6 @@
|
|||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/mac/mac_util.h"
|
#include "base/mac/mac_util.h"
|
||||||
#include "testing/gtest/include/gtest/gtest.h"
|
#include "testing/gtest/include/gtest/gtest.h"
|
||||||
#import "ui/events/cocoa/cocoa_event_utils.h"
|
#import "ui/events/cocoa/cocoa_event_utils.h"
|
||||||
@@ -187,7 +186,7 @@ TEST(WebInputEventBuilderMacTest, NumPadMapping) {
|
|||||||
ui::DomKey::FromCharacter('9')},
|
ui::DomKey::FromCharacter('9')},
|
||||||
};
|
};
|
||||||
|
|
||||||
for (size_t i = 0; i < base::size(table); ++i) {
|
for (size_t i = 0; i < std::size(table); ++i) {
|
||||||
NSEvent* mac_event = BuildFakeKeyEvent(table[i].mac_key_code,
|
NSEvent* mac_event = BuildFakeKeyEvent(table[i].mac_key_code,
|
||||||
table[i].character, 0, NSKeyDown);
|
table[i].character, 0, NSKeyDown);
|
||||||
WebKeyboardEvent web_event = WebKeyboardEventBuilder::Build(mac_event);
|
WebKeyboardEvent web_event = WebKeyboardEventBuilder::Build(mac_event);
|
||||||
@@ -200,7 +199,7 @@ TEST(WebInputEventBuilderMacTest, NumPadMapping) {
|
|||||||
// Test that left- and right-hand modifier keys are interpreted correctly when
|
// Test that left- and right-hand modifier keys are interpreted correctly when
|
||||||
// pressed simultaneously.
|
// pressed simultaneously.
|
||||||
TEST(WebInputEventFactoryTestMac, SimultaneousModifierKeys) {
|
TEST(WebInputEventFactoryTestMac, SimultaneousModifierKeys) {
|
||||||
for (size_t i = 0; i < base::size(kModifierKeys) / 2; ++i) {
|
for (size_t i = 0; i < std::size(kModifierKeys) / 2; ++i) {
|
||||||
const ModifierKey& left = kModifierKeys[2 * i];
|
const ModifierKey& left = kModifierKeys[2 * i];
|
||||||
const ModifierKey& right = kModifierKeys[2 * i + 1];
|
const ModifierKey& right = kModifierKeys[2 * i + 1];
|
||||||
// Press the left key.
|
// Press the left key.
|
||||||
@@ -231,7 +230,7 @@ TEST(WebInputEventFactoryTestMac, SimultaneousModifierKeys) {
|
|||||||
// Test that individual modifier keys are still reported correctly, even if the
|
// Test that individual modifier keys are still reported correctly, even if the
|
||||||
// undocumented left- or right-hand flags are not set.
|
// undocumented left- or right-hand flags are not set.
|
||||||
TEST(WebInputEventBuilderMacTest, MissingUndocumentedModifierFlags) {
|
TEST(WebInputEventBuilderMacTest, MissingUndocumentedModifierFlags) {
|
||||||
for (size_t i = 0; i < base::size(kModifierKeys); ++i) {
|
for (size_t i = 0; i < std::size(kModifierKeys); ++i) {
|
||||||
const ModifierKey& key = kModifierKeys[i];
|
const ModifierKey& key = kModifierKeys[i];
|
||||||
NSEvent* mac_event = BuildFakeKeyEvent(
|
NSEvent* mac_event = BuildFakeKeyEvent(
|
||||||
key.mac_key_code, 0, key.non_specific_mask, NSFlagsChanged);
|
key.mac_key_code, 0, key.non_specific_mask, NSFlagsChanged);
|
||||||
|
@@ -16,7 +16,6 @@
|
|||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/compiler_specific.h"
|
#include "base/compiler_specific.h"
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/lazy_instance.h"
|
#include "base/lazy_instance.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/memory/ptr_util.h"
|
#include "base/memory/ptr_util.h"
|
||||||
@@ -129,8 +128,8 @@ std::string RandomLabel() {
|
|||||||
static const size_t kRfc4122LengthLabel = 36u;
|
static const size_t kRfc4122LengthLabel = 36u;
|
||||||
std::string label(kRfc4122LengthLabel, ' ');
|
std::string label(kRfc4122LengthLabel, ' ');
|
||||||
for (char& c : label) {
|
for (char& c : label) {
|
||||||
// Use |base::size(kAlphabet) - 1| to avoid |kAlphabet|s terminating '\0';
|
// Use |std::size(kAlphabet) - 1| to avoid |kAlphabet|s terminating '\0';
|
||||||
c = kAlphabet[base::RandGenerator(base::size(kAlphabet) - 1)];
|
c = kAlphabet[base::RandGenerator(std::size(kAlphabet) - 1)];
|
||||||
DCHECK(std::isalnum(c)) << c;
|
DCHECK(std::isalnum(c)) << c;
|
||||||
}
|
}
|
||||||
return label;
|
return label;
|
||||||
@@ -2338,7 +2337,7 @@ void MediaStreamManager::DevicesEnumerated(
|
|||||||
bool requested[] = {requested_audio_input, requested_video_input};
|
bool requested[] = {requested_audio_input, requested_video_input};
|
||||||
MediaStreamType stream_types[] = {MediaStreamType::DEVICE_AUDIO_CAPTURE,
|
MediaStreamType stream_types[] = {MediaStreamType::DEVICE_AUDIO_CAPTURE,
|
||||||
MediaStreamType::DEVICE_VIDEO_CAPTURE};
|
MediaStreamType::DEVICE_VIDEO_CAPTURE};
|
||||||
for (size_t i = 0; i < base::size(requested); ++i) {
|
for (size_t i = 0; i < std::size(requested); ++i) {
|
||||||
if (!requested[i])
|
if (!requested[i])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/feature_list.h"
|
#include "base/feature_list.h"
|
||||||
#include "base/test/test_simple_task_runner.h"
|
#include "base/test/test_simple_task_runner.h"
|
||||||
#include "base/time/time.h"
|
#include "base/time/time.h"
|
||||||
@@ -572,7 +571,7 @@ TEST_F(NavigatorTest, NoContent) {
|
|||||||
auto response = network::mojom::URLResponseHead::New();
|
auto response = network::mojom::URLResponseHead::New();
|
||||||
const char kNoContentHeaders[] = "HTTP/1.1 204 No Content\0\0";
|
const char kNoContentHeaders[] = "HTTP/1.1 204 No Content\0\0";
|
||||||
response->headers = new net::HttpResponseHeaders(
|
response->headers = new net::HttpResponseHeaders(
|
||||||
std::string(kNoContentHeaders, base::size(kNoContentHeaders)));
|
std::string(kNoContentHeaders, std::size(kNoContentHeaders)));
|
||||||
GetLoaderForNavigationRequest(main_request)
|
GetLoaderForNavigationRequest(main_request)
|
||||||
->CallOnResponseStarted(std::move(response),
|
->CallOnResponseStarted(std::move(response),
|
||||||
mojo::ScopedDataPipeConsumerHandle());
|
mojo::ScopedDataPipeConsumerHandle());
|
||||||
@@ -597,7 +596,7 @@ TEST_F(NavigatorTest, NoContent) {
|
|||||||
response = network::mojom::URLResponseHead::New();
|
response = network::mojom::URLResponseHead::New();
|
||||||
const char kResetContentHeaders[] = "HTTP/1.1 205 Reset Content\0\0";
|
const char kResetContentHeaders[] = "HTTP/1.1 205 Reset Content\0\0";
|
||||||
response->headers = new net::HttpResponseHeaders(
|
response->headers = new net::HttpResponseHeaders(
|
||||||
std::string(kResetContentHeaders, base::size(kResetContentHeaders)));
|
std::string(kResetContentHeaders, std::size(kResetContentHeaders)));
|
||||||
GetLoaderForNavigationRequest(main_request)
|
GetLoaderForNavigationRequest(main_request)
|
||||||
->CallOnResponseStarted(std::move(response),
|
->CallOnResponseStarted(std::move(response),
|
||||||
mojo::ScopedDataPipeConsumerHandle());
|
mojo::ScopedDataPipeConsumerHandle());
|
||||||
|
@@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/strings/sys_string_conversions.h"
|
#include "base/strings/sys_string_conversions.h"
|
||||||
#include "ppapi/c/dev/ppb_truetype_font_dev.h"
|
#include "ppapi/c/dev/ppb_truetype_font_dev.h"
|
||||||
#include "ppapi/proxy/serialized_structs.h"
|
#include "ppapi/proxy/serialized_structs.h"
|
||||||
@@ -30,7 +29,7 @@ const PP_TrueTypeFontWeight_Dev kPepperFontWeights[] = {
|
|||||||
PP_TRUETYPEFONTWEIGHT_ULTRABOLD,
|
PP_TRUETYPEFONTWEIGHT_ULTRABOLD,
|
||||||
PP_TRUETYPEFONTWEIGHT_HEAVY,
|
PP_TRUETYPEFONTWEIGHT_HEAVY,
|
||||||
};
|
};
|
||||||
const NSInteger kPepperFontWeightsLength = base::size(kPepperFontWeights);
|
const NSInteger kPepperFontWeightsLength = std::size(kPepperFontWeights);
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
@@ -3501,7 +3501,7 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
renderer_cmd->CopySwitchesFrom(browser_cmd, kSwitchNames,
|
renderer_cmd->CopySwitchesFrom(browser_cmd, kSwitchNames,
|
||||||
base::size(kSwitchNames));
|
std::size(kSwitchNames));
|
||||||
|
|
||||||
// |switches::kGaiaConfig| can be set via browser command-line arguments,
|
// |switches::kGaiaConfig| can be set via browser command-line arguments,
|
||||||
// usually by developers working on signin code. The switch, however, cannot
|
// usually by developers working on signin code. The switch, however, cannot
|
||||||
|
@@ -7,7 +7,6 @@
|
|||||||
#import <objc/runtime.h>
|
#import <objc/runtime.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "content/browser/renderer_host/render_widget_host_impl.h"
|
#include "content/browser/renderer_host/render_widget_host_impl.h"
|
||||||
#import "content/browser/renderer_host/render_widget_host_view_mac.h"
|
#import "content/browser/renderer_host/render_widget_host_view_mac.h"
|
||||||
|
|
||||||
@@ -180,7 +179,7 @@ NSString* RenderWidgetHostViewMacEditCommandHelper::CommandNameForSelector(
|
|||||||
|
|
||||||
RenderWidgetHostViewMacEditCommandHelper::
|
RenderWidgetHostViewMacEditCommandHelper::
|
||||||
RenderWidgetHostViewMacEditCommandHelper() {
|
RenderWidgetHostViewMacEditCommandHelper() {
|
||||||
for (size_t i = 0; i < base::size(kEditCommands); ++i) {
|
for (size_t i = 0; i < std::size(kEditCommands); ++i) {
|
||||||
edit_command_set_.insert(kEditCommands[i]);
|
edit_command_set_.insert(kEditCommands[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -213,7 +212,7 @@ bool RenderWidgetHostViewMacEditCommandHelper::IsMenuItemEnabled(
|
|||||||
// static
|
// static
|
||||||
void RenderWidgetHostViewMacEditCommandHelper::AddEditingSelectorsToClass(
|
void RenderWidgetHostViewMacEditCommandHelper::AddEditingSelectorsToClass(
|
||||||
Class klass) {
|
Class klass) {
|
||||||
for (size_t i = 0; i < base::size(kEditCommands); ++i) {
|
for (size_t i = 0; i < std::size(kEditCommands); ++i) {
|
||||||
// Append trailing ':' to command name to get selector name.
|
// Append trailing ':' to command name to get selector name.
|
||||||
NSString* sel_str = [NSString stringWithFormat:@"%s:", kEditCommands[i]];
|
NSString* sel_str = [NSString stringWithFormat:@"%s:", kEditCommands[i]];
|
||||||
|
|
||||||
@@ -230,7 +229,7 @@ void RenderWidgetHostViewMacEditCommandHelper::AddEditingSelectorsToClass(
|
|||||||
// static
|
// static
|
||||||
NSArray*
|
NSArray*
|
||||||
RenderWidgetHostViewMacEditCommandHelper::GetEditSelectorNamesForTesting() {
|
RenderWidgetHostViewMacEditCommandHelper::GetEditSelectorNamesForTesting() {
|
||||||
size_t num_edit_commands = base::size(kEditCommands);
|
size_t num_edit_commands = std::size(kEditCommands);
|
||||||
NSMutableArray* ret = [NSMutableArray arrayWithCapacity:num_edit_commands];
|
NSMutableArray* ret = [NSMutableArray arrayWithCapacity:num_edit_commands];
|
||||||
|
|
||||||
for (size_t i = 0; i < num_edit_commands; ++i) {
|
for (size_t i = 0; i < num_edit_commands; ++i) {
|
||||||
|
@@ -13,7 +13,6 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/files/scoped_file.h"
|
#include "base/files/scoped_file.h"
|
||||||
#include "base/linux_util.h"
|
#include "base/linux_util.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
@@ -44,7 +43,7 @@ void SandboxIPCHandler::Run() {
|
|||||||
int failed_polls = 0;
|
int failed_polls = 0;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
const int r =
|
const int r =
|
||||||
HANDLE_EINTR(poll(pfds, base::size(pfds), -1 /* no timeout */));
|
HANDLE_EINTR(poll(pfds, std::size(pfds), -1 /* no timeout */));
|
||||||
// '0' is not a possible return value with no timeout.
|
// '0' is not a possible return value with no timeout.
|
||||||
DCHECK_NE(0, r);
|
DCHECK_NE(0, r);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
|
@@ -2,16 +2,16 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#include "content/public/browser/service_process_host.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/memory/shared_memory_mapping.h"
|
#include "base/memory/shared_memory_mapping.h"
|
||||||
#include "base/memory/unsafe_shared_memory_region.h"
|
#include "base/memory/unsafe_shared_memory_region.h"
|
||||||
#include "base/run_loop.h"
|
#include "base/run_loop.h"
|
||||||
#include "base/test/bind.h"
|
#include "base/test/bind.h"
|
||||||
#include "base/time/time.h"
|
#include "base/time/time.h"
|
||||||
#include "base/timer/elapsed_timer.h"
|
#include "base/timer/elapsed_timer.h"
|
||||||
#include "content/public/browser/service_process_host.h"
|
|
||||||
#include "content/public/test/browser_test.h"
|
#include "content/public/test/browser_test.h"
|
||||||
#include "content/public/test/content_browser_test.h"
|
#include "content/public/test/content_browser_test.h"
|
||||||
#include "services/test/echo/public/mojom/echo.mojom.h"
|
#include "services/test/echo/public/mojom/echo.mojom.h"
|
||||||
@@ -121,7 +121,7 @@ IN_PROC_BROWSER_TEST_F(ServiceProcessHostBrowserTest, AllMessagesReceived) {
|
|||||||
echo_service.reset();
|
echo_service.reset();
|
||||||
observer.WaitForDeath();
|
observer.WaitForDeath();
|
||||||
|
|
||||||
const std::string& kLastMessage = kMessages[base::size(kMessages) - 1];
|
const std::string& kLastMessage = kMessages[std::size(kMessages) - 1];
|
||||||
EXPECT_EQ(0,
|
EXPECT_EQ(0,
|
||||||
memcmp(mapping.memory(), kLastMessage.data(), kLastMessage.size()));
|
memcmp(mapping.memory(), kLastMessage.data(), kLastMessage.size()));
|
||||||
}
|
}
|
||||||
|
@@ -183,7 +183,7 @@ EmbeddedWorkerTestHelper::CreateMainScriptResponse() {
|
|||||||
"Content-Type: application/javascript\0"
|
"Content-Type: application/javascript\0"
|
||||||
"\0";
|
"\0";
|
||||||
response_head.headers = base::MakeRefCounted<net::HttpResponseHeaders>(
|
response_head.headers = base::MakeRefCounted<net::HttpResponseHeaders>(
|
||||||
std::string(data, base::size(data)));
|
std::string(data, std::size(data)));
|
||||||
return std::make_unique<ServiceWorkerVersion::MainScriptResponse>(
|
return std::make_unique<ServiceWorkerVersion::MainScriptResponse>(
|
||||||
response_head);
|
response_head);
|
||||||
}
|
}
|
||||||
|
@@ -13,7 +13,6 @@
|
|||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/callback_helpers.h"
|
#include "base/callback_helpers.h"
|
||||||
#include "base/containers/queue.h"
|
#include "base/containers/queue.h"
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/memory/ptr_util.h"
|
#include "base/memory/ptr_util.h"
|
||||||
#include "base/test/task_environment.h"
|
#include "base/test/task_environment.h"
|
||||||
#include "content/browser/service_worker/service_worker_test_utils.h"
|
#include "content/browser/service_worker/service_worker_test_utils.h"
|
||||||
@@ -169,7 +168,7 @@ class ServiceWorkerCacheWriterTest : public ::testing::Test {
|
|||||||
auto response_head = network::mojom::URLResponseHead::New();
|
auto response_head = network::mojom::URLResponseHead::New();
|
||||||
const char data[] = "HTTP/1.1 200 OK\0\0";
|
const char data[] = "HTTP/1.1 200 OK\0\0";
|
||||||
response_head->headers = base::MakeRefCounted<net::HttpResponseHeaders>(
|
response_head->headers = base::MakeRefCounted<net::HttpResponseHeaders>(
|
||||||
std::string(data, base::size(data)));
|
std::string(data, std::size(data)));
|
||||||
response_head->content_length = len;
|
response_head->content_length = len;
|
||||||
net::Error error = cache_writer_->MaybeWriteHeaders(
|
net::Error error = cache_writer_->MaybeWriteHeaders(
|
||||||
std::move(response_head), CreateWriteCallback());
|
std::move(response_head), CreateWriteCallback());
|
||||||
|
@@ -59,7 +59,7 @@ void ExpectEqual(const base::DictionaryValue& expected,
|
|||||||
}
|
}
|
||||||
|
|
||||||
const char kFileContent[] = "uploaded file content";
|
const char kFileContent[] = "uploaded file content";
|
||||||
const size_t kFileSize = base::size(kFileContent) - 1;
|
const size_t kFileSize = std::size(kFileContent) - 1;
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
// Tests POST requests that include a file and are intercepted by a service
|
// Tests POST requests that include a file and are intercepted by a service
|
||||||
|
@@ -11,7 +11,6 @@
|
|||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/callback_helpers.h"
|
#include "base/callback_helpers.h"
|
||||||
#include "base/check.h"
|
#include "base/check.h"
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/files/scoped_temp_dir.h"
|
#include "base/files/scoped_temp_dir.h"
|
||||||
#include "base/memory/raw_ptr.h"
|
#include "base/memory/raw_ptr.h"
|
||||||
#include "base/run_loop.h"
|
#include "base/run_loop.h"
|
||||||
@@ -1285,7 +1284,7 @@ void WriteStringResponse(
|
|||||||
const std::string& body) {
|
const std::string& body) {
|
||||||
mojo_base::BigBuffer body_buffer(base::as_bytes(base::make_span(body)));
|
mojo_base::BigBuffer body_buffer(base::as_bytes(base::make_span(body)));
|
||||||
const char kHttpHeaders[] = "HTTP/1.0 200 HONKYDORY\0\0";
|
const char kHttpHeaders[] = "HTTP/1.0 200 HONKYDORY\0\0";
|
||||||
std::string headers(kHttpHeaders, base::size(kHttpHeaders));
|
std::string headers(kHttpHeaders, std::size(kHttpHeaders));
|
||||||
WriteResponse(writer, headers, std::move(body_buffer));
|
WriteResponse(writer, headers, std::move(body_buffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1426,13 +1425,13 @@ class UpdateJobTestHelper : public EmbeddedWorkerTestHelper,
|
|||||||
// Spoof caching the script for the initial version.
|
// Spoof caching the script for the initial version.
|
||||||
WriteStringResponse(writer, kBody);
|
WriteStringResponse(writer, kBody);
|
||||||
version->script_cache_map()->NotifyFinishedCaching(
|
version->script_cache_map()->NotifyFinishedCaching(
|
||||||
script, base::size(kBody), net::OK, std::string());
|
script, std::size(kBody), net::OK, std::string());
|
||||||
} else {
|
} else {
|
||||||
EXPECT_NE(GURL(kNoChangeOrigin), script.DeprecatedGetOriginAsURL());
|
EXPECT_NE(GURL(kNoChangeOrigin), script.DeprecatedGetOriginAsURL());
|
||||||
// The script must be changed.
|
// The script must be changed.
|
||||||
WriteStringResponse(writer, kNewBody);
|
WriteStringResponse(writer, kNewBody);
|
||||||
version->script_cache_map()->NotifyFinishedCaching(
|
version->script_cache_map()->NotifyFinishedCaching(
|
||||||
script, base::size(kNewBody), net::OK, std::string());
|
script, std::size(kNewBody), net::OK, std::string());
|
||||||
}
|
}
|
||||||
|
|
||||||
version->SetMainScriptResponse(CreateMainScriptResponse());
|
version->SetMainScriptResponse(CreateMainScriptResponse());
|
||||||
@@ -1850,7 +1849,7 @@ TEST_F(ServiceWorkerUpdateJobTest, Update_ScriptUrlChanged) {
|
|||||||
version->script_cache_map()->NotifyStartedCaching(new_script, resource_id);
|
version->script_cache_map()->NotifyStartedCaching(new_script, resource_id);
|
||||||
WriteStringResponse(writer, kBody);
|
WriteStringResponse(writer, kBody);
|
||||||
version->script_cache_map()->NotifyFinishedCaching(
|
version->script_cache_map()->NotifyFinishedCaching(
|
||||||
new_script, base::size(kBody), net::OK, std::string());
|
new_script, std::size(kBody), net::OK, std::string());
|
||||||
|
|
||||||
// Run the update job.
|
// Run the update job.
|
||||||
base::RunLoop().RunUntilIdle();
|
base::RunLoop().RunUntilIdle();
|
||||||
|
@@ -129,7 +129,7 @@ int WriteBasicResponse(
|
|||||||
int64_t id) {
|
int64_t id) {
|
||||||
const char kHttpHeaders[] = "HTTP/1.0 200 HONKYDORY\0Content-Length: 5\0\0";
|
const char kHttpHeaders[] = "HTTP/1.0 200 HONKYDORY\0Content-Length: 5\0\0";
|
||||||
const char kHttpBody[] = "Hello";
|
const char kHttpBody[] = "Hello";
|
||||||
std::string headers(kHttpHeaders, base::size(kHttpHeaders));
|
std::string headers(kHttpHeaders, std::size(kHttpHeaders));
|
||||||
return WriteStringResponse(storage, id, headers, std::string(kHttpBody));
|
return WriteStringResponse(storage, id, headers, std::string(kHttpBody));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#include "content/browser/service_worker/service_worker_version.h"
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
@@ -13,7 +15,6 @@
|
|||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/callback.h"
|
#include "base/callback.h"
|
||||||
#include "base/callback_helpers.h"
|
#include "base/callback_helpers.h"
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/memory/raw_ptr.h"
|
#include "base/memory/raw_ptr.h"
|
||||||
#include "base/memory/ref_counted.h"
|
#include "base/memory/ref_counted.h"
|
||||||
#include "base/metrics/statistics_recorder.h"
|
#include "base/metrics/statistics_recorder.h"
|
||||||
@@ -36,7 +37,6 @@
|
|||||||
#include "content/browser/service_worker/service_worker_host.h"
|
#include "content/browser/service_worker/service_worker_host.h"
|
||||||
#include "content/browser/service_worker/service_worker_registration.h"
|
#include "content/browser/service_worker/service_worker_registration.h"
|
||||||
#include "content/browser/service_worker/service_worker_test_utils.h"
|
#include "content/browser/service_worker/service_worker_test_utils.h"
|
||||||
#include "content/browser/service_worker/service_worker_version.h"
|
|
||||||
#include "content/public/browser/browser_context.h"
|
#include "content/public/browser/browser_context.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "content/public/browser/content_browser_client.h"
|
#include "content/public/browser/content_browser_client.h"
|
||||||
@@ -216,7 +216,7 @@ CreateMainScriptResponse() {
|
|||||||
"Content-Type: application/javascript\0"
|
"Content-Type: application/javascript\0"
|
||||||
"\0";
|
"\0";
|
||||||
response_head.headers =
|
response_head.headers =
|
||||||
new net::HttpResponseHeaders(std::string(data, base::size(data)));
|
new net::HttpResponseHeaders(std::string(data, std::size(data)));
|
||||||
return std::make_unique<ServiceWorkerVersion::MainScriptResponse>(
|
return std::make_unique<ServiceWorkerVersion::MainScriptResponse>(
|
||||||
response_head);
|
response_head);
|
||||||
}
|
}
|
||||||
|
@@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#include "content/browser/storage_partition_impl.h"
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
@@ -16,7 +18,6 @@
|
|||||||
#include "base/callback.h"
|
#include "base/callback.h"
|
||||||
#include "base/callback_helpers.h"
|
#include "base/callback_helpers.h"
|
||||||
#include "base/containers/contains.h"
|
#include "base/containers/contains.h"
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/files/file_path.h"
|
#include "base/files/file_path.h"
|
||||||
#include "base/files/file_util.h"
|
#include "base/files/file_util.h"
|
||||||
#include "base/location.h"
|
#include "base/location.h"
|
||||||
@@ -50,7 +51,6 @@
|
|||||||
#include "content/browser/code_cache/generated_code_cache_context.h"
|
#include "content/browser/code_cache/generated_code_cache_context.h"
|
||||||
#include "content/browser/gpu/shader_cache_factory.h"
|
#include "content/browser/gpu/shader_cache_factory.h"
|
||||||
#include "content/browser/interest_group/interest_group_manager_impl.h"
|
#include "content/browser/interest_group/interest_group_manager_impl.h"
|
||||||
#include "content/browser/storage_partition_impl.h"
|
|
||||||
#include "content/public/browser/browser_task_traits.h"
|
#include "content/public/browser/browser_task_traits.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "content/public/browser/generated_code_cache_settings.h"
|
#include "content/public/browser/generated_code_cache_settings.h"
|
||||||
@@ -392,8 +392,8 @@ class RemoveLocalStorageTester {
|
|||||||
std::vector<uint8_t> serialized_origin(origin_str.begin(),
|
std::vector<uint8_t> serialized_origin(origin_str.begin(),
|
||||||
origin_str.end());
|
origin_str.end());
|
||||||
std::vector<uint8_t> key;
|
std::vector<uint8_t> key;
|
||||||
key.reserve(base::size(kMetaPrefix) + serialized_origin.size());
|
key.reserve(std::size(kMetaPrefix) + serialized_origin.size());
|
||||||
key.insert(key.end(), kMetaPrefix, kMetaPrefix + base::size(kMetaPrefix));
|
key.insert(key.end(), kMetaPrefix, kMetaPrefix + std::size(kMetaPrefix));
|
||||||
key.insert(key.end(), serialized_origin.begin(), serialized_origin.end());
|
key.insert(key.end(), serialized_origin.begin(), serialized_origin.end());
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
@@ -11,7 +11,6 @@
|
|||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/callback_helpers.h"
|
#include "base/callback_helpers.h"
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/files/file_path.h"
|
#include "base/files/file_path.h"
|
||||||
#include "base/i18n/base_i18n_switches.h"
|
#include "base/i18n/base_i18n_switches.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
@@ -299,7 +298,7 @@ bool UtilityProcessHost::StartProcess() {
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
cmd_line->CopySwitchesFrom(browser_command_line, kSwitchNames,
|
cmd_line->CopySwitchesFrom(browser_command_line, kSwitchNames,
|
||||||
base::size(kSwitchNames));
|
std::size(kSwitchNames));
|
||||||
|
|
||||||
network_session_configurator::CopyNetworkSwitches(browser_command_line,
|
network_session_configurator::CopyNetworkSwitches(browser_command_line,
|
||||||
cmd_line.get());
|
cmd_line.get());
|
||||||
|
@@ -5,7 +5,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/files/file_path.h"
|
#include "base/files/file_path.h"
|
||||||
#include "base/files/file_util.h"
|
#include "base/files/file_util.h"
|
||||||
#include "base/format_macros.h"
|
#include "base/format_macros.h"
|
||||||
@@ -1997,7 +1996,7 @@ IN_PROC_BROWSER_TEST_F(SignedExchangeSubresourcePrefetchBrowserTest, CORS) {
|
|||||||
std::string requests_list_string;
|
std::string requests_list_string;
|
||||||
|
|
||||||
std::vector<MockSignedExchangeHandlerParams> mock_params;
|
std::vector<MockSignedExchangeHandlerParams> mock_params;
|
||||||
for (size_t i = 0; i < base::size(kTestCases); ++i) {
|
for (size_t i = 0; i < std::size(kTestCases); ++i) {
|
||||||
if (i) {
|
if (i) {
|
||||||
target_sxg_outer_link_header += ",";
|
target_sxg_outer_link_header += ",";
|
||||||
target_sxg_inner_link_header += ",";
|
target_sxg_inner_link_header += ",";
|
||||||
@@ -2083,7 +2082,7 @@ let results = [];
|
|||||||
NavigateToURL(shell(), embedded_test_server()->GetURL(prefetch_path)));
|
NavigateToURL(shell(), embedded_test_server()->GetURL(prefetch_path)));
|
||||||
|
|
||||||
// Wait until all (main- and sub-resource) SXGs are prefetched.
|
// Wait until all (main- and sub-resource) SXGs are prefetched.
|
||||||
while (GetCachedExchanges(shell()).size() < base::size(kTestCases) + 1) {
|
while (GetCachedExchanges(shell()).size() < std::size(kTestCases) + 1) {
|
||||||
base::RunLoop run_loop;
|
base::RunLoop run_loop;
|
||||||
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
|
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
|
||||||
FROM_HERE, run_loop.QuitClosure(), TestTimeouts::tiny_timeout());
|
FROM_HERE, run_loop.QuitClosure(), TestTimeouts::tiny_timeout());
|
||||||
@@ -2092,7 +2091,7 @@ let results = [];
|
|||||||
|
|
||||||
NavigateToURLAndWaitTitle(target_sxg_url, "done");
|
NavigateToURLAndWaitTitle(target_sxg_url, "done");
|
||||||
|
|
||||||
for (size_t i = 0; i < base::size(kTestCases); ++i) {
|
for (size_t i = 0; i < std::size(kTestCases); ++i) {
|
||||||
SCOPED_TRACE(base::StringPrintf("TestCase %zu", i));
|
SCOPED_TRACE(base::StringPrintf("TestCase %zu", i));
|
||||||
EXPECT_EQ(
|
EXPECT_EQ(
|
||||||
EvalJs(shell(), base::StringPrintf("results[%zu]", i)).ExtractString(),
|
EvalJs(shell(), base::StringPrintf("results[%zu]", i)).ExtractString(),
|
||||||
|
@@ -15,7 +15,6 @@
|
|||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/callback_helpers.h"
|
#include "base/callback_helpers.h"
|
||||||
#include "base/compiler_specific.h"
|
#include "base/compiler_specific.h"
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/json/json_reader.h"
|
#include "base/json/json_reader.h"
|
||||||
#include "base/json/json_writer.h"
|
#include "base/json/json_writer.h"
|
||||||
#include "base/memory/raw_ptr.h"
|
#include "base/memory/raw_ptr.h"
|
||||||
@@ -794,10 +793,10 @@ TEST_F(AuthenticatorImplTest, ClientDataJSONSerialization) {
|
|||||||
TEST_F(AuthenticatorImplTest, MakeCredentialOriginAndRpIds) {
|
TEST_F(AuthenticatorImplTest, MakeCredentialOriginAndRpIds) {
|
||||||
std::vector<OriginClaimedAuthorityPair> tests(
|
std::vector<OriginClaimedAuthorityPair> tests(
|
||||||
&kValidRelyingPartyTestCases[0],
|
&kValidRelyingPartyTestCases[0],
|
||||||
&kValidRelyingPartyTestCases[base::size(kValidRelyingPartyTestCases)]);
|
&kValidRelyingPartyTestCases[std::size(kValidRelyingPartyTestCases)]);
|
||||||
tests.insert(tests.end(), &kInvalidRelyingPartyTestCases[0],
|
tests.insert(
|
||||||
&kInvalidRelyingPartyTestCases[base::size(
|
tests.end(), &kInvalidRelyingPartyTestCases[0],
|
||||||
kInvalidRelyingPartyTestCases)]);
|
&kInvalidRelyingPartyTestCases[std::size(kInvalidRelyingPartyTestCases)]);
|
||||||
|
|
||||||
for (const auto& test_case : tests) {
|
for (const auto& test_case : tests) {
|
||||||
SCOPED_TRACE(std::string(test_case.claimed_authority) + " " +
|
SCOPED_TRACE(std::string(test_case.claimed_authority) + " " +
|
||||||
|
@@ -3,7 +3,6 @@
|
|||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/memory/ref_counted_memory.h"
|
#include "base/memory/ref_counted_memory.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
#include "content/browser/webui/web_ui_data_source_impl.h"
|
#include "content/browser/webui/web_ui_data_source_impl.h"
|
||||||
@@ -39,13 +38,13 @@ class TestClient : public TestContentClient {
|
|||||||
base::RefCountedStaticMemory* bytes = nullptr;
|
base::RefCountedStaticMemory* bytes = nullptr;
|
||||||
if (resource_id == kDummyDefaultResourceId) {
|
if (resource_id == kDummyDefaultResourceId) {
|
||||||
bytes = new base::RefCountedStaticMemory(
|
bytes = new base::RefCountedStaticMemory(
|
||||||
kDummyDefaultResource, base::size(kDummyDefaultResource));
|
kDummyDefaultResource, std::size(kDummyDefaultResource));
|
||||||
} else if (resource_id == kDummyResourceId) {
|
} else if (resource_id == kDummyResourceId) {
|
||||||
bytes = new base::RefCountedStaticMemory(kDummyResource,
|
bytes = new base::RefCountedStaticMemory(kDummyResource,
|
||||||
base::size(kDummyResource));
|
std::size(kDummyResource));
|
||||||
} else if (resource_id == kDummyJSResourceId) {
|
} else if (resource_id == kDummyJSResourceId) {
|
||||||
bytes = new base::RefCountedStaticMemory(kDummyJSResource,
|
bytes = new base::RefCountedStaticMemory(kDummyJSResource,
|
||||||
base::size(kDummyJSResource));
|
std::size(kDummyJSResource));
|
||||||
}
|
}
|
||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
|
@@ -2,17 +2,15 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#include "content/common/font_list.h"
|
#include <fontconfig/fontconfig.h>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include <fontconfig/fontconfig.h>
|
|
||||||
|
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/values.h"
|
#include "base/values.h"
|
||||||
|
#include "content/common/font_list.h"
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
|
|
||||||
@@ -39,7 +37,7 @@ std::unique_ptr<base::ListValue> GetFontList_SlowBlocking() {
|
|||||||
// See https://www.freetype.org/freetype2/docs/reference/ft2-font_formats.html
|
// See https://www.freetype.org/freetype2/docs/reference/ft2-font_formats.html
|
||||||
// for the list of possible formats.
|
// for the list of possible formats.
|
||||||
const char* allowed_formats[] = { "TrueType", "CFF" };
|
const char* allowed_formats[] = { "TrueType", "CFF" };
|
||||||
for (size_t i = 0; i < base::size(allowed_formats); ++i) {
|
for (size_t i = 0; i < std::size(allowed_formats); ++i) {
|
||||||
auto format_pattern = CreateFormatPattern(allowed_formats[i]);
|
auto format_pattern = CreateFormatPattern(allowed_formats[i]);
|
||||||
std::unique_ptr<FcFontSet, decltype(&FcFontSetDestroy)> fontset(
|
std::unique_ptr<FcFontSet, decltype(&FcFontSetDestroy)> fontset(
|
||||||
FcFontList(nullptr, format_pattern.get(), object_set.get()),
|
FcFontList(nullptr, format_pattern.get(), object_set.get()),
|
||||||
|
@@ -165,7 +165,7 @@ class FontFamilyResolver {
|
|||||||
CFStringRef set_values[] = {kCTFontFamilyNameAttribute};
|
CFStringRef set_values[] = {kCTFontFamilyNameAttribute};
|
||||||
return base::ScopedCFTypeRef<CFSetRef>(CFSetCreate(
|
return base::ScopedCFTypeRef<CFSetRef>(CFSetCreate(
|
||||||
kCFAllocatorDefault, reinterpret_cast<const void**>(set_values),
|
kCFAllocatorDefault, reinterpret_cast<const void**>(set_values),
|
||||||
base::size(set_values), &kCFTypeSetCallBacks));
|
std::size(set_values), &kCFTypeSetCallBacks));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates the mutable dictionary stored in |font_descriptor_attributes_|.
|
// Creates the mutable dictionary stored in |font_descriptor_attributes_|.
|
||||||
|
@@ -10,7 +10,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
#include "base/version.h"
|
#include "base/version.h"
|
||||||
#include "testing/gtest/include/gtest/gtest.h"
|
#include "testing/gtest/include/gtest/gtest.h"
|
||||||
@@ -33,7 +32,7 @@ TEST(PluginUtilsTest, VersionExtraction) {
|
|||||||
{ "1..0", "1.0.0" } // Empty version component
|
{ "1..0", "1.0.0" } // Empty version component
|
||||||
};
|
};
|
||||||
|
|
||||||
for (size_t i = 0; i < base::size(versions); i++) {
|
for (size_t i = 0; i < std::size(versions); i++) {
|
||||||
base::Version version;
|
base::Version version;
|
||||||
WebPluginInfo::CreateVersionFromString(
|
WebPluginInfo::CreateVersionFromString(
|
||||||
base::ASCIIToUTF16(versions[i][0]), &version);
|
base::ASCIIToUTF16(versions[i][0]), &version);
|
||||||
|
@@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
#include "base/base_switches.h"
|
#include "base/base_switches.h"
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/i18n/unicodestring.h"
|
#include "base/i18n/unicodestring.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/metrics/histogram_functions.h"
|
#include "base/metrics/histogram_functions.h"
|
||||||
@@ -245,7 +244,7 @@ void ZygoteCommunication::Init(
|
|||||||
sandbox::policy::switches::kNoSandbox,
|
sandbox::policy::switches::kNoSandbox,
|
||||||
};
|
};
|
||||||
cmd_line.CopySwitchesFrom(browser_command_line, kForwardSwitches,
|
cmd_line.CopySwitchesFrom(browser_command_line, kForwardSwitches,
|
||||||
base::size(kForwardSwitches));
|
std::size(kForwardSwitches));
|
||||||
|
|
||||||
pid_ = std::move(launcher).Run(&cmd_line, &control_fd_);
|
pid_ = std::move(launcher).Run(&cmd_line, &control_fd_);
|
||||||
|
|
||||||
|
@@ -9,7 +9,6 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/strings/stringprintf.h"
|
#include "base/strings/stringprintf.h"
|
||||||
#include "content/common/android/gin_java_bridge_value.h"
|
#include "content/common/android/gin_java_bridge_value.h"
|
||||||
#include "testing/gtest/include/gtest/gtest.h"
|
#include "testing/gtest/include/gtest/gtest.h"
|
||||||
@@ -130,7 +129,7 @@ TEST_F(GinJavaBridgeValueConverterTest, TypedArrays) {
|
|||||||
"4", "Int32Array", "4", "Uint32Array",
|
"4", "Int32Array", "4", "Uint32Array",
|
||||||
"4", "Float32Array", "8", "Float64Array"
|
"4", "Float32Array", "8", "Float64Array"
|
||||||
};
|
};
|
||||||
for (size_t i = 0; i < base::size(array_types); i += 2) {
|
for (size_t i = 0; i < std::size(array_types); i += 2) {
|
||||||
const char* typed_array_type = array_types[i + 1];
|
const char* typed_array_type = array_types[i + 1];
|
||||||
v8::Local<v8::Script> script(
|
v8::Local<v8::Script> script(
|
||||||
v8::Script::Compile(
|
v8::Script::Compile(
|
||||||
|
@@ -5,10 +5,10 @@
|
|||||||
#include "content/renderer/pepper/pepper_audio_encoder_host.h"
|
#include "content/renderer/pepper/pepper_audio_encoder_host.h"
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/memory/unsafe_shared_memory_region.h"
|
#include "base/memory/unsafe_shared_memory_region.h"
|
||||||
#include "content/public/renderer/renderer_ppapi_host.h"
|
#include "content/public/renderer/renderer_ppapi_host.h"
|
||||||
#include "content/renderer/pepper/host_globals.h"
|
#include "content/renderer/pepper/host_globals.h"
|
||||||
@@ -95,7 +95,7 @@ PepperAudioEncoderHost::AudioEncoderImpl::GetSupportedProfiles() {
|
|||||||
std::vector<PP_AudioProfileDescription> profiles;
|
std::vector<PP_AudioProfileDescription> profiles;
|
||||||
static const uint32_t sampling_rates[] = {8000, 12000, 16000, 24000, 48000};
|
static const uint32_t sampling_rates[] = {8000, 12000, 16000, 24000, 48000};
|
||||||
|
|
||||||
for (uint32_t i = 0; i < base::size(sampling_rates); ++i) {
|
for (uint32_t i = 0; i < std::size(sampling_rates); ++i) {
|
||||||
PP_AudioProfileDescription profile;
|
PP_AudioProfileDescription profile;
|
||||||
profile.profile = PP_AUDIOPROFILE_OPUS;
|
profile.profile = PP_AUDIOPROFILE_OPUS;
|
||||||
profile.max_channels = 2;
|
profile.max_channels = 2;
|
||||||
|
@@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/test/task_environment.h"
|
#include "base/test/task_environment.h"
|
||||||
#include "content/public/renderer/ppapi_gfx_conversion.h"
|
#include "content/public/renderer/ppapi_gfx_conversion.h"
|
||||||
#include "content/renderer/pepper/mock_renderer_ppapi_host.h"
|
#include "content/renderer/pepper/mock_renderer_ppapi_host.h"
|
||||||
@@ -136,7 +135,7 @@ TEST_F(PepperGraphics2DHostTest, ConvertToLogicalPixels) {
|
|||||||
// Check negative scroll deltas
|
// Check negative scroll deltas
|
||||||
{10, 10, 20, 20, 5, 5, 10, 10, -6, -4, -3, -2, 0.5, true},
|
{10, 10, 20, 20, 5, 5, 10, 10, -6, -4, -3, -2, 0.5, true},
|
||||||
{10, 10, 20, 20, 5, 5, 10, 10, -6, -3, -3, -1, 0.5, false}, };
|
{10, 10, 20, 20, 5, 5, 10, 10, -6, -3, -3, -1, 0.5, false}, };
|
||||||
for (size_t i = 0; i < base::size(tests); ++i) {
|
for (size_t i = 0; i < std::size(tests); ++i) {
|
||||||
gfx::Rect r1(tests[i].x1, tests[i].y1, tests[i].w1, tests[i].h1);
|
gfx::Rect r1(tests[i].x1, tests[i].y1, tests[i].w1, tests[i].h1);
|
||||||
gfx::Rect r2(tests[i].x2, tests[i].y2, tests[i].w2, tests[i].h2);
|
gfx::Rect r2(tests[i].x2, tests[i].y2, tests[i].w2, tests[i].h2);
|
||||||
gfx::Rect orig = r1;
|
gfx::Rect orig = r1;
|
||||||
|
@@ -12,7 +12,6 @@
|
|||||||
#include "base/callback.h"
|
#include "base/callback.h"
|
||||||
#include "base/callback_helpers.h"
|
#include "base/callback_helpers.h"
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/json/json_reader.h"
|
#include "base/json/json_reader.h"
|
||||||
#include "base/json/json_writer.h"
|
#include "base/json/json_writer.h"
|
||||||
#include "base/location.h"
|
#include "base/location.h"
|
||||||
@@ -162,7 +161,7 @@ int ConvertMockKeyboardModifier(MockKeyboard::Modifiers modifiers) {
|
|||||||
{MockKeyboard::RIGHT_ALT, ui::EF_ALT_DOWN},
|
{MockKeyboard::RIGHT_ALT, ui::EF_ALT_DOWN},
|
||||||
};
|
};
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
for (size_t i = 0; i < base::size(kModifierMap); ++i) {
|
for (size_t i = 0; i < std::size(kModifierMap); ++i) {
|
||||||
if (kModifierMap[i].src & modifiers) {
|
if (kModifierMap[i].src & modifiers) {
|
||||||
flags |= kModifierMap[i].dst;
|
flags |= kModifierMap[i].dst;
|
||||||
}
|
}
|
||||||
@@ -712,7 +711,7 @@ TEST_F(RenderViewImplTest, OnNavigationHttpPost) {
|
|||||||
|
|
||||||
// Set up post data.
|
// Set up post data.
|
||||||
const char raw_data[] = "post \0\ndata";
|
const char raw_data[] = "post \0\ndata";
|
||||||
const size_t length = base::size(raw_data);
|
const size_t length = std::size(raw_data);
|
||||||
scoped_refptr<network::ResourceRequestBody> post_data(
|
scoped_refptr<network::ResourceRequestBody> post_data(
|
||||||
new network::ResourceRequestBody);
|
new network::ResourceRequestBody);
|
||||||
post_data->AppendBytes(raw_data, length);
|
post_data->AppendBytes(raw_data, length);
|
||||||
@@ -894,7 +893,7 @@ TEST_F(RenderViewImplTest, BeginNavigationHandlesAllTopLevel) {
|
|||||||
blink::kWebNavigationTypeOther,
|
blink::kWebNavigationTypeOther,
|
||||||
};
|
};
|
||||||
|
|
||||||
for (size_t i = 0; i < base::size(kNavTypes); ++i) {
|
for (size_t i = 0; i < std::size(kNavTypes); ++i) {
|
||||||
auto navigation_info = std::make_unique<blink::WebNavigationInfo>();
|
auto navigation_info = std::make_unique<blink::WebNavigationInfo>();
|
||||||
navigation_info->url_request = blink::WebURLRequest(GURL("http://foo.com"));
|
navigation_info->url_request = blink::WebURLRequest(GURL("http://foo.com"));
|
||||||
navigation_info->url_request.SetRequestorOrigin(
|
navigation_info->url_request.SetRequestorOrigin(
|
||||||
@@ -1368,7 +1367,7 @@ TEST_F(RenderViewImplTextInputStateChanged, OnImeTypeChanged) {
|
|||||||
input_mode = updated_states()[0]->mode;
|
input_mode = updated_states()[0]->mode;
|
||||||
EXPECT_EQ(ui::TEXT_INPUT_TYPE_PASSWORD, type);
|
EXPECT_EQ(ui::TEXT_INPUT_TYPE_PASSWORD, type);
|
||||||
|
|
||||||
for (size_t test = 0; test < base::size(kInputModeTestCases); test++) {
|
for (size_t test = 0; test < std::size(kInputModeTestCases); test++) {
|
||||||
const InputModeTestCase* test_case = &kInputModeTestCases[test];
|
const InputModeTestCase* test_case = &kInputModeTestCases[test];
|
||||||
std::u16string javascript = base::ASCIIToUTF16(base::StringPrintf(
|
std::u16string javascript = base::ASCIIToUTF16(base::StringPrintf(
|
||||||
"document.getElementById('%s').focus();", test_case->input_id));
|
"document.getElementById('%s').focus();", test_case->input_id));
|
||||||
@@ -1943,7 +1942,7 @@ TEST_F(RenderViewImplTest, ImeComposition) {
|
|||||||
{IME_FINISHCOMPOSINGTEXT, false, -1, -1, L"", L"\xC548\xB155"},
|
{IME_FINISHCOMPOSINGTEXT, false, -1, -1, L"", L"\xC548\xB155"},
|
||||||
};
|
};
|
||||||
|
|
||||||
for (size_t i = 0; i < base::size(kImeMessages); i++) {
|
for (size_t i = 0; i < std::size(kImeMessages); i++) {
|
||||||
const ImeMessage* ime_message = &kImeMessages[i];
|
const ImeMessage* ime_message = &kImeMessages[i];
|
||||||
switch (ime_message->command) {
|
switch (ime_message->command) {
|
||||||
case IME_INITIALIZE:
|
case IME_INITIALIZE:
|
||||||
|
@@ -8,7 +8,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/strings/stringprintf.h"
|
#include "base/strings/stringprintf.h"
|
||||||
#include "base/synchronization/lock.h"
|
#include "base/synchronization/lock.h"
|
||||||
#include "base/test/bind.h"
|
#include "base/test/bind.h"
|
||||||
@@ -1266,13 +1265,12 @@ TEST_F(AuctionV8HelperTest, CompileWasm) {
|
|||||||
|
|
||||||
v8::Local<v8::WasmModuleObject> wasm_module;
|
v8::Local<v8::WasmModuleObject> wasm_module;
|
||||||
absl::optional<std::string> compile_error;
|
absl::optional<std::string> compile_error;
|
||||||
ASSERT_TRUE(
|
ASSERT_TRUE(helper_
|
||||||
helper_
|
->CompileWasm(std::string(kMinimalWasmModuleBytes,
|
||||||
->CompileWasm(std::string(kMinimalWasmModuleBytes,
|
std::size(kMinimalWasmModuleBytes)),
|
||||||
base::size(kMinimalWasmModuleBytes)),
|
GURL("https://foo.test/"),
|
||||||
GURL("https://foo.test/"),
|
/*debug_id=*/nullptr, compile_error)
|
||||||
/*debug_id=*/nullptr, compile_error)
|
.ToLocal(&wasm_module));
|
||||||
.ToLocal(&wasm_module));
|
|
||||||
EXPECT_FALSE(compile_error.has_value());
|
EXPECT_FALSE(compile_error.has_value());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1317,7 +1315,7 @@ TEST_F(AuctionV8HelperTest, CompileWasmDebug) {
|
|||||||
absl::optional<std::string> error_out;
|
absl::optional<std::string> error_out;
|
||||||
EXPECT_TRUE(CompileWasmOnV8ThreadAndWait(
|
EXPECT_TRUE(CompileWasmOnV8ThreadAndWait(
|
||||||
id, GURL("https://example.com"),
|
id, GURL("https://example.com"),
|
||||||
std::string(kMinimalWasmModuleBytes, base::size(kMinimalWasmModuleBytes)),
|
std::string(kMinimalWasmModuleBytes, std::size(kMinimalWasmModuleBytes)),
|
||||||
&error_out));
|
&error_out));
|
||||||
TestDevToolsAgentClient::Event script_parsed =
|
TestDevToolsAgentClient::Event script_parsed =
|
||||||
debug_client.WaitForMethodNotification("Debugger.scriptParsed");
|
debug_client.WaitForMethodNotification("Debugger.scriptParsed");
|
||||||
@@ -1348,13 +1346,12 @@ TEST_F(AuctionV8HelperTest, CloneWasmModule) {
|
|||||||
// Compile the WASM module...
|
// Compile the WASM module...
|
||||||
v8::Local<v8::WasmModuleObject> wasm_module;
|
v8::Local<v8::WasmModuleObject> wasm_module;
|
||||||
absl::optional<std::string> error_msg;
|
absl::optional<std::string> error_msg;
|
||||||
ASSERT_TRUE(
|
ASSERT_TRUE(helper_
|
||||||
helper_
|
->CompileWasm(std::string(kMinimalWasmModuleBytes,
|
||||||
->CompileWasm(std::string(kMinimalWasmModuleBytes,
|
std::size(kMinimalWasmModuleBytes)),
|
||||||
base::size(kMinimalWasmModuleBytes)),
|
GURL("https://foo.test/"),
|
||||||
GURL("https://foo.test/"),
|
/*debug_id=*/nullptr, error_msg)
|
||||||
/*debug_id=*/nullptr, error_msg)
|
.ToLocal(&wasm_module));
|
||||||
.ToLocal(&wasm_module));
|
|
||||||
EXPECT_FALSE(error_msg.has_value());
|
EXPECT_FALSE(error_msg.has_value());
|
||||||
|
|
||||||
// And the test script.
|
// And the test script.
|
||||||
|
@@ -9,7 +9,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "testing/gmock/include/gmock/gmock-matchers.h"
|
#include "testing/gmock/include/gmock/gmock-matchers.h"
|
||||||
#include "testing/gtest/include/gtest/gtest.h"
|
#include "testing/gtest/include/gtest/gtest.h"
|
||||||
#include "v8/include/v8-inspector.h"
|
#include "v8/include/v8-inspector.h"
|
||||||
@@ -21,7 +20,7 @@ namespace auction_worklet {
|
|||||||
TEST(AuctionV8InspectorUtilTest, GetStringBytes8) {
|
TEST(AuctionV8InspectorUtilTest, GetStringBytes8) {
|
||||||
const uint8_t chars[] = {'a', 'b', 'c', 0xD0, 0xB0, 0xD0, 0xB1, 0xD0, 0xB2};
|
const uint8_t chars[] = {'a', 'b', 'c', 0xD0, 0xB0, 0xD0, 0xB1, 0xD0, 0xB2};
|
||||||
auto string_buf = v8_inspector::StringBuffer::create(
|
auto string_buf = v8_inspector::StringBuffer::create(
|
||||||
v8_inspector::StringView(chars, base::size(chars)));
|
v8_inspector::StringView(chars, std::size(chars)));
|
||||||
EXPECT_THAT(GetStringBytes(string_buf.get()),
|
EXPECT_THAT(GetStringBytes(string_buf.get()),
|
||||||
ElementsAre('a', 'b', 'c', 0xD0, 0xB0, 0xD0, 0xB1, 0xD0, 0xB2));
|
ElementsAre('a', 'b', 'c', 0xD0, 0xB0, 0xD0, 0xB1, 0xD0, 0xB2));
|
||||||
}
|
}
|
||||||
@@ -36,7 +35,7 @@ TEST(AuctionV8InspectorUtilTest, GetStringBytes16) {
|
|||||||
// U+1F600, GRINNING FACE, as surrogate pairs.
|
// U+1F600, GRINNING FACE, as surrogate pairs.
|
||||||
0xD83D, 0xDE00};
|
0xD83D, 0xDE00};
|
||||||
auto string_buf = v8_inspector::StringBuffer::create(
|
auto string_buf = v8_inspector::StringBuffer::create(
|
||||||
v8_inspector::StringView(chars16, base::size(chars16)));
|
v8_inspector::StringView(chars16, std::size(chars16)));
|
||||||
EXPECT_THAT(GetStringBytes(string_buf.get()),
|
EXPECT_THAT(GetStringBytes(string_buf.get()),
|
||||||
ElementsAre(0xD0, 0x94, 0xD1, 0x8F, 0xD0, 0xBA, 0xD1, 0x83, 0xD1,
|
ElementsAre(0xD0, 0x94, 0xD1, 0x8F, 0xD0, 0xBA, 0xD1, 0x83, 0xD1,
|
||||||
0x8E, '!', 0xF0, 0x9F, 0x98, 0x80));
|
0x8E, '!', 0xF0, 0x9F, 0x98, 0x80));
|
||||||
|
@@ -13,7 +13,6 @@
|
|||||||
|
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/callback.h"
|
#include "base/callback.h"
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/memory/scoped_refptr.h"
|
#include "base/memory/scoped_refptr.h"
|
||||||
#include "base/strings/strcat.h"
|
#include "base/strings/strcat.h"
|
||||||
@@ -92,7 +91,7 @@ v8::MaybeLocal<v8::Value> CreatePrevWinsArray(
|
|||||||
return v8::MaybeLocal<v8::Value>();
|
return v8::MaybeLocal<v8::Value>();
|
||||||
}
|
}
|
||||||
prev_wins_v8.push_back(
|
prev_wins_v8.push_back(
|
||||||
v8::Array::New(isolate, win_values, base::size(win_values)));
|
v8::Array::New(isolate, win_values, std::size(win_values)));
|
||||||
}
|
}
|
||||||
return v8::Array::New(isolate, prev_wins_v8.data(), prev_wins_v8.size());
|
return v8::Array::New(isolate, prev_wins_v8.data(), prev_wins_v8.size());
|
||||||
}
|
}
|
||||||
|
@@ -9,7 +9,6 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/feature_list.h"
|
#include "base/feature_list.h"
|
||||||
#include "base/memory/raw_ptr.h"
|
#include "base/memory/raw_ptr.h"
|
||||||
#include "base/run_loop.h"
|
#include "base/run_loop.h"
|
||||||
@@ -58,7 +57,7 @@ const char kWasmUrl[] = "https://foo.test/helper.wasm";
|
|||||||
// Packs kToyWasm into a std::string.
|
// Packs kToyWasm into a std::string.
|
||||||
std::string ToyWasm() {
|
std::string ToyWasm() {
|
||||||
return std::string(reinterpret_cast<const char*>(kToyWasm),
|
return std::string(reinterpret_cast<const char*>(kToyWasm),
|
||||||
base::size(kToyWasm));
|
std::size(kToyWasm));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates generateBid() scripts with the specified result value, in raw
|
// Creates generateBid() scripts with the specified result value, in raw
|
||||||
|
@@ -8,7 +8,6 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/run_loop.h"
|
#include "base/run_loop.h"
|
||||||
#include "base/synchronization/waitable_event.h"
|
#include "base/synchronization/waitable_event.h"
|
||||||
#include "base/test/bind.h"
|
#include "base/test/bind.h"
|
||||||
@@ -233,10 +232,10 @@ TEST_F(WorkletLoaderTest, DeleteBeforeCallback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(WorkletLoaderTest, LoadWasmSuccess) {
|
TEST_F(WorkletLoaderTest, LoadWasmSuccess) {
|
||||||
AddResponse(&url_loader_factory_, url_, "application/wasm",
|
AddResponse(
|
||||||
/*charset=*/absl::nullopt,
|
&url_loader_factory_, url_, "application/wasm",
|
||||||
std::string(kMinimalWasmModuleBytes,
|
/*charset=*/absl::nullopt,
|
||||||
base::size(kMinimalWasmModuleBytes)));
|
std::string(kMinimalWasmModuleBytes, std::size(kMinimalWasmModuleBytes)));
|
||||||
WorkletWasmLoader worklet_loader(
|
WorkletWasmLoader worklet_loader(
|
||||||
&url_loader_factory_, url_, v8_helper_,
|
&url_loader_factory_, url_, v8_helper_,
|
||||||
scoped_refptr<AuctionV8Helper::DebugId>(),
|
scoped_refptr<AuctionV8Helper::DebugId>(),
|
||||||
|
@@ -5,11 +5,11 @@
|
|||||||
#include "content/shell/browser/shell_content_browser_client.h"
|
#include "content/shell/browser/shell_content_browser_client.h"
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "base/base_switches.h"
|
#include "base/base_switches.h"
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/feature_list.h"
|
#include "base/feature_list.h"
|
||||||
#include "base/files/file.h"
|
#include "base/files/file.h"
|
||||||
#include "base/files/file_util.h"
|
#include "base/files/file_util.h"
|
||||||
@@ -302,8 +302,7 @@ void ShellContentBrowserClient::AppendExtraCommandLineSwitches(
|
|||||||
};
|
};
|
||||||
|
|
||||||
command_line->CopySwitchesFrom(*base::CommandLine::ForCurrentProcess(),
|
command_line->CopySwitchesFrom(*base::CommandLine::ForCurrentProcess(),
|
||||||
kForwardSwitches,
|
kForwardSwitches, std::size(kForwardSwitches));
|
||||||
base::size(kForwardSwitches));
|
|
||||||
|
|
||||||
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
|
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
|
||||||
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
|
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
|
||||||
|
@@ -167,7 +167,7 @@ void ShellDownloadManagerDelegate::ChooseDownloadPath(
|
|||||||
#if BUILDFLAG(IS_WIN)
|
#if BUILDFLAG(IS_WIN)
|
||||||
std::wstring file_part = base::FilePath(suggested_path).BaseName().value();
|
std::wstring file_part = base::FilePath(suggested_path).BaseName().value();
|
||||||
wchar_t file_name[MAX_PATH];
|
wchar_t file_name[MAX_PATH];
|
||||||
base::wcslcpy(file_name, file_part.c_str(), base::size(file_name));
|
base::wcslcpy(file_name, file_part.c_str(), std::size(file_name));
|
||||||
OPENFILENAME save_as;
|
OPENFILENAME save_as;
|
||||||
ZeroMemory(&save_as, sizeof(save_as));
|
ZeroMemory(&save_as, sizeof(save_as));
|
||||||
save_as.lStructSize = sizeof(OPENFILENAME);
|
save_as.lStructSize = sizeof(OPENFILENAME);
|
||||||
@@ -178,7 +178,7 @@ void ShellDownloadManagerDelegate::ChooseDownloadPath(
|
|||||||
save_as.hwndOwner =
|
save_as.hwndOwner =
|
||||||
web_contents->GetNativeView()->GetHost()->GetAcceleratedWidget();
|
web_contents->GetNativeView()->GetHost()->GetAcceleratedWidget();
|
||||||
save_as.lpstrFile = file_name;
|
save_as.lpstrFile = file_name;
|
||||||
save_as.nMaxFile = base::size(file_name);
|
save_as.nMaxFile = std::size(file_name);
|
||||||
|
|
||||||
std::wstring directory;
|
std::wstring directory;
|
||||||
if (!suggested_path.empty())
|
if (!suggested_path.empty())
|
||||||
|
@@ -2,9 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#include "base/memory/raw_ptr.h"
|
|
||||||
#include "content/shell/browser/shell_platform_delegate.h"
|
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@@ -13,7 +10,7 @@
|
|||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/containers/contains.h"
|
#include "base/containers/contains.h"
|
||||||
#include "base/cxx17_backports.h"
|
#include "base/memory/raw_ptr.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
#include "build/build_config.h"
|
#include "build/build_config.h"
|
||||||
#include "build/chromeos_buildflags.h"
|
#include "build/chromeos_buildflags.h"
|
||||||
@@ -21,6 +18,7 @@
|
|||||||
#include "content/public/browser/render_widget_host_view.h"
|
#include "content/public/browser/render_widget_host_view.h"
|
||||||
#include "content/public/browser/web_contents.h"
|
#include "content/public/browser/web_contents.h"
|
||||||
#include "content/shell/browser/shell.h"
|
#include "content/shell/browser/shell.h"
|
||||||
|
#include "content/shell/browser/shell_platform_delegate.h"
|
||||||
#include "ui/aura/env.h"
|
#include "ui/aura/env.h"
|
||||||
#include "ui/aura/window.h"
|
#include "ui/aura/window.h"
|
||||||
#include "ui/aura/window_event_dispatcher.h"
|
#include "ui/aura/window_event_dispatcher.h"
|
||||||
@@ -241,7 +239,7 @@ class ShellView : public views::BoxLayoutView,
|
|||||||
DCHECK(GetWidget());
|
DCHECK(GetWidget());
|
||||||
static const ui::KeyboardCode keys[] = {ui::VKEY_F5, ui::VKEY_BROWSER_BACK,
|
static const ui::KeyboardCode keys[] = {ui::VKEY_F5, ui::VKEY_BROWSER_BACK,
|
||||||
ui::VKEY_BROWSER_FORWARD};
|
ui::VKEY_BROWSER_FORWARD};
|
||||||
for (size_t i = 0; i < base::size(keys); ++i) {
|
for (size_t i = 0; i < std::size(keys); ++i) {
|
||||||
GetFocusManager()->RegisterAccelerator(
|
GetFocusManager()->RegisterAccelerator(
|
||||||
ui::Accelerator(keys[i], ui::EF_NONE),
|
ui::Accelerator(keys[i], ui::EF_NONE),
|
||||||
ui::AcceleratorManager::kNormalPriority, this);
|
ui::AcceleratorManager::kNormalPriority, this);
|
||||||
|
@@ -66,7 +66,7 @@ base::CommandLine CreateCommandLine() {
|
|||||||
switches::kOzonePlatform,
|
switches::kOzonePlatform,
|
||||||
};
|
};
|
||||||
command_line.CopySwitchesFrom(cmdline, kSwitchesToCopy,
|
command_line.CopySwitchesFrom(cmdline, kSwitchesToCopy,
|
||||||
base::size(kSwitchesToCopy));
|
std::size(kSwitchesToCopy));
|
||||||
#endif
|
#endif
|
||||||
return command_line;
|
return command_line;
|
||||||
}
|
}
|
||||||
|
@@ -8,7 +8,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "base/check.h"
|
#include "base/check.h"
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "content/test/mock_keyboard.h"
|
#include "content/test/mock_keyboard.h"
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
@@ -103,7 +102,7 @@ bool MockKeyboardDriverWin::SetLayout(int layout) {
|
|||||||
{L"00001009", MockKeyboard::LAYOUT_CANADIAN_FRENCH},
|
{L"00001009", MockKeyboard::LAYOUT_CANADIAN_FRENCH},
|
||||||
};
|
};
|
||||||
|
|
||||||
for (size_t i = 0; i < base::size(kLanguageIDs); ++i) {
|
for (size_t i = 0; i < std::size(kLanguageIDs); ++i) {
|
||||||
if (layout == kLanguageIDs[i].keyboard_layout) {
|
if (layout == kLanguageIDs[i].keyboard_layout) {
|
||||||
HKL new_keyboard_layout = LoadKeyboardLayout(kLanguageIDs[i].language,
|
HKL new_keyboard_layout = LoadKeyboardLayout(kLanguageIDs[i].language,
|
||||||
KLF_ACTIVATE);
|
KLF_ACTIVATE);
|
||||||
@@ -143,7 +142,7 @@ bool MockKeyboardDriverWin::SetModifiers(int modifiers) {
|
|||||||
{VK_RCONTROL, MockKeyboard::RIGHT_CONTROL},
|
{VK_RCONTROL, MockKeyboard::RIGHT_CONTROL},
|
||||||
{VK_RMENU, MockKeyboard::RIGHT_ALT},
|
{VK_RMENU, MockKeyboard::RIGHT_ALT},
|
||||||
};
|
};
|
||||||
for (size_t i = 0; i < base::size(kModifierMasks); ++i) {
|
for (size_t i = 0; i < std::size(kModifierMasks); ++i) {
|
||||||
const int kKeyDownMask = 0x80;
|
const int kKeyDownMask = 0x80;
|
||||||
if (modifiers & kModifierMasks[i].mask)
|
if (modifiers & kModifierMasks[i].mask)
|
||||||
keyboard_states_[kModifierMasks[i].key_code] = kKeyDownMask;
|
keyboard_states_[kModifierMasks[i].key_code] = kKeyDownMask;
|
||||||
@@ -161,7 +160,7 @@ int MockKeyboardDriverWin::GetCharacters(int key_code,
|
|||||||
wchar_t code[16];
|
wchar_t code[16];
|
||||||
int length =
|
int length =
|
||||||
ToUnicodeEx(key_code, MapVirtualKey(key_code, 0), &keyboard_states_[0],
|
ToUnicodeEx(key_code, MapVirtualKey(key_code, 0), &keyboard_states_[0],
|
||||||
&code[0], base::size(code), 0, active_keyboard_layout_);
|
&code[0], std::size(code), 0, active_keyboard_layout_);
|
||||||
if (length > 0)
|
if (length > 0)
|
||||||
output->assign(code);
|
output->assign(code);
|
||||||
return length;
|
return length;
|
||||||
|
@@ -6,12 +6,12 @@
|
|||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/files/file_path.h"
|
#include "base/files/file_path.h"
|
||||||
#include "base/files/file_util.h"
|
#include "base/files/file_util.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
@@ -64,7 +64,7 @@ bool WebTestBrowserCheckLayoutSystemDeps() {
|
|||||||
&metrics.lfSmCaptionFont};
|
&metrics.lfSmCaptionFont};
|
||||||
const wchar_t required_font[] = L"Segoe UI";
|
const wchar_t required_font[] = L"Segoe UI";
|
||||||
int required_font_size = -12;
|
int required_font_size = -12;
|
||||||
for (size_t i = 0; i < base::size(system_fonts); ++i) {
|
for (size_t i = 0; i < std::size(system_fonts); ++i) {
|
||||||
if (system_fonts[i]->lfHeight != required_font_size ||
|
if (system_fonts[i]->lfHeight != required_font_size ||
|
||||||
wcscmp(required_font, system_fonts[i]->lfFaceName)) {
|
wcscmp(required_font, system_fonts[i]->lfFaceName)) {
|
||||||
errors.push_back(
|
errors.push_back(
|
||||||
|
@@ -12,7 +12,6 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/no_destructor.h"
|
#include "base/no_destructor.h"
|
||||||
#include "base/path_service.h"
|
#include "base/path_service.h"
|
||||||
#include "base/strings/pattern.h"
|
#include "base/strings/pattern.h"
|
||||||
@@ -351,8 +350,7 @@ void WebTestContentBrowserClient::AppendExtraCommandLineSwitches(
|
|||||||
};
|
};
|
||||||
|
|
||||||
command_line->CopySwitchesFrom(*base::CommandLine::ForCurrentProcess(),
|
command_line->CopySwitchesFrom(*base::CommandLine::ForCurrentProcess(),
|
||||||
kForwardSwitches,
|
kForwardSwitches, std::size(kForwardSwitches));
|
||||||
base::size(kForwardSwitches));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<BrowserMainParts>
|
std::unique_ptr<BrowserMainParts>
|
||||||
@@ -411,8 +409,8 @@ WebTestContentBrowserClient::GetOriginsRequiringDedicatedProcess() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
origins_to_isolate.reserve(origins_to_isolate.size() +
|
origins_to_isolate.reserve(origins_to_isolate.size() +
|
||||||
base::size(kWptHostnames) *
|
std::size(kWptHostnames) *
|
||||||
base::size(kOriginTemplates));
|
std::size(kOriginTemplates));
|
||||||
for (const char* kWptHostname : kWptHostnames) {
|
for (const char* kWptHostname : kWptHostnames) {
|
||||||
for (const char* kOriginTemplate : kOriginTemplates) {
|
for (const char* kOriginTemplate : kOriginTemplates) {
|
||||||
std::string origin = base::StringPrintf(kOriginTemplate, kWptHostname);
|
std::string origin = base::StringPrintf(kOriginTemplate, kWptHostname);
|
||||||
|
@@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/callback.h"
|
#include "base/callback.h"
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/time/time.h"
|
#include "base/time/time.h"
|
||||||
#include "content/public/browser/permission_type.h"
|
#include "content/public/browser/permission_type.h"
|
||||||
#include "content/web_test/browser/web_test_browser_context.h"
|
#include "content/web_test/browser/web_test_browser_context.h"
|
||||||
@@ -84,9 +83,9 @@ void WebTestPushMessagingService::SubscribeFromWorker(
|
|||||||
|
|
||||||
if (permission_status == blink::mojom::PermissionStatus::GRANTED) {
|
if (permission_status == blink::mojom::PermissionStatus::GRANTED) {
|
||||||
std::vector<uint8_t> p256dh(kTestP256Key,
|
std::vector<uint8_t> p256dh(kTestP256Key,
|
||||||
kTestP256Key + base::size(kTestP256Key));
|
kTestP256Key + std::size(kTestP256Key));
|
||||||
std::vector<uint8_t> auth(kAuthentication,
|
std::vector<uint8_t> auth(kAuthentication,
|
||||||
kAuthentication + base::size(kAuthentication));
|
kAuthentication + std::size(kAuthentication));
|
||||||
const std::string subscription_id = "layoutTestRegistrationId";
|
const std::string subscription_id = "layoutTestRegistrationId";
|
||||||
const GURL endpoint = CreateEndpoint(subscription_id);
|
const GURL endpoint = CreateEndpoint(subscription_id);
|
||||||
|
|
||||||
@@ -110,9 +109,9 @@ void WebTestPushMessagingService::GetSubscriptionInfo(
|
|||||||
const std::string& subscription_id,
|
const std::string& subscription_id,
|
||||||
SubscriptionInfoCallback callback) {
|
SubscriptionInfoCallback callback) {
|
||||||
std::vector<uint8_t> p256dh(kTestP256Key,
|
std::vector<uint8_t> p256dh(kTestP256Key,
|
||||||
kTestP256Key + base::size(kTestP256Key));
|
kTestP256Key + std::size(kTestP256Key));
|
||||||
std::vector<uint8_t> auth(kAuthentication,
|
std::vector<uint8_t> auth(kAuthentication,
|
||||||
kAuthentication + base::size(kAuthentication));
|
kAuthentication + std::size(kAuthentication));
|
||||||
const GURL endpoint = CreateEndpoint(subscription_id);
|
const GURL endpoint = CreateEndpoint(subscription_id);
|
||||||
std::move(callback).Run(true /* is_valid */, endpoint, GetFutureTime(),
|
std::move(callback).Run(true /* is_valid */, endpoint, GetFutureTime(),
|
||||||
p256dh, auth);
|
p256dh, auth);
|
||||||
|
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
#include "content/web_test/renderer/accessibility_controller.h"
|
#include "content/web_test/renderer/accessibility_controller.h"
|
||||||
|
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "content/web_test/renderer/web_frame_test_proxy.h"
|
#include "content/web_test/renderer/web_frame_test_proxy.h"
|
||||||
#include "gin/handle.h"
|
#include "gin/handle.h"
|
||||||
#include "gin/object_template_builder.h"
|
#include "gin/object_template_builder.h"
|
||||||
@@ -235,7 +234,7 @@ void AccessibilityController::PostNotification(
|
|||||||
};
|
};
|
||||||
local_frame->CallFunctionEvenIfScriptDisabled(
|
local_frame->CallFunctionEvenIfScriptDisabled(
|
||||||
v8::Local<v8::Function>::New(isolate, notification_callback_),
|
v8::Local<v8::Function>::New(isolate, notification_callback_),
|
||||||
context->Global(), base::size(argv), argv);
|
context->Global(), std::size(argv), argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AccessibilityController::LogAccessibilityEvents() {
|
void AccessibilityController::LogAccessibilityEvents() {
|
||||||
|
@@ -10,7 +10,6 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/strings/stringprintf.h"
|
#include "base/strings/stringprintf.h"
|
||||||
#include "gin/handle.h"
|
#include "gin/handle.h"
|
||||||
#include "third_party/blink/public/platform/web_string.h"
|
#include "third_party/blink/public/platform/web_string.h"
|
||||||
@@ -505,7 +504,7 @@ void WebAXObjectProxy::NotificationReceived(
|
|||||||
// dirtying layout during post-layout hooks?
|
// dirtying layout during post-layout hooks?
|
||||||
frame->CallFunctionEvenIfScriptDisabled(
|
frame->CallFunctionEvenIfScriptDisabled(
|
||||||
v8::Local<v8::Function>::New(isolate, notification_callback_),
|
v8::Local<v8::Function>::New(isolate, notification_callback_),
|
||||||
context->Global(), base::size(argv), argv);
|
context->Global(), std::size(argv), argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebAXObjectProxy::Reset() {
|
void WebAXObjectProxy::Reset() {
|
||||||
|
@@ -9,7 +9,6 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include "base/check.h"
|
#include "base/check.h"
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/strings/string_util.h"
|
#include "base/strings/string_util.h"
|
||||||
#include "third_party/blink/public/platform/web_string.h"
|
#include "third_party/blink/public/platform/web_string.h"
|
||||||
#include "third_party/blink/public/web/web_text_checking_result.h"
|
#include "third_party/blink/public/web/web_text_checking_result.h"
|
||||||
@@ -54,7 +53,7 @@ bool WebTestGrammarChecker::CheckGrammarOfString(
|
|||||||
{"the the adlj adaasj sdklj. there there", 33, 5},
|
{"the the adlj adaasj sdklj. there there", 33, 5},
|
||||||
{"zz apple orange.", 0, 16},
|
{"zz apple orange.", 0, 16},
|
||||||
};
|
};
|
||||||
for (size_t i = 0; i < base::size(kGrammarErrors); ++i) {
|
for (size_t i = 0; i < std::size(kGrammarErrors); ++i) {
|
||||||
size_t offset = 0;
|
size_t offset = 0;
|
||||||
std::u16string error(
|
std::u16string error(
|
||||||
kGrammarErrors[i].text,
|
kGrammarErrors[i].text,
|
||||||
|
@@ -9,7 +9,6 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include "base/check_op.h"
|
#include "base/check_op.h"
|
||||||
#include "base/cxx17_backports.h"
|
|
||||||
#include "base/strings/string_util.h"
|
#include "base/strings/string_util.h"
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
@@ -165,7 +164,7 @@ bool WebTestSpellChecker::InitializeIfNeeded() {
|
|||||||
"ifmmp", "qwertyuiopasd", "qwertyuiopasdf", "upper case", "wellcome"};
|
"ifmmp", "qwertyuiopasd", "qwertyuiopasdf", "upper case", "wellcome"};
|
||||||
|
|
||||||
misspelled_words_.clear();
|
misspelled_words_.clear();
|
||||||
for (size_t i = 0; i < base::size(misspelled_words); ++i)
|
for (size_t i = 0; i < std::size(misspelled_words); ++i)
|
||||||
misspelled_words_.push_back(
|
misspelled_words_.push_back(
|
||||||
std::u16string(misspelled_words[i],
|
std::u16string(misspelled_words[i],
|
||||||
misspelled_words[i] + strlen(misspelled_words[i])));
|
misspelled_words[i] + strlen(misspelled_words[i])));
|
||||||
|
Reference in New Issue
Block a user