1# Copyright 2022 Google LLC 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14load("@build_bazel_rules_android//android:rules.bzl", "android_application_test", "android_local_test") 15 16package( 17 default_applicable_licenses = ["//:license"], 18 default_visibility = ["//:__subpackages__"], 19 licenses = ["notice"], 20) 21 22android_application_test( 23 name = "AssetFileDescriptorOpenerAndroidTest", 24 timeout = "moderate", 25 srcs = [ 26 "AssetFileDescriptorOpenerAndroidTest.java", 27 ], 28 manifest = "//javatests/com/google/android/libraries/mobiledatadownload/file:AndroidManifest.xml", 29 target_devices = [ 30 "//tools/android/emulated_devices/generic_phone:google_23_x86", 31 ], 32 deps = [ 33 "//java/com/google/android/libraries/mobiledatadownload/file", 34 "//java/com/google/android/libraries/mobiledatadownload/file/backends:file", 35 "//java/com/google/android/libraries/mobiledatadownload/file/common/testing", 36 "//java/com/google/android/libraries/mobiledatadownload/file/common/testing:extras", 37 "//java/com/google/android/libraries/mobiledatadownload/file/openers:asset_file_descriptor", 38 "//java/com/google/android/libraries/mobiledatadownload/file/samples", 39 "@com_google_guava_guava", 40 "@junit", 41 "@truth", 42 ], 43) 44 45android_local_test( 46 name = "IntegrityUriComputingOpenerTest", 47 srcs = ["IntegrityUriComputingOpenerTest.java"], 48 deps = [ 49 "//java/com/google/android/libraries/mobiledatadownload/file", 50 "//java/com/google/android/libraries/mobiledatadownload/file/backends:file", 51 "//java/com/google/android/libraries/mobiledatadownload/file/common/testing", 52 "//java/com/google/android/libraries/mobiledatadownload/file/openers:integrity_uri_computer", 53 "//java/com/google/android/libraries/mobiledatadownload/file/transforms:integrity", 54 "//java/com/google/android/libraries/mobiledatadownload/file/transforms:proto_fragments", 55 "//proto:transform_java_proto_lite", 56 "@com_google_guava_guava", 57 "@truth", 58 ], 59) 60 61android_application_test( 62 name = "NativeReadOpenerAndroidTest", 63 timeout = "moderate", 64 srcs = [ 65 "NativeReadOpenerAndroidTest.java", 66 ], 67 manifest = "//javatests/com/google/android/libraries/mobiledatadownload/file:AndroidManifest.xml", 68 target_devices = [ 69 "//tools/android/emulated_devices/generic_phone:google_23_x86", 70 ], 71 deps = [ 72 "//java/com/google/android/libraries/mobiledatadownload/file", 73 "//java/com/google/android/libraries/mobiledatadownload/file/backends:file", 74 "//java/com/google/android/libraries/mobiledatadownload/file/backends:file_descriptor", 75 "//java/com/google/android/libraries/mobiledatadownload/file/common/testing", 76 "//java/com/google/android/libraries/mobiledatadownload/file/common/testing:extras", 77 "//java/com/google/android/libraries/mobiledatadownload/file/openers:closeable_uri", 78 "//java/com/google/android/libraries/mobiledatadownload/file/openers:native", 79 "@com_google_guava_guava", 80 "@junit", 81 "@truth", 82 ], 83) 84 85android_local_test( 86 name = "NativeReadOpenerTest", 87 srcs = [ 88 "NativeReadOpenerTest.java", 89 ], 90 deps = [ 91 "//java/com/google/android/libraries/mobiledatadownload/file", 92 "//java/com/google/android/libraries/mobiledatadownload/file/backends:file", 93 "//java/com/google/android/libraries/mobiledatadownload/file/common", 94 "//java/com/google/android/libraries/mobiledatadownload/file/common:fragment", 95 "//java/com/google/android/libraries/mobiledatadownload/file/common/testing", 96 "//java/com/google/android/libraries/mobiledatadownload/file/common/testing:matchers", 97 "//java/com/google/android/libraries/mobiledatadownload/file/openers:native", 98 "//java/com/google/android/libraries/mobiledatadownload/file/spi", 99 "//java/com/google/android/libraries/mobiledatadownload/file/transforms:compress", 100 "//java/com/google/android/libraries/mobiledatadownload/file/transforms:proto", 101 "//java/com/google/testing/mockito", 102 "@com_google_guava_guava", 103 "@mockito", 104 "@truth", 105 ], 106) 107 108android_application_test( 109 name = "MappedByteBufferOpenerAndroidTest", 110 timeout = "moderate", 111 srcs = [ 112 "MappedByteBufferOpenerAndroidTest.java", 113 ], 114 manifest = "//javatests/com/google/android/libraries/mobiledatadownload/file:AndroidManifest.xml", 115 shard_count = 2, 116 target_devices = [ 117 "//tools/android/emulated_devices/generic_phone:google_23_x86", 118 ], 119 deps = [ 120 "//java/com/google/android/libraries/mobiledatadownload/file", 121 "//java/com/google/android/libraries/mobiledatadownload/file/backends:file", 122 "//java/com/google/android/libraries/mobiledatadownload/file/common/testing", 123 "//java/com/google/android/libraries/mobiledatadownload/file/common/testing:extras", 124 "//java/com/google/android/libraries/mobiledatadownload/file/openers:memory_mapped_bytes", 125 "//java/com/google/android/libraries/mobiledatadownload/file/transforms:compress", 126 "//java/com/google/android/libraries/mobiledatadownload/file/transforms:proto", 127 "@com_google_guava_guava", 128 "@junit", 129 "@truth", 130 ], 131) 132 133android_application_test( 134 name = "ParcelFileDescriptorOpenerAndroidTest", 135 timeout = "moderate", 136 srcs = [ 137 "ParcelFileDescriptorOpenerAndroidTest.java", 138 ], 139 manifest = "//javatests/com/google/android/libraries/mobiledatadownload/file:AndroidManifest.xml", 140 target_devices = [ 141 "//tools/android/emulated_devices/generic_phone:google_23_x86", 142 ], 143 deps = [ 144 "//java/com/google/android/libraries/mobiledatadownload/file", 145 "//java/com/google/android/libraries/mobiledatadownload/file/backends:file", 146 "//java/com/google/android/libraries/mobiledatadownload/file/common", 147 "//java/com/google/android/libraries/mobiledatadownload/file/common/testing", 148 "//java/com/google/android/libraries/mobiledatadownload/file/common/testing:extras", 149 "//java/com/google/android/libraries/mobiledatadownload/file/openers:parcel_file_descriptor", 150 "//java/com/google/android/libraries/mobiledatadownload/file/samples", 151 "//java/com/google/android/libraries/mobiledatadownload/file/transforms:compress", 152 "//java/com/google/android/libraries/mobiledatadownload/file/transforms:proto", 153 "@com_google_guava_guava", 154 "@junit", 155 "@truth", 156 ], 157) 158 159android_local_test( 160 name = "ReadByteArrayOpenerTest", 161 srcs = [ 162 "ReadByteArrayOpenerTest.java", 163 ], 164 deps = [ 165 "//java/com/google/android/libraries/mobiledatadownload/file", 166 "//java/com/google/android/libraries/mobiledatadownload/file/backends:file", 167 "//java/com/google/android/libraries/mobiledatadownload/file/common/testing", 168 "//java/com/google/android/libraries/mobiledatadownload/file/common/testing:extras", 169 "//java/com/google/android/libraries/mobiledatadownload/file/openers:bytes", 170 "//java/com/google/android/libraries/mobiledatadownload/file/samples", 171 "//java/com/google/android/libraries/mobiledatadownload/file/transforms:compress", 172 "//java/com/google/android/libraries/mobiledatadownload/file/transforms:proto", 173 "@truth", 174 ], 175) 176 177android_local_test( 178 name = "WriteByteArrayOpenerTest", 179 srcs = [ 180 "WriteByteArrayOpenerTest.java", 181 ], 182 deps = [ 183 "//java/com/google/android/libraries/mobiledatadownload/file", 184 "//java/com/google/android/libraries/mobiledatadownload/file/backends:file", 185 "//java/com/google/android/libraries/mobiledatadownload/file/behaviors:syncing", 186 "//java/com/google/android/libraries/mobiledatadownload/file/common/testing", 187 "//java/com/google/android/libraries/mobiledatadownload/file/openers:bytes", 188 "//java/com/google/android/libraries/mobiledatadownload/file/openers:stream", 189 "//java/com/google/android/libraries/mobiledatadownload/file/samples", 190 "//java/com/google/android/libraries/mobiledatadownload/file/spi", 191 "//java/com/google/android/libraries/mobiledatadownload/file/transforms:compress", 192 "//java/com/google/android/libraries/mobiledatadownload/file/transforms:proto", 193 "@mockito", 194 "@truth", 195 ], 196) 197 198android_local_test( 199 name = "StringOpenerTest", 200 srcs = [ 201 "StringOpenerTest.java", 202 ], 203 manifest = "//javatests/com/google/android/libraries/mobiledatadownload/file:AndroidManifest.xml", 204 deps = [ 205 "//java/com/google/android/libraries/mobiledatadownload/file", 206 "//java/com/google/android/libraries/mobiledatadownload/file/backends:file", 207 "//java/com/google/android/libraries/mobiledatadownload/file/behaviors:syncing", 208 "//java/com/google/android/libraries/mobiledatadownload/file/common/internal:charsets", 209 "//java/com/google/android/libraries/mobiledatadownload/file/common/testing", 210 "//java/com/google/android/libraries/mobiledatadownload/file/openers:string", 211 "@mockito", 212 "@truth", 213 ], 214) 215 216android_application_test( 217 name = "ReadFileOpenerAndroidTest", 218 timeout = "moderate", 219 srcs = [ 220 "ReadFileOpenerAndroidTest.java", 221 ], 222 manifest = "//javatests/com/google/android/libraries/mobiledatadownload/file:AndroidManifest.xml", 223 shard_count = 2, 224 target_devices = [ 225 "//tools/android/emulated_devices/generic_phone:google_23_x86", 226 ], 227 deps = [ 228 "//java/com/google/android/libraries/mobiledatadownload/file", 229 "//java/com/google/android/libraries/mobiledatadownload/file/backends:file", 230 "//java/com/google/android/libraries/mobiledatadownload/file/common", 231 "//java/com/google/android/libraries/mobiledatadownload/file/common/testing", 232 "//java/com/google/android/libraries/mobiledatadownload/file/common/testing:extras", 233 "//java/com/google/android/libraries/mobiledatadownload/file/openers:file", 234 "//java/com/google/android/libraries/mobiledatadownload/file/openers:stream", 235 "//java/com/google/android/libraries/mobiledatadownload/file/samples", 236 "//java/com/google/android/libraries/mobiledatadownload/file/transforms:compress", 237 "//java/com/google/android/libraries/mobiledatadownload/file/transforms:proto", 238 "@androidx_test", 239 "@com_google_guava_guava", 240 "@junit", 241 "@truth", 242 ], 243) 244 245android_application_test( 246 name = "RandomAccessFileOpenerAndroidTest", 247 timeout = "moderate", 248 srcs = [ 249 "RandomAccessFileOpenerAndroidTest.java", 250 ], 251 manifest = "//javatests/com/google/android/libraries/mobiledatadownload/file:AndroidManifest.xml", 252 shard_count = 1, 253 target_devices = [ 254 "//tools/android/emulated_devices/generic_phone:google_23_x86", 255 ], 256 deps = [ 257 "//java/com/google/android/libraries/mobiledatadownload/file", 258 "//java/com/google/android/libraries/mobiledatadownload/file/backends:file", 259 "//java/com/google/android/libraries/mobiledatadownload/file/common/testing", 260 "//java/com/google/android/libraries/mobiledatadownload/file/common/testing:extras", 261 "//java/com/google/android/libraries/mobiledatadownload/file/openers:random_access_file", 262 "@androidx_test", 263 "@com_google_guava_guava", 264 "@junit", 265 "@truth", 266 ], 267) 268 269android_local_test( 270 name = "ReadProtoOpenerTest", 271 srcs = [ 272 "ReadProtoOpenerTest.java", 273 ], 274 deps = [ 275 "//java/com/google/android/libraries/mobiledatadownload/file", 276 "//java/com/google/android/libraries/mobiledatadownload/file/backends:file", 277 "//java/com/google/android/libraries/mobiledatadownload/file/common/testing", 278 "//java/com/google/android/libraries/mobiledatadownload/file/common/testing:test_message_java_proto_lite", 279 "//java/com/google/android/libraries/mobiledatadownload/file/openers:proto", 280 "//java/com/google/android/libraries/mobiledatadownload/file/openers:string", 281 "//java/com/google/android/libraries/mobiledatadownload/file/transforms:compress", 282 "//java/com/google/android/libraries/mobiledatadownload/file/transforms:proto", 283 "@com_google_protobuf//:protobuf_lite", 284 "@truth", 285 ], 286) 287 288android_local_test( 289 name = "ReadStreamOpenerTest", 290 srcs = [ 291 "ReadStreamOpenerTest.java", 292 ], 293 deps = [ 294 "//java/com/google/android/libraries/mobiledatadownload/file", 295 "//java/com/google/android/libraries/mobiledatadownload/file/common/testing", 296 "//java/com/google/android/libraries/mobiledatadownload/file/openers:stream", 297 "//java/com/google/android/libraries/mobiledatadownload/file/spi", 298 "@mockito", 299 "@truth", 300 ], 301) 302 303android_local_test( 304 name = "RecursiveDeleteOpenerTest", 305 srcs = [ 306 "RecursiveDeleteOpenerTest.java", 307 ], 308 deps = [ 309 "//java/com/google/android/libraries/mobiledatadownload/file", 310 "//java/com/google/android/libraries/mobiledatadownload/file/backends:file", 311 "//java/com/google/android/libraries/mobiledatadownload/file/common/testing", 312 "//java/com/google/android/libraries/mobiledatadownload/file/common/testing:extras", 313 "//java/com/google/android/libraries/mobiledatadownload/file/openers:recursive_delete", 314 "//java/com/google/android/libraries/mobiledatadownload/file/openers:string", 315 "//java/com/google/android/libraries/mobiledatadownload/file/spi", 316 "@androidx_test", 317 "@mockito", 318 "@truth", 319 ], 320) 321 322android_application_test( 323 name = "RecursiveDeleteOpenerAndroidTest", 324 size = "large", 325 srcs = [ 326 "RecursiveDeleteOpenerAndroidTest.java", 327 ], 328 manifest = "RecursiveDeleteOpenerAndroidManifest.xml", 329 target_devices = [ 330 "//tools/android/emulated_devices/generic_phone:google_23_x86", 331 ], 332 deps = [ 333 "//java/com/google/android/libraries/mobiledatadownload/file", 334 "//java/com/google/android/libraries/mobiledatadownload/file/backends:android", 335 "//java/com/google/android/libraries/mobiledatadownload/file/backends:android_adapter", 336 "//java/com/google/android/libraries/mobiledatadownload/file/common/testing", 337 "//java/com/google/android/libraries/mobiledatadownload/file/openers:lock_file", 338 "//java/com/google/android/libraries/mobiledatadownload/file/openers:recursive_delete", 339 "//java/com/google/android/libraries/mobiledatadownload/file/openers:stream_mutation", 340 "//java/com/google/android/libraries/mobiledatadownload/file/openers:string", 341 "@androidx_test", 342 "@com_google_guava_guava", 343 "@junit", 344 "@truth", 345 ], 346) 347 348android_local_test( 349 name = "RecursiveSizeOpenerTest", 350 srcs = [ 351 "RecursiveSizeOpenerTest.java", 352 ], 353 deps = [ 354 "//java/com/google/android/libraries/mobiledatadownload/file", 355 "//java/com/google/android/libraries/mobiledatadownload/file/backends:file", 356 "//java/com/google/android/libraries/mobiledatadownload/file/common/testing", 357 "//java/com/google/android/libraries/mobiledatadownload/file/common/testing:extras", 358 "//java/com/google/android/libraries/mobiledatadownload/file/openers:recursive_size", 359 "//java/com/google/android/libraries/mobiledatadownload/file/transforms:compress", 360 "//java/com/google/android/libraries/mobiledatadownload/file/transforms:proto", 361 "@androidx_test", 362 "@truth", 363 ], 364) 365 366android_application_test( 367 name = "StreamMutationOpenerAndroidTest", 368 size = "large", 369 srcs = [ 370 "StreamMutationOpenerAndroidTest.java", 371 ], 372 manifest = "StreamMutationOpenerAndroidManifest.xml", 373 target_devices = [ 374 "//tools/android/emulated_devices/generic_phone:google_23_x86", 375 ], 376 deps = [ 377 "//java/com/google/android/libraries/mobiledatadownload/file", 378 "//java/com/google/android/libraries/mobiledatadownload/file/backends:file", 379 "//java/com/google/android/libraries/mobiledatadownload/file/common/testing", 380 "//java/com/google/android/libraries/mobiledatadownload/file/openers:lock_file", 381 "//java/com/google/android/libraries/mobiledatadownload/file/openers:stream_mutation", 382 "@androidx_test", 383 "@com_google_guava_guava", 384 "@junit", 385 "@truth", 386 ], 387) 388 389android_local_test( 390 name = "StreamMutationOpenerTest", 391 srcs = [ 392 "StreamMutationOpenerTest.java", 393 ], 394 manifest = "//javatests/com/google/android/libraries/mobiledatadownload/file:AndroidManifest.xml", 395 manifest_values = { 396 "targetSdkVersion": "19", # TODO(b/130907105): EncryptTransform should handle this internally 397 }, 398 deps = [ 399 "//java/com/google/android/libraries/mobiledatadownload/file", 400 "//java/com/google/android/libraries/mobiledatadownload/file/backends:file", 401 "//java/com/google/android/libraries/mobiledatadownload/file/behaviors:syncing", 402 "//java/com/google/android/libraries/mobiledatadownload/file/common/testing", 403 "//java/com/google/android/libraries/mobiledatadownload/file/common/testing:extras", 404 "//java/com/google/android/libraries/mobiledatadownload/file/openers:bytes", 405 "//java/com/google/android/libraries/mobiledatadownload/file/openers:lock_file", 406 "//java/com/google/android/libraries/mobiledatadownload/file/openers:stream_mutation", 407 "//java/com/google/android/libraries/mobiledatadownload/file/openers:string", 408 "//java/com/google/android/libraries/mobiledatadownload/file/transforms:compress", 409 "//java/com/google/android/libraries/mobiledatadownload/file/transforms:proto_fragments", 410 "//proto:transform_java_proto_lite", 411 "@com_google_guava_guava", 412 "@mockito", 413 "@truth", 414 ], 415) 416 417android_application_test( 418 name = "SystemLibraryOpenerAndroidTest", 419 size = "large", 420 srcs = [ 421 "HelloNative.java", 422 "SystemLibraryOpenerAndroidTest.java", 423 ], 424 data = [ 425 ":libhello1native.so", 426 ":libhello2native.so", 427 ], 428 manifest = "//javatests/com/google/android/libraries/mobiledatadownload/file:AndroidManifest.xml", 429 tags = ["notap"], # Only works with --config=android_x86 so disabling from TAP. 430 target_devices = [ 431 "//tools/android/emulated_devices/generic_phone:google_23_x86", 432 ], 433 deps = [ 434 "//java/com/google/android/libraries/mobiledatadownload/file", 435 "//java/com/google/android/libraries/mobiledatadownload/file/backends:file", 436 "//java/com/google/android/libraries/mobiledatadownload/file/common/testing", 437 "//java/com/google/android/libraries/mobiledatadownload/file/common/testing:extras", 438 "//java/com/google/android/libraries/mobiledatadownload/file/openers:stream", 439 "//java/com/google/android/libraries/mobiledatadownload/file/openers:system_library", 440 "//java/com/google/android/libraries/mobiledatadownload/file/transforms:compress", 441 "//java/com/google/android/libraries/mobiledatadownload/file/transforms:proto", 442 "@androidx_test", 443 "@com_google_android_testing//:util", 444 "@com_google_guava_guava", 445 "@junit", 446 "@truth", 447 ], 448) 449 450android_application_test( 451 name = "WriteFileOpenerAndroidTest", 452 size = "large", 453 srcs = [ 454 "WriteFileOpenerAndroidTest.java", 455 ], 456 manifest = "//javatests/com/google/android/libraries/mobiledatadownload/file:AndroidManifest.xml", 457 shard_count = 2, 458 target_devices = [ 459 "//tools/android/emulated_devices/generic_phone:google_23_x86", 460 ], 461 deps = [ 462 "//java/com/google/android/libraries/mobiledatadownload/file", 463 "//java/com/google/android/libraries/mobiledatadownload/file/backends:file", 464 "//java/com/google/android/libraries/mobiledatadownload/file/common", 465 "//java/com/google/android/libraries/mobiledatadownload/file/common/internal:forwarding_stream", 466 "//java/com/google/android/libraries/mobiledatadownload/file/common/testing", 467 "//java/com/google/android/libraries/mobiledatadownload/file/common/testing:extras", 468 "//java/com/google/android/libraries/mobiledatadownload/file/openers:file", 469 "//java/com/google/android/libraries/mobiledatadownload/file/openers:stream", 470 "//java/com/google/android/libraries/mobiledatadownload/file/spi", 471 "//java/com/google/android/libraries/mobiledatadownload/file/transforms:compress", 472 "//java/com/google/android/libraries/mobiledatadownload/file/transforms:proto", 473 "@androidx_test", 474 "@com_google_guava_guava", 475 "@junit", 476 "@truth", 477 ], 478) 479 480android_local_test( 481 name = "WriteProtoOpenerTest", 482 srcs = [ 483 "WriteProtoOpenerTest.java", 484 ], 485 deps = [ 486 "//java/com/google/android/libraries/mobiledatadownload/file", 487 "//java/com/google/android/libraries/mobiledatadownload/file/backends:file", 488 "//java/com/google/android/libraries/mobiledatadownload/file/behaviors:syncing", 489 "//java/com/google/android/libraries/mobiledatadownload/file/common/testing", 490 "//java/com/google/android/libraries/mobiledatadownload/file/common/testing:extras", 491 "//java/com/google/android/libraries/mobiledatadownload/file/common/testing:test_message_java_proto_lite", 492 "//java/com/google/android/libraries/mobiledatadownload/file/openers:proto", 493 "//java/com/google/android/libraries/mobiledatadownload/file/openers:stream", 494 "//java/com/google/android/libraries/mobiledatadownload/file/openers:string", 495 "//java/com/google/android/libraries/mobiledatadownload/file/transforms:compress", 496 "@androidx_test", 497 "@com_google_protobuf//:protobuf_lite", 498 "@mockito", 499 "@truth", 500 ], 501) 502 503android_local_test( 504 name = "PipesTest", 505 srcs = [ 506 "PipesTest.java", 507 ], 508 deps = [ 509 "//java/com/google/android/libraries/mobiledatadownload/file/common", 510 "//java/com/google/android/libraries/mobiledatadownload/file/openers:file", 511 ], 512) 513 514cc_binary( 515 name = "libhello1native.so", 516 testonly = 1, 517 linkshared = 1, 518 linkstatic = 1, 519 deps = [ 520 ":hello1native_lib", 521 ], 522) 523 524cc_library( 525 name = "hello1native_lib", 526 testonly = 1, 527 srcs = ["hello1native.cc"], 528 deps = [ 529 "@jdk_jni", 530 ], 531 alwayslink = 1, 532) 533 534cc_binary( 535 name = "libhello2native.so", 536 testonly = 1, 537 linkshared = 1, 538 linkstatic = 1, 539 deps = [ 540 ":hello2native_lib", 541 ], 542) 543 544cc_library( 545 name = "hello2native_lib", 546 testonly = 1, 547 srcs = ["hello2native.cc"], 548 deps = [ 549 "@jdk_jni", 550 ], 551 alwayslink = 1, 552) 553