summaryrefslogtreecommitdiffstats
path: root/sql/BUILD.gn
blob: 4ffa421df12f8ffd03a69dbbd6d5f7a29cd1fa18 (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# 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("//testing/test.gni")

component("sql") {
  sources = [
    "connection.cc",
    "connection.h",
    "connection_memory_dump_provider.cc",
    "connection_memory_dump_provider.h",
    "error_delegate_util.cc",
    "error_delegate_util.h",
    "init_status.h",
    "meta_table.cc",
    "meta_table.h",
    "recovery.cc",
    "recovery.h",
    "sql_memory_dump_provider.cc",
    "sql_memory_dump_provider.h",
    "statement.cc",
    "statement.h",
    "transaction.cc",
    "transaction.h",
  ]

  # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
  configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]

  defines = [ "SQL_IMPLEMENTATION" ]

  deps = [
    "//base",
    "//base/third_party/dynamic_annotations",
    "//third_party/sqlite",
  ]
}

source_set("test_support") {
  testonly = true
  sources = [
    "test/error_callback_support.cc",
    "test/error_callback_support.h",
    "test/scoped_error_ignorer.cc",
    "test/scoped_error_ignorer.h",
    "test/test_helpers.cc",
    "test/test_helpers.h",
  ]

  public_deps = [
    ":sql",
  ]
  deps = [
    "//base",
    "//testing/gtest",
    "//third_party/sqlite",
  ]
}

source_set("redirection_header") {
  # This target exists because we need a way to switch between
  # "test/sql_test_base.h" and "mojo/sql_test_base.h" at compile time, to allow
  # us to switch out the gtest vs mojo:apptest frameworks.
  check_includes = false

  sources = [
    "correct_sql_test_base.h",
  ]
}

test("sql_unittests") {
  sources = [
    "connection_unittest.cc",
    "meta_table_unittest.cc",
    "recovery_unittest.cc",
    "sql_memory_dump_provider_unittest.cc",
    "sqlite_features_unittest.cc",
    "statement_unittest.cc",
    "test/paths.cc",
    "test/paths.h",
    "test/run_all_unittests.cc",
    "test/sql_test_base.cc",
    "test/sql_test_base.h",
    "test/sql_test_suite.cc",
    "test/sql_test_suite.h",
    "transaction_unittest.cc",
  ]

  data = [
    "test/data/",
  ]

  # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
  configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]

  deps = [
    ":redirection_header",
    ":sql",
    ":test_support",
    "//base/test:test_support",
    "//testing/gtest",
    "//third_party/sqlite",
  ]

  if (is_android) {
    isolate_file = "sql_unittests.isolate"
  }

  # TODO(GYP)
  #['OS == "android"', {
  #  'dependencies': [
  #    '../testing/android/native_test.gyp:native_test_native_code',
  #  ],
  #}],
}

if (is_android) {
  #TODO(GYP)
  #'target_name': 'sql_unittests_apk',
  #'type': 'none',
  #'dependencies': [
  #  'sql_unittests',
  #],
  #'variables': {
  #  'test_suite_name': 'sql_unittests',
  #},
  #'includes': [ '../build/apk_test.gypi' ],
}