[NC Apple coverage] Reorganize BLE medium and test files

PiperOrigin-RevId: 800719731
This commit is contained in:
Edwin Wu
2025-08-28 20:26:08 -07:00
committed by Copybara-Service
parent a4ce4b1781
commit eff9d2d50b
106 changed files with 425 additions and 328 deletions
+6 -5
View File
@@ -395,11 +395,12 @@ let package = Package(
"connections/swift/NearbyCoreAdapter/Tests",
"internal/platform/implementation/g3",
"internal/platform/implementation/android",
"internal/platform/implementation/apple/Tests",
"internal/platform/implementation/apple/Flags/Tests",
"internal/platform/implementation/apple/Log/Tests",
"internal/platform/implementation/apple/Mediums/Ble/Sockets/Tests",
"internal/platform/implementation/apple/Mediums/BLE/Tests",
"internal/platform/implementation/apple/Mediums/BLE/Sockets/Tests",
"internal/platform/implementation/apple/Mediums/WiFiCommon/Tests",
"internal/platform/implementation/apple/Tests",
"internal/platform/implementation/windows",
"third_party",
"CONTRIBUTING.md",
@@ -426,13 +427,13 @@ let package = Package(
"internal/weave/sockets/BUILD",
"internal/platform/flags/BUILD",
"internal/platform/implementation/shared/BUILD",
"internal/platform/implementation/apple/BUILD",
"internal/platform/implementation/apple/Flags/BUILD",
"internal/platform/implementation/apple/Log/BUILD",
"internal/platform/implementation/apple/Mediums/BUILD",
"internal/platform/implementation/apple/Mediums/Ble/Sockets/BUILD",
"internal/platform/implementation/apple/Mediums/BLE/BUILD",
"internal/platform/implementation/apple/Mediums/BLE/Sockets/BUILD",
"internal/platform/implementation/apple/Mediums/WiFiCommon/BUILD",
"internal/platform/implementation/apple/Tests/BUILD",
"internal/platform/implementation/apple/BUILD",
"internal/platform/implementation/BUILD",
"internal/platform/BUILD",
"internal/analytics/BUILD",
+12 -13
View File
@@ -117,30 +117,30 @@ objc_library(
objc_library(
name = "ble_v2",
srcs = [
"ble_gatt_client.h",
"ble_gatt_client.mm",
"ble_gatt_server.h",
"ble_gatt_server.mm",
"ble_l2cap_server_socket.h",
"ble_l2cap_server_socket.mm",
"ble_l2cap_socket.h",
"ble_l2cap_socket.mm",
"ble_medium.h",
"ble_medium.mm",
"ble_peripheral.h",
"ble_peripheral.mm",
"ble_server_socket.h",
"ble_server_socket.mm",
"ble_socket.h",
"ble_socket.mm",
"ble_utils.mm",
"bluetooth_adapter_v2.h",
"bluetooth_adapter_v2.mm",
"utils.mm",
],
hdrs = [
"ble.h",
"ble_gatt_client.h",
"ble_gatt_server.h",
"ble_l2cap_server_socket.h",
"ble_l2cap_socket.h",
"ble_medium.h",
"ble_peripheral.h",
"ble_server_socket.h",
"ble_socket.h",
"ble_utils.h",
"bluetooth_adapter_v2.h",
"utils.h",
],
# Prevent Objective-C++ headers from being pulled into swift.
@@ -152,12 +152,11 @@ objc_library(
"//internal/platform:mac_address",
"//internal/platform:uuid",
"//internal/platform/implementation:comm",
"//internal/platform/implementation:types",
"//internal/platform/implementation/apple/Flags",
"//internal/platform/implementation/apple/Log:GNCLogger",
"//internal/platform/implementation/apple/Mediums",
"//internal/platform/implementation/apple/Mediums/Ble/Sockets:Central",
"//internal/platform/implementation/apple/Mediums/Ble/Sockets:Peripheral",
"//internal/platform/implementation/apple/Mediums/BLE",
"//internal/platform/implementation/apple/Mediums/BLE/Sockets:Central",
"//internal/platform/implementation/apple/Mediums/BLE/Sockets:Peripheral",
"//third_party/apple_frameworks:CoreBluetooth",
"//third_party/apple_frameworks:Foundation",
"@com_google_absl//absl/container:flat_hash_map",
@@ -0,0 +1,76 @@
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
load("@rules_cc//cc:objc_library.bzl", "objc_library")
licenses(["notice"])
package(default_visibility = [
"//internal/platform/implementation/apple:__subpackages__",
])
objc_library(
name = "BLE",
srcs = [
"GNCBLEError.m",
"GNCBLEGATTCharacteristic.m",
"GNCBLEGATTClient.m",
"GNCBLEGATTServer.m",
"GNCBLEL2CAPClient.m",
"GNCBLEL2CAPConnection.m",
"GNCBLEL2CAPServer.m",
"GNCBLEL2CAPStream.m",
"GNCBLEMedium.m",
"GNCCentralManager.m",
"GNCLeaks.m",
"GNCMBleConnection.m",
"GNCMBleUtils.mm",
"GNCMConnection.m",
"GNCPeripheral.m",
"GNCPeripheralManager.m",
"NSData+GNCBase85.mm",
"NSData+GNCWebSafeBase64.m",
],
hdrs = [
"GNCBLEError.h",
"GNCBLEGATTCharacteristic.h",
"GNCBLEGATTClient.h",
"GNCBLEGATTServer.h",
"GNCBLEL2CAPClient.h",
"GNCBLEL2CAPConnection.h",
"GNCBLEL2CAPServer.h",
"GNCBLEL2CAPStream.h",
"GNCBLEMedium.h",
"GNCCentralManager.h",
"GNCLeaks.h",
"GNCMBleConnection.h",
"GNCMBleUtils.h",
"GNCMConnection.h",
"GNCPeripheral.h",
"GNCPeripheralManager.h",
"NSData+GNCBase85.h",
"NSData+GNCWebSafeBase64.h",
],
deps = [
"//internal/encoding:base85",
"//internal/platform/implementation/apple:Shared",
"//internal/platform/implementation/apple/Flags",
"//internal/platform/implementation/apple/Log:GNCLogger",
"//internal/platform/implementation/apple/Mediums/BLE/Sockets:Shared",
"//proto/mediums:ble_frames_cc_proto",
"//third_party/apple_frameworks:CoreBluetooth",
"//third_party/apple_frameworks:Foundation",
"//third_party/apple_frameworks:ObjectiveC",
],
)
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEError.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEError.h"
#import <Foundation/Foundation.h>
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEGATTCharacteristic.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEGATTCharacteristic.h"
#import <CoreBluetooth/CoreBluetooth.h>
#import <Foundation/Foundation.h>
@@ -12,15 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEGATTClient.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEGATTClient.h"
#import <CoreBluetooth/CoreBluetooth.h>
#import <Foundation/Foundation.h>
#import "internal/platform/implementation/apple/Log/GNCLogger.h"
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEError.h"
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEGATTCharacteristic.h"
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCPeripheral.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEError.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEGATTCharacteristic.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCPeripheral.h"
NS_ASSUME_NONNULL_BEGIN
@@ -12,18 +12,18 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEGATTServer.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEGATTServer.h"
#import <CoreBluetooth/CoreBluetooth.h>
#import <Foundation/Foundation.h>
#import "internal/platform/implementation/apple/Flags/GNCFeatureFlags.h"
#import "internal/platform/implementation/apple/Log/GNCLogger.h"
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEError.h"
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEGATTCharacteristic.h"
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCPeripheralManager.h"
#import "internal/platform/implementation/apple/Mediums/BLEv2/NSData+GNCBase85.h"
#import "internal/platform/implementation/apple/Mediums/BLEv2/NSData+GNCWebSafeBase64.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEError.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEGATTCharacteristic.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCPeripheralManager.h"
#import "internal/platform/implementation/apple/Mediums/BLE/NSData+GNCBase85.h"
#import "internal/platform/implementation/apple/Mediums/BLE/NSData+GNCWebSafeBase64.h"
NS_ASSUME_NONNULL_BEGIN
@@ -14,7 +14,7 @@
#import <Foundation/Foundation.h>
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEL2CAPStream.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEL2CAPStream.h"
@protocol GNCPeripheral;
@@ -12,15 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEL2CAPClient.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEL2CAPClient.h"
#import <CoreBluetooth/CoreBluetooth.h>
#import <Foundation/Foundation.h>
#import "internal/platform/implementation/apple/Log/GNCLogger.h"
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEError.h"
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEL2CAPStream.h"
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCPeripheral.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEError.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEL2CAPStream.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCPeripheral.h"
static char *const kGNCBLEL2CAPClientQueueLabel = "com.google.nearby.GNCBLEL2CAPClient";
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/GNCMConnection.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCMConnection.h"
NS_ASSUME_NONNULL_BEGIN
@@ -12,15 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEL2CAPConnection.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEL2CAPConnection.h"
#import <Foundation/Foundation.h>
#import "internal/platform/implementation/apple/Log/GNCLogger.h"
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEL2CAPStream.h"
#import "internal/platform/implementation/apple/Mediums/Ble/GNCMBleUtils.h"
#import "internal/platform/implementation/apple/Mediums/GNCLeaks.h"
#import "internal/platform/implementation/apple/Mediums/GNCMConnection.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEL2CAPStream.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCLeaks.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCMBleUtils.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCMConnection.h"
enum { kL2CAPPacketLength = 4 };
static const CGFloat kRequestDataConnectionDelayInSeconds = 0.0;
@@ -12,15 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEL2CAPServer.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEL2CAPServer.h"
#import <CoreBluetooth/CoreBluetooth.h>
#import <Foundation/Foundation.h>
#import "internal/platform/implementation/apple/Log/GNCLogger.h"
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEError.h"
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEL2CAPStream.h"
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCPeripheralManager.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEError.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEL2CAPStream.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCPeripheralManager.h"
NS_ASSUME_NONNULL_BEGIN
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEL2CAPStream.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEL2CAPStream.h"
#import "internal/platform/implementation/apple/Log/GNCLogger.h"
@@ -15,9 +15,9 @@
#import <CoreBluetooth/CoreBluetooth.h>
#import <Foundation/Foundation.h>
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEL2CAPClient.h"
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEL2CAPServer.h"
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCCentralManager.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEL2CAPClient.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEL2CAPServer.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCCentralManager.h"
@class GNCBLEGATTServer;
@class GNCBLEGATTClient;
@@ -12,22 +12,22 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEMedium.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEMedium.h"
#import <CoreBluetooth/CoreBluetooth.h>
#import <Foundation/Foundation.h>
#import "internal/platform/implementation/apple/Flags/GNCFeatureFlags.h"
#import "internal/platform/implementation/apple/Log/GNCLogger.h"
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEError.h"
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEGATTClient.h"
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEGATTServer.h"
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEL2CAPClient.h"
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEL2CAPServer.h"
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCCentralManager.h"
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCPeripheral.h"
#import "internal/platform/implementation/apple/Mediums/BLEv2/NSData+GNCBase85.h"
#import "internal/platform/implementation/apple/Mediums/BLEv2/NSData+GNCWebSafeBase64.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEError.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEGATTClient.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEGATTServer.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEL2CAPClient.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEL2CAPServer.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCCentralManager.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCPeripheral.h"
#import "internal/platform/implementation/apple/Mediums/BLE/NSData+GNCBase85.h"
#import "internal/platform/implementation/apple/Mediums/BLE/NSData+GNCWebSafeBase64.h"
NS_ASSUME_NONNULL_BEGIN
@@ -443,6 +443,9 @@ static GNCBLEL2CAPServer *_Nonnull CreateL2CapServer(
#pragma mark - GNCCentralManagerDelegate
- (void)gnc_centralManagerDidUpdateState:(id<GNCCentralManager>)central {
if (!_queue) {
return;
}
dispatch_assert_queue(_queue);
[self internalStartScanningIfPoweredOn];
}
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCCentralManager.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCCentralManager.h"
#import <CoreBluetooth/CoreBluetooth.h>
#import <Foundation/Foundation.h>
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/GNCLeaks.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCLeaks.h"
#import "internal/platform/implementation/apple/Log/GNCLogger.h"
void GNCVerifyDealloc(id object, NSTimeInterval timeInterval) {
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/GNCMConnection.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCMConnection.h"
NS_ASSUME_NONNULL_BEGIN
@@ -12,13 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/Ble/GNCMBleConnection.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCMBleConnection.h"
#import "internal/platform/implementation/apple/Log/GNCLogger.h"
#import "internal/platform/implementation/apple/Mediums/Ble/GNCMBleUtils.h"
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Shared/GNSSocket.h"
#import "internal/platform/implementation/apple/Mediums/GNCLeaks.h"
#import "internal/platform/implementation/apple/Mediums/GNCMConnection.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCLeaks.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCMBleUtils.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCMConnection.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Shared/GNSSocket.h"
NS_ASSUME_NONNULL_BEGIN
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/Ble/GNCMBleUtils.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCMBleUtils.h"
#include <sstream>
#include <string>
@@ -20,7 +20,7 @@
#import "internal/platform/implementation/apple/GNCUtils.h"
#import "internal/platform/implementation/apple/Log/GNCLogger.h"
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Shared/GNSSocket.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Shared/GNSSocket.h"
#include "proto/mediums/ble_frames.pb.h"
NS_ASSUME_NONNULL_BEGIN
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/GNCMConnection.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCMConnection.h"
NS_ASSUME_NONNULL_BEGIN
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCPeripheral.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCPeripheral.h"
#import <CoreBluetooth/CoreBluetooth.h>
#import <Foundation/Foundation.h>
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCPeripheralManager.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCPeripheralManager.h"
#import <objc/NSObject.h>
#import <CoreBluetooth/CoreBluetooth.h>
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/BLEv2/NSData+GNCBase85.h"
#import "internal/platform/implementation/apple/Mediums/BLE/NSData+GNCBase85.h"
#import <Foundation/Foundation.h>
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/BLEv2/NSData+GNCWebSafeBase64.h"
#import "internal/platform/implementation/apple/Mediums/BLE/NSData+GNCWebSafeBase64.h"
#import <Foundation/Foundation.h>
@@ -12,14 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("@rules_apple//apple:ios.bzl", "ios_unit_test")
load("@rules_cc//cc:objc_library.bzl", "objc_library")
load("//third_party/nearby:minimum_os.bzl", "IOS_MINIMUM_OS")
load("//tools/build_defs/swift:swift_explicit_module_build_test.bzl", "swift_explicit_module_build_test")
licenses(["notice"])
package(default_visibility = ["//visibility:public"])
package(default_visibility = ["//internal/platform/implementation/apple:__subpackages__"])
objc_library(
name = "Central",
@@ -82,57 +81,12 @@ objc_library(
],
deps = [
"//internal/platform/implementation/apple/Log:GNCLogger",
"//third_party/apple_frameworks:CommonCrypto",
"//third_party/apple_frameworks:CoreBluetooth",
"//third_party/apple_frameworks:CoreFoundation",
"//third_party/apple_frameworks:Foundation",
"//third_party/apple_frameworks:QuartzCore",
],
)
objc_library(
name = "CentralTestsLib",
testonly = 1,
srcs = [
"Tests/Central/GNSCentralManagerTest.m",
],
deps = [
":Central",
":Shared",
"//internal/platform/implementation/apple/Log:GNCLogger",
"//third_party/objective_c/ocmock/v3:OCMock",
],
)
ios_unit_test(
name = "CentralTests",
google_create_srl_bindings_module = False,
minimum_os_version = IOS_MINIMUM_OS,
runner = "//testing/utp/ios:IOS_LATEST",
deps = [":CentralTestsLib"],
)
objc_library(
name = "SharedTestsLib",
testonly = 1,
srcs = [
"Tests/Shared/GNSSocketTest.m",
"Tests/Shared/GNSWeavePacketTest.m",
],
deps = [
":Shared",
"//internal/platform/implementation/apple/Log:GNCLogger",
"//third_party/objective_c/ocmock/v3:OCMock",
],
)
ios_unit_test(
name = "SharedTests",
google_create_srl_bindings_module = False,
minimum_os_version = IOS_MINIMUM_OS,
runner = "//testing/utp/ios:IOS_LATEST",
deps = [":SharedTestsLib"],
)
swift_explicit_module_build_test(
name = "swift_explicit_module_build_test",
ignore_headerless_targets = True,
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Central/GNSCentralManager.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Central/GNSCentralManager.h"
#import <CoreBluetooth/CoreBluetooth.h>
@@ -12,12 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Central/GNSCentralManager.h"
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Central/GNSCentralManager+Private.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Central/GNSCentralManager.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Central/GNSCentralManager+Private.h"
#import "internal/platform/implementation/apple/Log/GNCLogger.h"
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Central/GNSCentralPeerManager+Private.h"
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Central/GNSCentralPeerManager.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Central/GNSCentralPeerManager+Private.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Central/GNSCentralPeerManager.h"
NS_ASSUME_NONNULL_BEGIN
@@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Central/GNSCentralPeerManager.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Central/GNSCentralPeerManager.h"
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Shared/GNSSocket+Private.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Shared/GNSSocket+Private.h"
NS_ASSUME_NONNULL_BEGIN
@@ -12,17 +12,17 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Central/GNSCentralPeerManager.h"
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Central/GNSCentralPeerManager+Private.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Central/GNSCentralPeerManager.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Central/GNSCentralPeerManager+Private.h"
#import "internal/platform/implementation/apple/Log/GNCLogger.h"
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Central/GNSCentralManager+Private.h"
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Central/GNSCentralManager.h"
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Shared/GNSSocket+Private.h"
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Shared/GNSSocket.h"
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Shared/GNSUtils+Private.h"
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Shared/GNSUtils.h"
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Shared/GNSWeavePacket.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Central/GNSCentralManager+Private.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Central/GNSCentralManager.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Shared/GNSSocket+Private.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Shared/GNSSocket.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Shared/GNSUtils+Private.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Shared/GNSUtils.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Shared/GNSWeavePacket.h"
static const NSTimeInterval kMaxConnectionConfirmWaitTimeInSeconds = 2;
static const NSTimeInterval kPeripheralFailedToConnectTimeout = 10.0;
@@ -12,6 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Central/GNSCentralManager.h"
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Central/GNSCentralPeerManager.h"
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/GNSShared.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Central/GNSCentralManager.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Central/GNSCentralPeerManager.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/GNSShared.h"
@@ -12,6 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/GNSShared.h"
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Peripheral/GNSPeripheralManager.h"
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Peripheral/GNSPeripheralServiceManager.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/GNSShared.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Peripheral/GNSPeripheralManager.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Peripheral/GNSPeripheralServiceManager.h"
@@ -12,5 +12,5 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Shared/GNSSocket.h"
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Shared/GNSUtils.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Shared/GNSSocket.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Shared/GNSUtils.h"
@@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Peripheral/GNSPeripheralManager.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Peripheral/GNSPeripheralManager.h"
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Shared/GNSSocket+Private.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Shared/GNSSocket+Private.h"
@class GNSSocket;
@@ -15,7 +15,7 @@
#import <CoreBluetooth/CoreBluetooth.h>
#import <Foundation/Foundation.h>
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Shared/GNSUtils.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Shared/GNSUtils.h"
@class GNSPeripheralServiceManager;
@@ -12,11 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Peripheral/GNSPeripheralManager+Private.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Peripheral/GNSPeripheralManager+Private.h"
#import "internal/platform/implementation/apple/Log/GNCLogger.h"
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Peripheral/GNSPeripheralServiceManager+Private.h"
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Shared/GNSSocket+Private.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Peripheral/GNSPeripheralServiceManager+Private.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Shared/GNSSocket+Private.h"
#if TARGET_OS_IPHONE
#import <UIKit/UIKit.h>
@@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Peripheral/GNSPeripheralServiceManager.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Peripheral/GNSPeripheralServiceManager.h"
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Shared/GNSSocket+Private.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Shared/GNSSocket+Private.h"
typedef NS_ENUM(NSInteger, GNSBluetoothServiceState) {
GNSBluetoothServiceStateNotAdded,
@@ -12,13 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Peripheral/GNSPeripheralServiceManager+Private.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Peripheral/GNSPeripheralServiceManager+Private.h"
#import "internal/platform/implementation/apple/Log/GNCLogger.h"
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Peripheral/GNSPeripheralManager+Private.h"
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Shared/GNSSocket+Private.h"
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Shared/GNSUtils.h"
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Shared/GNSWeavePacket.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Peripheral/GNSPeripheralManager+Private.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Shared/GNSSocket+Private.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Shared/GNSUtils.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Shared/GNSWeavePacket.h"
// The Weave BLE protocol has only one valid version.
static const UInt16 kWeaveVersionSupported = 1;
@@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Shared/GNSSocket.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Shared/GNSSocket.h"
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Shared/GNSUtils+Private.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Shared/GNSUtils+Private.h"
@class GNSWeaveDataPacket;
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Shared/GNSUtils.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Shared/GNSUtils.h"
@class CBCentral;
@class GNSPeripheralServiceManager;
@@ -12,10 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Shared/GNSSocket+Private.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Shared/GNSSocket+Private.h"
#import "internal/platform/implementation/apple/Log/GNCLogger.h"
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Shared/GNSWeavePacket.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Shared/GNSWeavePacket.h"
typedef void (^GNSIncomingChunkReceivedBlock)(NSData *incomingData);
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Shared/GNSUtils.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Shared/GNSUtils.h"
NS_ASSUME_NONNULL_BEGIN
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Shared/GNSUtils+Private.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Shared/GNSUtils+Private.h"
#import <CommonCrypto/CommonDigest.h>
@@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Shared/GNSWeavePacket.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Shared/GNSWeavePacket.h"
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Shared/GNSUtils+Private.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Shared/GNSUtils+Private.h"
// Constants defined by the Weave BLE protocol.
const UInt8 kGNSMaxPacketCounterValue = 8;
@@ -0,0 +1,64 @@
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
load("@rules_apple//apple:ios.bzl", "ios_unit_test")
load("@rules_cc//cc:objc_library.bzl", "objc_library")
load("//third_party/nearby:minimum_os.bzl", "IOS_MINIMUM_OS")
licenses(["notice"])
package(default_visibility = ["//internal/platform/implementation/apple:__subpackages__"])
objc_library(
name = "CentralTestsLib",
testonly = 1,
srcs = [
"Central/GNSCentralManagerTest.m",
],
deps = [
"//internal/platform/implementation/apple/Mediums/BLE/Sockets:Central",
"//third_party/apple_frameworks:XCTest",
"//third_party/objective_c/ocmock/v3:OCMock",
],
)
ios_unit_test(
name = "CentralTests",
google_create_srl_bindings_module = False,
minimum_os_version = IOS_MINIMUM_OS,
runner = "//testing/utp/ios:IOS_LATEST",
deps = [":CentralTestsLib"],
)
objc_library(
name = "SharedTestsLib",
testonly = 1,
srcs = [
"Shared/GNSSocketTest.m",
"Shared/GNSWeavePacketTest.m",
],
deps = [
"//internal/platform/implementation/apple/Mediums/BLE/Sockets:Shared",
"//third_party/apple_frameworks:XCTest",
"//third_party/objective_c/ocmock/v3:OCMock",
],
)
ios_unit_test(
name = "SharedTests",
google_create_srl_bindings_module = False,
minimum_os_version = IOS_MINIMUM_OS,
runner = "//testing/utp/ios:IOS_LATEST",
deps = [":SharedTestsLib"],
)
@@ -14,8 +14,8 @@
#import <XCTest/XCTest.h>
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Central/GNSCentralManager+Private.h"
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Central/GNSCentralPeerManager+Private.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Central/GNSCentralManager+Private.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Central/GNSCentralPeerManager+Private.h"
#import "third_party/objective_c/ocmock/v3/Source/OCMock/OCMock.h"
@interface TestGNSCentralManager : GNSCentralManager
@@ -14,9 +14,9 @@
#import <XCTest/XCTest.h>
#import "internal/platform/implementation/apple/Mediums/ble/Sockets/Source/Central/GNSCentralManager+Private.h"
#import "internal/platform/implementation/apple/Mediums/ble/Sockets/Source/Central/GNSCentralPeerManager+Private.h"
#import "internal/platform/implementation/apple/Mediums/ble/Sockets/Source/Shared/GNSWeavePacket.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Central/GNSCentralManager+Private.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Central/GNSCentralPeerManager+Private.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Shared/GNSWeavePacket.h"
#import "third_party/objective_c/ocmock/v3/Source/OCMock/OCMock.h"
static SEL gTimerSelector = nil;
@@ -14,9 +14,9 @@
#import <XCTest/XCTest.h>
#import "internal/platform/implementation/apple/Mediums/ble/Sockets/Source/Peripheral/GNSPeripheralManager+Private.h"
#import "internal/platform/implementation/apple/Mediums/ble/Sockets/Source/Peripheral/GNSPeripheralServiceManager+Private.h"
#import "internal/platform/implementation/apple/Mediums/ble/Sockets/Source/Shared/GNSSocket+Private.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Peripheral/GNSPeripheralManager+Private.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Peripheral/GNSPeripheralServiceManager+Private.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Shared/GNSSocket+Private.h"
#import "third_party/objective_c/ocmock/v3/Source/OCMock/OCMock.h"
@interface TestGNSPeripheralManager : GNSPeripheralManager
@@ -15,11 +15,11 @@
#import <XCTest/XCTest.h>
#import "internal/platform/implementation/apple/Log/GNCLogger.h"
#import "internal/platform/implementation/apple/Mediums/ble/Sockets/Source/Peripheral/GNSPeripheralManager+Private.h"
#import "internal/platform/implementation/apple/Mediums/ble/Sockets/Source/Peripheral/GNSPeripheralServiceManager+Private.h"
#import "internal/platform/implementation/apple/Mediums/ble/Sockets/Source/Shared/GNSSocket+Private.h"
#import "internal/platform/implementation/apple/Mediums/ble/Sockets/Source/Shared/GNSUtils.h"
#import "internal/platform/implementation/apple/Mediums/ble/Sockets/Source/Shared/GNSWeavePacket.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Peripheral/GNSPeripheralManager+Private.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Peripheral/GNSPeripheralServiceManager+Private.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Shared/GNSSocket+Private.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Shared/GNSUtils.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Shared/GNSWeavePacket.h"
#import "third_party/objective_c/ocmock/v3/Source/OCMock/OCMock.h"
@interface GNSPeripheralServiceManagerTest : XCTestCase {
@@ -14,9 +14,9 @@
#import <XCTest/XCTest.h>
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Shared/GNSSocket+Private.h"
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Shared/GNSSocket.h"
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Shared/GNSWeavePacket.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Shared/GNSSocket+Private.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Shared/GNSSocket.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Shared/GNSWeavePacket.h"
#import "third_party/objective_c/ocmock/v3/Source/OCMock/OCMock.h"
@protocol GNSSocketTestDelegate <GNSSocketDelegate, GNSWeavePacketHandler>
@@ -14,9 +14,9 @@
#import <XCTest/XCTest.h>
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Shared/GNSWeavePacket.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Shared/GNSWeavePacket.h"
#import "internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Shared/GNSUtils.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Sockets/Source/Shared/GNSUtils.h"
@interface GNSWeavePacketTest : XCTestCase {
NSData *_largeNonEmptyData;
@@ -0,0 +1,71 @@
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
load("@rules_apple//apple:ios.bzl", "ios_unit_test")
load("@rules_cc//cc:objc_library.bzl", "objc_library")
load("//third_party/nearby:minimum_os.bzl", "IOS_MINIMUM_OS")
licenses(["notice"])
package(default_visibility = ["//internal/platform/implementation/apple:__subpackages__"])
objc_library(
name = "BLETestsLib",
testonly = 1,
srcs = [
"GNCBLEGATTCharacteristicTest.mm",
"GNCBLEGATTClientTest.m",
"GNCBLEGATTServerTest.m",
"GNCBLEL2CAPClientTest.m",
"GNCBLEL2CAPConnectionTest.m",
"GNCBLEL2CAPFakeInputOutputStream.m",
"GNCBLEL2CAPServerTest.m",
"GNCBLEL2CAPStreamTest.m",
"GNCBLEMediumTest.m",
"GNCBLEUtilsTest.mm",
"GNCFakeCentralManager.m",
"GNCFakePeripheral.m",
"GNCFakePeripheralManager.m",
"NSData+GNCBase85Test.m",
"NSData+GNCWebSafeBase64Test.m",
],
hdrs = [
"GNCBLEGATTClient+Testing.h",
"GNCBLEGATTServer+Testing.h",
"GNCBLEL2CAPClient+Testing.h",
"GNCBLEL2CAPFakeInputOutputStream.h",
"GNCBLEMedium+Testing.h",
"GNCFakeCentralManager.h",
"GNCFakePeripheral.h",
"GNCFakePeripheralManager.h",
],
deps = [
"//internal/platform/implementation:comm",
"//internal/platform/implementation:types",
"//internal/platform/implementation/apple", # buildcleaner: keep
"//internal/platform/implementation/apple:ble_v2",
"//internal/platform/implementation/apple/Mediums/BLE",
"//third_party/apple_frameworks:CoreBluetooth",
"//third_party/apple_frameworks:Foundation",
"//third_party/apple_frameworks:XCTest",
],
)
ios_unit_test(
name = "BLETests",
google_create_srl_bindings_module = False,
minimum_os_version = IOS_MINIMUM_OS,
runner = "//testing/utp/ios:IOS_LATEST",
deps = [":BLETestsLib"],
)
@@ -16,7 +16,7 @@
#import "XCTest/XCTest.h"
#import <XCTest/XCTest.h>
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEGATTCharacteristic.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEGATTCharacteristic.h"
@interface GNCBLEGATTCharacteristicTest : XCTestCase
@end
@@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEGATTClient.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEGATTClient.h"
#import <Foundation/Foundation.h>
@@ -12,16 +12,16 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEGATTClient.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEGATTClient.h"
#import <CoreBluetooth/CoreBluetooth.h>
#import <Foundation/Foundation.h>
#import <XCTest/XCTest.h>
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEGATTCharacteristic.h"
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCPeripheral.h"
#import "internal/platform/implementation/apple/Tests/GNCBLEGATTClient+Testing.h"
#import "internal/platform/implementation/apple/Tests/GNCFakePeripheral.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEGATTCharacteristic.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCPeripheral.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Tests/GNCBLEGATTClient+Testing.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Tests/GNCFakePeripheral.h"
static NSString *const kServiceUUID1 = @"0000FEF3-0000-1000-8000-00805F9B34FB";
static NSString *const kServiceUUID2 = @"0000FEF4-0000-1000-8000-00805F9B34FB";
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEGATTServer.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEGATTServer.h"
#import <Foundation/Foundation.h>
@@ -12,15 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEGATTServer.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEGATTServer.h"
#import <CoreBluetooth/CoreBluetooth.h>
#import <Foundation/Foundation.h>
#import <XCTest/XCTest.h>
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEGATTCharacteristic.h"
#import "internal/platform/implementation/apple/Tests/GNCBLEGATTServer+Testing.h"
#import "internal/platform/implementation/apple/Tests/GNCFakePeripheralManager.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEGATTCharacteristic.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Tests/GNCBLEGATTServer+Testing.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Tests/GNCFakePeripheralManager.h"
static NSString *const kServiceUUID1 = @"0000FEF3-0000-1000-8000-00805F9B34FB";
static NSString *const kServiceUUID2 = @"0000FEF4-0000-1000-8000-00805F9B34FB";
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEL2CAPClient.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEL2CAPClient.h"
#import <Foundation/Foundation.h>
@@ -12,15 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEL2CAPClient.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEL2CAPClient.h"
#import <CoreBluetooth/CoreBluetooth.h>
#import <Foundation/Foundation.h>
#import <XCTest/XCTest.h>
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCPeripheral.h"
#import "internal/platform/implementation/apple/Tests/GNCBLEL2CAPClient+Testing.h"
#import "internal/platform/implementation/apple/Tests/GNCFakePeripheral.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCPeripheral.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Tests/GNCBLEL2CAPClient+Testing.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Tests/GNCFakePeripheral.h"
@interface GNCBLEL2CAPClientTest : XCTestCase
@property(nonatomic) GNCFakePeripheral *fakePeripheral;
@@ -12,13 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEL2CAPConnection.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEL2CAPConnection.h"
#import <Foundation/Foundation.h>
#import <XCTest/XCTest.h>
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEL2CAPStream.h"
#import "internal/platform/implementation/apple/Tests/GNCBLEL2CAPFakeInputOutputStream.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEL2CAPStream.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Tests/GNCBLEL2CAPFakeInputOutputStream.h"
// TODO: b/399815436 - More tests for GNCBLEL2CAPConnection.
@interface GNCBLEL2CAPConnection (Testing)
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Tests/GNCBLEL2CAPFakeInputOutputStream.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Tests/GNCBLEL2CAPFakeInputOutputStream.h"
@implementation GNCBLEL2CAPFakeInputOutputStream {
/// Output stream for |_inputStream| to "simulate" data from watch during tests.
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEL2CAPServer.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEL2CAPServer.h"
#import <Foundation/Foundation.h>
@@ -12,13 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEL2CAPServer.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEL2CAPServer.h"
#import <CoreBluetooth/CoreBluetooth.h>
#import <Foundation/Foundation.h>
#import <XCTest/XCTest.h>
#import "internal/platform/implementation/apple/Tests/GNCFakePeripheralManager.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Tests/GNCFakePeripheralManager.h"
@interface GNCBLEL2CAPServerTest : XCTestCase
@end
@@ -12,11 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEL2CAPStream.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEL2CAPStream.h"
#import <XCTest/XCTest.h>
#import "internal/platform/implementation/apple/Tests/GNCBLEL2CAPFakeInputOutputStream.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Tests/GNCBLEL2CAPFakeInputOutputStream.h"
@interface GNCBLEL2CAPStreamTest : XCTestCase
@end
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEMedium.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEMedium.h"
#import <Foundation/Foundation.h>
@@ -12,20 +12,20 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEMedium.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEMedium.h"
#import <CoreBluetooth/CoreBluetooth.h>
#import <Foundation/Foundation.h>
#import <XCTest/XCTest.h>
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEGATTClient.h"
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEGATTServer.h"
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCPeripheral.h"
#import "internal/platform/implementation/apple/Tests/GNCBLEL2CAPClient+Testing.h"
#import "internal/platform/implementation/apple/Tests/GNCBLEMedium+Testing.h"
#import "internal/platform/implementation/apple/Tests/GNCFakeCentralManager.h"
#import "internal/platform/implementation/apple/Tests/GNCFakePeripheral.h"
#import "internal/platform/implementation/apple/Tests/GNCFakePeripheralManager.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEGATTClient.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEGATTServer.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCPeripheral.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Tests/GNCBLEL2CAPClient+Testing.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Tests/GNCBLEMedium+Testing.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Tests/GNCFakeCentralManager.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Tests/GNCFakePeripheral.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Tests/GNCFakePeripheralManager.h"
static NSString *const kServiceUUID = @"0000FEF3-0000-1000-8000-00805F9B34FB";
@@ -16,7 +16,7 @@
#import <Foundation/Foundation.h>
#import <XCTest/XCTest.h>
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEGATTCharacteristic.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEGATTCharacteristic.h"
#import "internal/platform/implementation/apple/ble_utils.h"
#include "internal/platform/implementation/ble_v2.h"
@@ -15,7 +15,7 @@
#import <CoreBluetooth/CoreBluetooth.h>
#import <Foundation/Foundation.h>
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCCentralManager.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCCentralManager.h"
NS_ASSUME_NONNULL_BEGIN
@@ -12,14 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Tests/GNCFakeCentralManager.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Tests/GNCFakeCentralManager.h"
#import <CoreBluetooth/CoreBluetooth.h>
#import <Foundation/Foundation.h>
#import <XCTest/XCTest.h>
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCCentralManager.h"
#import "internal/platform/implementation/apple/Tests/GNCFakePeripheral.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCCentralManager.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Tests/GNCFakePeripheral.h"
@implementation GNCFakeCentralManager {
CBManagerState _state;
@@ -15,7 +15,7 @@
#import <CoreBluetooth/CoreBluetooth.h>
#import <Foundation/Foundation.h>
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCPeripheral.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCPeripheral.h"
NS_ASSUME_NONNULL_BEGIN
@@ -12,13 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Tests/GNCFakePeripheral.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Tests/GNCFakePeripheral.h"
#import <CoreBluetooth/CoreBluetooth.h>
#import <Foundation/Foundation.h>
#import <XCTest/XCTest.h>
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCPeripheral.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCPeripheral.h"
NS_ASSUME_NONNULL_BEGIN
@@ -15,7 +15,7 @@
#import <CoreBluetooth/CoreBluetooth.h>
#import <Foundation/Foundation.h>
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCPeripheralManager.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCPeripheralManager.h"
@class XCTestExpectation;
@@ -12,13 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Tests/GNCFakePeripheralManager.h"
#import "internal/platform/implementation/apple/Mediums/BLE/Tests/GNCFakePeripheralManager.h"
#import <CoreBluetooth/CoreBluetooth.h>
#import <Foundation/Foundation.h>
#import <XCTest/XCTest.h>
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCPeripheralManager.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCPeripheralManager.h"
@interface CBCharacteristic ()
@@ -17,7 +17,7 @@
#include <string>
#include <vector>
#import "internal/platform/implementation/apple/Mediums/Ble/GNCMBleUtils.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCMBleUtils.h"
NS_ASSUME_NONNULL_BEGIN
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/BLEv2/NSData+GNCBase85.h"
#import "internal/platform/implementation/apple/Mediums/BLE/NSData+GNCBase85.h"
#import <Foundation/Foundation.h>
#import <XCTest/XCTest.h>
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#import "internal/platform/implementation/apple/Mediums/BLEv2/NSData+GNCWebSafeBase64.h"
#import "internal/platform/implementation/apple/Mediums/BLE/NSData+GNCWebSafeBase64.h"
#import <Foundation/Foundation.h>
#import <XCTest/XCTest.h>
@@ -24,64 +24,20 @@ package(default_visibility = [
objc_library(
name = "Mediums",
srcs = [
"BLEv2/GNCBLEError.m",
"BLEv2/GNCBLEGATTCharacteristic.m",
"BLEv2/GNCBLEGATTClient.m",
"BLEv2/GNCBLEGATTServer.m",
"BLEv2/GNCBLEL2CAPClient.m",
"BLEv2/GNCBLEL2CAPConnection.m",
"BLEv2/GNCBLEL2CAPServer.m",
"BLEv2/GNCBLEL2CAPStream.m",
"BLEv2/GNCBLEMedium.m",
"BLEv2/GNCCentralManager.m",
"BLEv2/GNCPeripheral.m",
"BLEv2/GNCPeripheralManager.m",
"BLEv2/NSData+GNCBase85.mm",
"BLEv2/NSData+GNCWebSafeBase64.m",
"Ble/GNCMBleConnection.m",
"Ble/GNCMBleUtils.mm",
"GNCLeaks.h",
"GNCLeaks.m",
"GNCMConnection.m",
"Hotspot/GNCHotspotMedium.m",
"Hotspot/GNCHotspotSocket.m",
],
hdrs = [
"BLEv2/GNCBLEError.h",
"BLEv2/GNCBLEGATTCharacteristic.h",
"BLEv2/GNCBLEGATTClient.h",
"BLEv2/GNCBLEGATTServer.h",
"BLEv2/GNCBLEL2CAPClient.h",
"BLEv2/GNCBLEL2CAPConnection.h",
"BLEv2/GNCBLEL2CAPServer.h",
"BLEv2/GNCBLEL2CAPStream.h",
"BLEv2/GNCBLEMedium.h",
"BLEv2/GNCCentralManager.h",
"BLEv2/GNCPeripheral.h",
"BLEv2/GNCPeripheralManager.h",
"BLEv2/NSData+GNCBase85.h",
"BLEv2/NSData+GNCWebSafeBase64.h",
"Ble/GNCMBleConnection.h",
"Ble/GNCMBleUtils.h",
"GNCMConnection.h",
"Hotspot/GNCHotspotMedium.h",
"Hotspot/GNCHotspotSocket.h",
],
deps = [
"//internal/encoding:base85",
"//internal/platform/implementation/apple:Shared",
"//internal/platform/implementation/apple/Flags",
"//internal/platform/implementation/apple/Log:GNCLogger",
"//internal/platform/implementation/apple/Mediums/Ble/Sockets:Shared",
"//internal/platform/implementation/apple/Mediums/WiFiCommon",
"//proto/mediums:ble_frames_cc_proto",
"//third_party/apple_frameworks:CoreBluetooth",
"//third_party/apple_frameworks:CoreLocation",
"//third_party/apple_frameworks:Foundation",
"//third_party/apple_frameworks:Network",
"//third_party/apple_frameworks:NetworkExtension",
"//third_party/apple_frameworks:ObjectiveC",
"//third_party/apple_frameworks:Security",
"//third_party/apple_frameworks:SystemConfiguration",
],
)
@@ -24,50 +24,23 @@ objc_library(
name = "PlatformTestslib",
testonly = True,
srcs = [
"GNCBLEGATTCharacteristicTest.mm",
"GNCBLEGATTClient+Testing.h",
"GNCBLEGATTClientTest.m",
"GNCBLEGATTServer+Testing.h",
"GNCBLEGATTServerTest.m",
"GNCBLEL2CAPClient+Testing.h",
"GNCBLEL2CAPClientTest.m",
"GNCBLEL2CAPConnectionTest.m",
"GNCBLEL2CAPFakeInputOutputStream.h",
"GNCBLEL2CAPFakeInputOutputStream.m",
"GNCBLEL2CAPServerTest.m",
"GNCBLEL2CAPStreamTest.m",
"GNCBLEMedium+Testing.h",
"GNCBLEMediumTest.m",
"GNCBLEUtilsTest.mm",
"GNCCryptoTest.mm",
"GNCDeviceInfoTest.mm",
"GNCFakeCentralManager.h",
"GNCFakeCentralManager.m",
"GNCFakePeripheral.h",
"GNCFakePeripheral.m",
"GNCFakePeripheralManager.h",
"GNCFakePeripheralManager.m",
"GNCMultiThreadExecutorTest.mm",
"GNCPlatformTest.mm",
"GNCScheduledExecutorTest.mm",
"GNCSingleThreadExecutorTest.mm",
"GNCUtilsTest.m",
"NSData+GNCBase85Test.m",
"NSData+GNCWebSafeBase64Test.m",
"UtilsTest.mm",
],
deps = [
"//internal/platform:base",
"//internal/platform/implementation:comm",
"//internal/platform/implementation:platform",
"//internal/platform/implementation:types",
"//internal/platform/implementation/apple", # buildcleaner: keep
"//internal/platform/implementation/apple:Shared",
"//internal/platform/implementation/apple:ble_v2",
"//internal/platform/implementation/apple:comm",
"//internal/platform/implementation/apple/Mediums",
"//third_party/apple_frameworks:CommonCrypto",
"//third_party/apple_frameworks:CoreBluetooth",
"//third_party/apple_frameworks:Foundation",
"//third_party/apple_frameworks:XCTest",
"@com_google_absl//absl/time",
@@ -25,7 +25,7 @@
#import "internal/platform/implementation/apple/Flags/GNCFeatureFlags.h"
#import "internal/platform/implementation/apple/Log/GNCLogger.h"
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEGATTClient.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEGATTClient.h"
#import "internal/platform/implementation/apple/ble_utils.h"
namespace nearby {
@@ -20,7 +20,7 @@
#include "internal/platform/implementation/ble_v2.h"
#import "internal/platform/implementation/apple/Log/GNCLogger.h"
#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEGATTServer.h"
#import "internal/platform/implementation/apple/Mediums/BLE/GNCBLEGATTServer.h"
#import "internal/platform/implementation/apple/ble_utils.h"
#import "internal/platform/implementation/apple/utils.h"

Some files were not shown because too many files have changed in this diff Show More