Commit fbf1ec88 authored by Ali Juma's avatar Ali Juma Committed by Commit Bot

[iOS] Build and run unit tests in components/safe_browsing/core/db

This CL makes components/safe_browsing/core/db buildable on iOS, and
makes unit tests in this directory along with unit tests in
components/safe_browsing/core/common run on iOS as part of
components_unittests.

Change-Id: I1c973eb9b9427ec82d48945d5a26d9d10d178c2b
Bug: 1028755
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2001580Reviewed-by: default avatarVarun Khaneja <vakh@chromium.org>
Reviewed-by: default avatarJan Wilken Dörrie <jdoerrie@chromium.org>
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Auto-Submit: Ali Juma <ajuma@chromium.org>
Cr-Commit-Position: refs/heads/master@{#733312}
parent 6fc00160
......@@ -393,7 +393,7 @@ test("components_unittests") {
if (safe_browsing_mode == 1) {
deps += [
"//components/safe_browsing/core:verdict_cache_manager_unittest",
"//components/safe_browsing/core/db:unit_tests_desktop",
"//components/safe_browsing/core/db:unit_tests_local_db",
]
} else if (safe_browsing_mode == 2) {
deps += [ "//components/safe_browsing/android:unit_tests_mobile" ]
......
......@@ -273,6 +273,7 @@ jumbo_static_library("browser") {
"//components/pref_registry",
"//components/prefs",
"//components/safe_browsing/core:features",
"//components/safe_browsing/core/common:safe_browsing_prefs",
"//components/security_state/core",
"//components/signin/public/identity_manager",
"//components/strings",
......@@ -302,7 +303,6 @@ jumbo_static_library("browser") {
"http_credentials_cleaner.cc",
"http_credentials_cleaner.h",
]
deps += [ "//components/safe_browsing/core/common:safe_browsing_prefs" ]
}
if ((is_posix && !is_mac && !is_ios) || is_fuchsia) {
......@@ -624,6 +624,7 @@ source_set("unit_tests") {
"//components/password_manager/core/common",
"//components/prefs:test_support",
"//components/safe_browsing/core:features",
"//components/safe_browsing/core/common:safe_browsing_prefs",
"//components/security_state/core",
"//components/signin/public/identity_manager:test_support",
"//components/strings",
......@@ -645,10 +646,6 @@ source_set("unit_tests") {
"//ui/gfx:test_support",
"//url",
]
if (password_reuse_detection_support) {
deps += [ "//components/safe_browsing/core/common:safe_browsing_prefs" ]
}
}
fuzzer_test("csv_reader_fuzzer") {
......
......@@ -16,6 +16,24 @@ static_library("features") {
]
}
proto_library("csd_proto") {
sources = [ "proto/csd.proto" ]
}
proto_library("webui_proto") {
sources = [ "proto/webui.proto" ]
}
proto_library("realtimeapi_proto") {
sources = [ "proto/realtimeapi.proto" ]
deps = [ ":csd_proto" ]
}
proto_library("webprotect_proto") {
sources = [ "proto/webprotect.proto" ]
}
# safe_browsing/ pulls in content/, which doesn't work on iOS.
# TODO(thakis): This should be `safe_browsing_mode != 0`, but chromecast builds
# set safe_browsing_mode to 0 and build chrome/, and chrome/ currently
......@@ -24,24 +42,6 @@ static_library("features") {
if (!is_ios) {
assert(!is_ios, "safe_browsing/ pulls in content/ which doesn't work on iOS")
proto_library("csd_proto") {
sources = [ "proto/csd.proto" ]
}
proto_library("webui_proto") {
sources = [ "proto/webui.proto" ]
}
proto_library("realtimeapi_proto") {
sources = [ "proto/realtimeapi.proto" ]
deps = [ ":csd_proto" ]
}
proto_library("webprotect_proto") {
sources = [ "proto/webprotect.proto" ]
}
static_library("ping_manager") {
sources = [
"ping_manager.cc",
......
......@@ -6,6 +6,37 @@ import("//build/config/features.gni")
import("//components/safe_browsing/buildflags.gni")
import("//mojo/public/tools/bindings/mojom.gni")
static_library("safe_browsing_prefs") {
sources = [
"safe_browsing_prefs.cc",
"safe_browsing_prefs.h",
]
deps = [
"//base:base",
"//components/pref_registry:pref_registry",
"//components/prefs",
"//components/safe_browsing/core:features",
"//components/safe_browsing/core/common:thread_utils",
"//net:net",
]
}
source_set("unit_tests") {
testonly = true
sources = [ "safe_browsing_prefs_unittest.cc" ]
deps = [
":safe_browsing_prefs",
":test_support",
"//base:base",
"//base/test:test_support",
"//components/prefs:test_support",
"//components/safe_browsing/core:features",
"//testing/gtest",
"//url:url",
]
}
# TODO(crbug.com/1028755): Remove this condition once there are no longer any
# dependencies on content/.
if (!is_ios) {
......@@ -33,37 +64,6 @@ if (!is_ios) {
public_deps = [ ":interfaces" ]
}
static_library("safe_browsing_prefs") {
sources = [
"safe_browsing_prefs.cc",
"safe_browsing_prefs.h",
]
deps = [
"//base:base",
"//components/pref_registry:pref_registry",
"//components/prefs",
"//components/safe_browsing/core:features",
"//components/safe_browsing/core/common:thread_utils",
"//net:net",
]
}
source_set("unit_tests") {
testonly = true
sources = [ "safe_browsing_prefs_unittest.cc" ]
deps = [
":safe_browsing_prefs",
":test_support",
"//base:base",
"//base/test:test_support",
"//components/prefs:test_support",
"//components/safe_browsing/core:features",
"//testing/gtest",
"//url:url",
]
}
mojom("interfaces") {
sources = [ "safe_browsing.mojom" ]
......
......@@ -157,7 +157,6 @@ static_library("v4_local_database_manager") {
"//build:branding_buildflags",
"//components/safe_browsing/core:webui_proto",
"//components/safe_browsing/core/common:thread_utils",
"//components/safe_browsing/core/realtime:policy_engine",
"//components/safe_browsing/core/realtime:url_lookup_service",
"//crypto",
"//net",
......@@ -298,7 +297,7 @@ source_set("unit_tests_shared") {
}
}
source_set("unit_tests_desktop") {
source_set("unit_tests_local_db") {
testonly = true
sources = [
"v4_database_unittest.cc",
......
......@@ -19,7 +19,6 @@
#include "build/branding_buildflags.h"
#include "components/safe_browsing/core/common/thread_utils.h"
#include "components/safe_browsing/core/db/v4_protocol_manager_util.h"
#include "components/safe_browsing/core/realtime/policy_engine.h"
#include "crypto/sha2.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
......
......@@ -2,25 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
static_library("policy_engine") {
sources = [
"policy_engine.cc",
"policy_engine.h",
]
deps = [
"//base:base",
"//components/prefs",
"//components/safe_browsing/core:features",
"//components/safe_browsing/core:realtimeapi_proto",
"//components/safe_browsing/core/common:safe_browsing_prefs",
"//components/unified_consent",
"//components/user_prefs",
"//content/public/browser",
"//content/public/common:resource_type_header",
]
}
static_library("url_lookup_service") {
sources = [
"url_lookup_service.cc",
......@@ -28,7 +9,6 @@ static_library("url_lookup_service") {
]
deps = [
":policy_engine",
"//base:base",
"//components/safe_browsing/core:realtimeapi_proto",
"//components/safe_browsing/core/common:thread_utils",
......@@ -38,25 +18,48 @@ static_library("url_lookup_service") {
]
}
source_set("unit_tests") {
testonly = true
sources = [
"policy_engine_unittest.cc",
"url_lookup_service_unittest.cc",
]
deps = [
":policy_engine",
":url_lookup_service",
"//base/test:test_support",
"//components/safe_browsing/core:features",
"//components/safe_browsing/core/common:safe_browsing_prefs",
"//components/safe_browsing/core/common:test_support",
"//components/sync_preferences:test_support",
"//components/unified_consent",
"//components/user_prefs",
"//content/test:test_support",
"//services/network:test_support",
"//services/network/public/cpp:cpp",
"//testing/gtest",
]
# TODO(crbug.com/1028755): Remove this condition once there are no longer any
# dependencies on content/.
if (!is_ios) {
static_library("policy_engine") {
sources = [
"policy_engine.cc",
"policy_engine.h",
]
deps = [
"//base:base",
"//components/prefs",
"//components/safe_browsing/core:features",
"//components/safe_browsing/core:realtimeapi_proto",
"//components/safe_browsing/core/common:safe_browsing_prefs",
"//components/unified_consent",
"//components/user_prefs",
"//content/public/browser",
"//content/public/common:resource_type_header",
]
}
source_set("unit_tests") {
testonly = true
sources = [
"policy_engine_unittest.cc",
"url_lookup_service_unittest.cc",
]
deps = [
":policy_engine",
":url_lookup_service",
"//base/test:test_support",
"//components/safe_browsing/core:features",
"//components/safe_browsing/core/common:safe_browsing_prefs",
"//components/safe_browsing/core/common:test_support",
"//components/sync_preferences:test_support",
"//components/unified_consent",
"//components/user_prefs",
"//content/test:test_support",
"//services/network:test_support",
"//services/network/public/cpp:cpp",
"//testing/gtest",
]
}
}
......@@ -7,7 +7,7 @@
source_set("unit_tests") {
testonly = true
deps = [
"//components/safe_browsing/core/common:test_support",
"//components/safe_browsing/core/common:thread_utils",
"//components/safe_browsing/core/common:unit_tests",
"//components/safe_browsing/core/db:unit_tests_local_db",
]
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment