Skip to content

Commit

Permalink
Fix compilation of components_unittests with disable_file_support=true.
Browse files Browse the repository at this point in the history
The test components/update_client/crx_downloader_unittest.cc depends
on net::LocalHostTestURLRequestInterceptor class that is not compiled
when disable_file_support is set to true.

Add a new file src/net/features.gni to allow conditional compilation
based on that flag from outside of //net.

BUG=640686

Review-Url: https://codereview.chromium.org/2318343003
Cr-Commit-Position: refs/heads/master@{#417287}
  • Loading branch information
sdefresne authored and Commit bot committed Sep 8, 2016
1 parent 7e8c85b commit eb26586
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 19 deletions.
7 changes: 6 additions & 1 deletion components/update_client/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//net/features.gni")

static_library("update_client") {
sources = [
"action.cc",
Expand Down Expand Up @@ -115,7 +117,6 @@ source_set("unit_tests") {
testonly = true
sources = [
"component_patcher_unittest.cc",
"crx_downloader_unittest.cc",
"persisted_data_unittest.cc",
"ping_manager_unittest.cc",
"request_sender_unittest.cc",
Expand All @@ -126,6 +127,10 @@ source_set("unit_tests") {
"utils_unittest.cc",
]

if (!disable_file_support) {
sources += [ "crx_downloader_unittest.cc" ]
}

deps = [
":test_support",
":unit_tests_bundle_data",
Expand Down
19 changes: 1 addition & 18 deletions net/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import("//build/config/compiler/compiler.gni")
import("//build/config/crypto.gni")
import("//build/config/features.gni")
import("//build/config/ui.gni")
import("//net/features.gni")
import("//testing/libfuzzer/fuzzer_test.gni")
import("//testing/test.gni")
import("//third_party/icu/config.gni")
Expand Down Expand Up @@ -39,24 +40,6 @@ posix_avoid_mmap = is_android && current_cpu != "x86"
use_v8_in_net = !is_ios
enable_built_in_dns = !is_ios

declare_args() {
# Disables support for file URLs. File URL support requires use of icu.
disable_file_support = false

# WebSockets and socket stream code are not used on iOS and are optional in
# cronet.
enable_websockets = !is_ios
disable_ftp_support = is_ios || is_chromecast

# Enable Kerberos authentication. It is disabled by default on ChromeOS, iOS,
# Chromecast, at least for now. This feature needs configuration (krb5.conf
# and so on).
use_kerberos = !is_chromeos && !is_ios && !is_chromecast

# Do not disable brotli filter by default.
disable_brotli_filter = false
}

config("net_config") {
defines = []
if (posix_avoid_mmap) {
Expand Down
23 changes: 23 additions & 0 deletions net/features.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/features.gni")

declare_args() {
# Disables support for file URLs. File URL support requires use of icu.
disable_file_support = false

# WebSockets and socket stream code are not used on iOS and are optional in
# cronet.
enable_websockets = !is_ios
disable_ftp_support = is_ios || is_chromecast

# Enable Kerberos authentication. It is disabled by default on ChromeOS, iOS,
# Chromecast, at least for now. This feature needs configuration (krb5.conf
# and so on).
use_kerberos = !is_chromeos && !is_ios && !is_chromecast

# Do not disable brotli filter by default.
disable_brotli_filter = false
}

0 comments on commit eb26586

Please sign in to comment.