summaryrefslogtreecommitdiffstats
path: root/components/precache/core/BUILD.gn
blob: 4aa14d0ee1f54d779088ebcd63cfeb41913de05c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Copyright 2014 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("//third_party/protobuf/proto_library.gni")

# These values are duplicated in the GYP build in:
# //components/precache/precache_defines.gypi
precache_config_settings_url =
    "http://www.gstatic.com/chrome/wifiprefetch/precache_config"
precache_manifest_url_prefix =
    "http://www.gstatic.com/chrome/wifiprefetch/hosts/"

config("precache_config") {
  defines = [
    "PRECACHE_CONFIG_SETTINGS_URL=\"$precache_config_settings_url\"",
    "PRECACHE_MANIFEST_URL_PREFIX=\"$precache_manifest_url_prefix\"",
  ]
}

source_set("core") {
  sources = [
    "precache_database.cc",
    "precache_database.h",
    "precache_fetcher.cc",
    "precache_fetcher.h",
    "precache_switches.cc",
    "precache_switches.h",
    "precache_url_table.cc",
    "precache_url_table.h",
  ]

  # Note the GYP build sets this as direct dependent settings, but this is
  # only used to share the settings with the unit tests. Instead, we just
  # set this config for the necessary targets manually.
  configs += [ ":precache_config" ]

  deps = [
    ":proto",
    "//base",
    "//url",
  ]
}

proto_library("proto") {
  sources = [
    "proto/precache.proto",
  ]
}

source_set("unit_tests") {
  testonly = true
  sources = [
    "precache_database_unittest.cc",
    "precache_fetcher_unittest.cc",
    "precache_url_table_unittest.cc",
  ]
  deps = [
    ":core",
    ":proto",
    "//testing/gmock",
    "//testing/gtest",
  ]
}