
Skill
mockdevice-testing
test wearable apps with mock devices
Description
MockDeviceKit for testing without physical glasses hardware
SKILL.md
MockDevice Testing (iOS)
Use MockDeviceKit to test DAT SDK integrations without physical Meta glasses.
MockDeviceKit simulates Meta glasses behavior for development and testing. It provides:
MockDeviceKit— Entry point for creating simulated devicesMockGlasses— Simulated glasses (Ray-Ban Meta, etc.)MockCameraKit— Simulated camera with configurable video feed and photo capture
Setup
Add MWDATMockDevice to your target via Swift Package Manager (it's included in the meta-wearables-dat-ios package).
import MWDATMockDevice
Creating a mock device
import MWDATMockDevice
let mockDeviceKit = MockDeviceKit.shared
mockDeviceKit.enable()
let mockDevice = try mockDeviceKit.pairGlasses(model: .rayBanMeta)
Simulating device states
// Simulate glasses lifecycle
mockDevice.powerOn()
mockDevice.unfold()
mockDevice.don() // Simulate wearing the glasses
// Later...
mockDevice.doff() // Simulate removing
mockDevice.fold()
mockDevice.powerOff()
Configuring permissions
MockDeviceKit provides permissions to control permission behavior without the Meta AI app.
By default, requestPermission() returns .granted. Use set(_:_:) to control checkPermissionStatus() and setRequestResult(_:result:) to control requestPermission() outcomes.
let mockDeviceKit = MockDeviceKit.shared
// Simulate denied camera permission status
mockDeviceKit.permissions.set(.camera, .denied)
// Simulate denied request result (user tapping "deny")
mockDeviceKit.permissions.setRequestResult(.camera, result: .denied)
Setting up mock camera feeds
Video streaming
let camera = mockDevice.services.camera
camera.setCameraFeed(fileURL: videoURL)
Photo capture
let camera = mockDevice.services.camera
camera.setCapturedImage(fileURL: imageURL)
Writing tests with MockDeviceKit
Create a reusable test base class:
import XCTest
import MetaWearablesDAT
@MainActor
class MockDeviceKitTestCase: XCTestCase {
private var mockDevice: MockGlasses?
private var cameraKit: MockCameraKit?
override func setUp() async throws {
try await super.setUp()
MockDeviceKit.shared.enable()
mockDevice = try MockDeviceKit.shared.pairGlasses(model: .rayBanMeta)
cameraKit = mockDevice?.services.camera // mockDevice is MockGlasses? for tearDown nil-ability
}
override func tearDown() async throws {
MockDeviceKit.shared.disable()
mockDevice = nil
cameraKit = nil
try await super.tearDown()
}
}
Using MockDeviceKit in the CameraAccess sample
The CameraAccess sample app includes a Debug menu for MockDeviceKit:
- Tap the Debug icon to open the MockDeviceKit menu
- Tap Pair RayBan Meta to create a simulated device
- Use PowerOn, Unfold, Don to simulate glasses states
- Select video/image files to configure mock camera feeds
- Start streaming to see simulated frames
Supported media formats
| Type | Formats |
|---|---|
| Video | h.265 (HEVC) |
| Image | JPEG, PNG |
Links
More skills from the meta-wearables-dat-ios repository
View all 9 skillscamera-streaming
configure camera streaming and photo capture
May 15CameraHardwareiOSVideodat-conventions
develop iOS applications with DAT SDK
May 15iOSMobileSDKSwiftdebugging
debug wearable device software
May 15DebuggingEngineeringiOSdisplay-access
manage display capabilities on wearable devices
May 15DesignImagesInteractionUI Components +1getting-started
set up Meta wearable SDK integration
May 15ConfigurationiOSSDKSwiftpermissions-registration
register apps with Meta AI
May 15CameraiOSPermissions
More from Meta Open Source
View publisherrelay-best-practices
write idiomatic Relay code
relay
Apr 22EngineeringFrontendGraphQLReact +1relay-performance
optimize Relay application performance
relay
Jun 10FrontendGraphQLPerformanceReact +1add-shape-types-to-torch-model
annotate PyTorch models with tensor shapes
pyrefly
Jul 18Data ModelingDeep LearningPythonPyTorchsample-app-guide
build wearable apps with camera streaming
meta-wearables-dat-ios
May 15CameraiOSMobilesession-lifecycle
monitor device session lifecycle states
meta-wearables-dat-ios
May 15iOSMobileMonitoringPerformance