[Cleanup] Add CreateWebContentsWithID helper to TabStripModelTest
[chromium-blink-merge.git] / url / BUILD.gn
blob3bffec26cf1751dc38afdf98158b08604dc4a70d
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 import("//url/config.gni")
7 # Sets the USE_ICU_ALTERNATIVES_ON_ANDROID define based on the build flag.
8 config("url_icu_config") {
9   if (use_icu_alternatives_on_android) {
10     defines = [ "USE_ICU_ALTERNATIVES_ON_ANDROID=1" ]
11   }
14 component("url") {
15   if (is_win) {
16     # Don't conflict with Windows' "url.dll".
17     output_name = "url_lib"
18   }
19   sources = [
20     "android/url_jni_registrar.cc",
21     "android/url_jni_registrar.h",
22     "gurl.cc",
23     "gurl.h",
24     "origin.cc",
25     "origin.h",
26     "third_party/mozilla/url_parse.cc",
27     "third_party/mozilla/url_parse.h",
28     "url_canon.h",
29     "url_canon_etc.cc",
30     "url_canon_filesystemurl.cc",
31     "url_canon_fileurl.cc",
32     "url_canon_host.cc",
33     "url_canon_icu.cc",
34     "url_canon_icu.h",
35     "url_canon_internal.cc",
36     "url_canon_internal.h",
37     "url_canon_internal_file.h",
38     "url_canon_ip.cc",
39     "url_canon_ip.h",
40     "url_canon_mailtourl.cc",
41     "url_canon_path.cc",
42     "url_canon_pathurl.cc",
43     "url_canon_query.cc",
44     "url_canon_relative.cc",
45     "url_canon_stdstring.cc",
46     "url_canon_stdstring.h",
47     "url_canon_stdurl.cc",
48     "url_constants.cc",
49     "url_constants.h",
50     "url_export.h",
51     "url_file.h",
52     "url_parse_file.cc",
53     "url_parse_internal.h",
54     "url_util.cc",
55     "url_util.h",
56   ]
58   defines = [ "URL_IMPLEMENTATION" ]
60   configs += [ ":url_icu_config" ]
62   if (is_win) {
63     cflags = [ "/wd4267" ]  # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
64   }
66   deps = [
67     "//base",
68     "//base/third_party/dynamic_annotations",
69     "//third_party/icu:icudata",
70     "//third_party/icu",
71   ]
73   if (use_icu_alternatives_on_android) {
74     sources -= [
75       "url_canon_icu.cc",
76       "url_canon_icu.h",
77     ]
78     deps -= [
79       "//third_party/icu:icudata",
80       "//third_party/icu",
81     ]
83     sources += [
84       "url_canon_icu_alternatives_android.cc",
85       "url_canon_icu_alternatives_android.h",
86     ]
87   }
90 # TODO(dpranke): crbug.com/360936. Get this to build and run on Android.
91 if (!is_android) {
92   test("url_unittests") {
93     sources = [
94       "gurl_unittest.cc",
95       "origin_unittest.cc",
96       "url_canon_icu_unittest.cc",
97       "url_canon_unittest.cc",
98       "url_parse_unittest.cc",
99       "url_test_utils.h",
100       "url_util_unittest.cc",
101     ]
103     #if (is_posix && !is_mac && !is_ios) {
104     #  if (use_allocator!="none") {
105     #    deps += "//base/allocator"
106     #  }
107     #}
109     if (is_win) {
110       cflags = [
111         # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
112         "/wd4267",
113       ]
114     }
116     deps = [
117       ":url",
118       "//base",
119       "//base/test:run_all_unittests",
120       "//testing/gtest",
121       "//third_party/icu:icuuc",
122     ]
124     if (use_icu_alternatives_on_android) {
125       sources -= [ "url_canon_icu_unittest.cc" ]
126       deps -= [ "//third_party/icu:icuuc" ]
127     }
128   }