fuchsia.device.mock

PROTOCOLS

MockDevice

Defined in fuchsia.device.mock/mock-device.test.fidl

Interface for controlling a mock device. The test suite will implement this interface. Any method that returns a list of actions is interpreted as requesting the corresponding hook to perform that list of actions in order.

Bind

record.device_id corresponds to the parent here.

Request

NameType
record HookInvocation

Response

NameType
actions vector<Action>[10]

Release

Request

NameType
record HookInvocation

GetProtocol

Request

NameType
record HookInvocation
protocol_id uint32

Response

NameType
actions vector<Action>[10]

Open

Request

NameType
record HookInvocation
flags uint32

Response

NameType
actions vector<Action>[10]

Close

Request

NameType
record HookInvocation
flags uint32

Response

NameType
actions vector<Action>[10]

Unbind

Request

NameType
record HookInvocation

Response

NameType
actions vector<Action>[10]

Read

Request

NameType
record HookInvocation
count uint64
off zx/off

Response

NameType
actions vector<Action>[10]

Write

Request

NameType
record HookInvocation
buffer vector<uint8>[16384]
off zx/off

Response

NameType
actions vector<Action>[10]

GetSize

Request

NameType
record HookInvocation

Response

NameType
actions vector<Action>[10]

Suspend

Request

NameType
record HookInvocation
requested_state uint8
enable_wake bool
suspend_reason uint8

Response

NameType
actions vector<Action>[10]

Resume

Request

NameType
record HookInvocation
requested_state uint32

Response

NameType
actions vector<Action>[10]

Message

Request

NameType
record HookInvocation

Response

NameType
actions vector<Action>[10]

Rxrpc

Request

NameType
record HookInvocation

Response

NameType
actions vector<Action>[10]

AddDeviceDone

Notification that the requested action was done

Request

NameType
action_id uint64

UnbindReplyDone

Request

NameType
action_id uint64

SuspendReplyDone

Request

NameType
action_id uint64

ResumeReplyDone

Request

NameType
action_id uint64

MockDeviceThread

Defined in fuchsia.device.mock/mock-device.test.fidl

Interface for requesting a mock device thread do something. The mock device implements this interface. Closing the interface causes the thread to exit.

PerformActions

Perform the actions in the given list. Threads may not create other threads.

Request

NameType
actions vector<Action>[10]

AddDeviceDone

Notification that the requested action was done

Response

NameType
action_id uint64

UnbindReplyDone

Response

NameType
action_id uint64

SuspendReplyDone

Response

NameType
action_id uint64

ResumeReplyDone

Response

NameType
action_id uint64

STRUCTS

HookInvocation

Defined in fuchsia.device.mock/mock-device.test.fidl

A record of the invocation of a hook

NameTypeDescriptionDefault
process_koid zx/koid

Process that the hook was invoked in

No default
thread_koid zx/koid

Thread that the hook was invoked on

No default
device_id uint64

An opaque identifier identifying a specific device

No default

UnbindReplyAction

Defined in fuchsia.device.mock/mock-device.test.fidl

Marker struct for unbind reply action

NameTypeDescriptionDefault
action_id uint64

Value that will be echoed back in the completion message

No default

SuspendReplyAction

Defined in fuchsia.device.mock/mock-device.test.fidl

Marker struct for suspend reply action

NameTypeDescriptionDefault
action_id uint64

Value that will be echoed back in the completion message

No default

ResumeReplyAction

Defined in fuchsia.device.mock/mock-device.test.fidl

Marker struct for resume reply action

NameTypeDescriptionDefault
action_id uint64

Value that will be echoed back in the completion message

No default

AddDeviceAction

Defined in fuchsia.device.mock/mock-device.test.fidl

Request to add a new child device

NameTypeDescriptionDefault
action_id uint64

Value that will be echoed back in the completion message

No default
do_bind bool

If true, will let the device go through the bind protocol. Otherwise, will just create another mock device and skip binding.

No default
controller MockDevice?

If creating a mock device, the service the new device will listen to.

No default
name string[32]

The name that should be given to the new device. Used by devfs and debug messages.

No default
properties vector<uint64>[32]

The properties to attach the newly created device

No default
expect_status zx/status

The expected return status from device_add()

No default

UNIONS

Action

Defined in fuchsia.device.mock/mock-device.test.fidl

What a hook should do.

NameTypeDescription
return_status zx/status

Return this status.

write vector<uint8>[16384]

Write these bytes to the buffer associated with the hook.

create_thread request<MockDeviceThread>

Create a new thread with a processing loop.

async_remove_device bool

Invoke device_async_remove() on our device.

unbind_reply UnbindReplyAction

Signal that the unbind has completed.

add_device AddDeviceAction

Create a new child device

suspend_reply SuspendReplyAction

Signal that the suspend has completed.

resume_reply ResumeReplyAction

CONSTANTS

NameValueTypeDescription
MAX_PROPERTIES_LEN 32 uint32
MAX_NAME_LEN 32 uint32
MAX_ACTIONS 10 uint32
MAX_WRITE_BYTES 16384 uint32