Documentation
¶
Index ¶
- type MockBinder
- func (m *MockBinder) Cookie() uintptr
- func (m *MockBinder) Handle() uint32
- func (m *MockBinder) Identity() binder.CallerIdentity
- func (m *MockBinder) IsAlive(_ context.Context) bool
- func (m *MockBinder) LinkToDeath(_ context.Context, _ binder.DeathRecipient) error
- func (m *MockBinder) ResolveCode(_ context.Context, _ string, _ string) (binder.TransactionCode, error)
- func (m *MockBinder) Transact(_ context.Context, _ binder.TransactionCode, _ binder.TransactionFlags, ...) (*parcel.Parcel, error)
- func (m *MockBinder) Transport() binder.VersionAwareTransport
- func (m *MockBinder) UnlinkToDeath(_ context.Context, _ binder.DeathRecipient) error
- type SmokeOption
- type SmokeResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockBinder ¶
type MockBinder struct{}
MockBinder is a test double for binder.IBinder that returns a SecurityException reply from every Transact call. This allows testing generated proxy methods without a real binder driver.
func (*MockBinder) Cookie ¶
func (m *MockBinder) Cookie() uintptr
Cookie returns 0 (mock has no local binder cookie).
func (*MockBinder) Handle ¶
func (m *MockBinder) Handle() uint32
Handle returns a fixed handle value of 42.
func (*MockBinder) Identity ¶
func (m *MockBinder) Identity() binder.CallerIdentity
Identity returns a zero-value CallerIdentity since the mock has no real caller.
func (*MockBinder) IsAlive ¶
func (m *MockBinder) IsAlive(_ context.Context) bool
IsAlive always returns true for the mock.
func (*MockBinder) LinkToDeath ¶
func (m *MockBinder) LinkToDeath( _ context.Context, _ binder.DeathRecipient, ) error
LinkToDeath is a no-op for the mock.
func (*MockBinder) ResolveCode ¶
func (m *MockBinder) ResolveCode( _ context.Context, _ string, _ string, ) (binder.TransactionCode, error)
ResolveCode always returns FirstCallTransaction for the mock. The mock doesn't care about transaction codes — it returns SecurityException regardless.
func (*MockBinder) Transact ¶
func (m *MockBinder) Transact( _ context.Context, _ binder.TransactionCode, _ binder.TransactionFlags, _ *parcel.Parcel, ) (*parcel.Parcel, error)
Transact returns a reply parcel containing a SecurityException status.
func (*MockBinder) Transport ¶
func (m *MockBinder) Transport() binder.VersionAwareTransport
Transport returns nil since there is no underlying transport.
func (*MockBinder) UnlinkToDeath ¶
func (m *MockBinder) UnlinkToDeath( _ context.Context, _ binder.DeathRecipient, ) error
UnlinkToDeath is a no-op for the mock.
type SmokeOption ¶
type SmokeOption func(*smokeConfig)
SmokeOption configures SmokeTestAllMethods behavior.
func WithMethodFilter ¶
func WithMethodFilter(filter func(string) bool) SmokeOption
WithMethodFilter sets a predicate that decides whether a method should be tested. Methods for which the filter returns false are skipped.
type SmokeResult ¶
SmokeResult summarizes the outcome of SmokeTestAllMethods.
func SmokeTestAllMethods ¶
func SmokeTestAllMethods( t *testing.T, proxy any, opts ...SmokeOption, ) SmokeResult
SmokeTestAllMethods calls every exported method on proxy with zero-value arguments and classifies the results. Each method is run as a t.Run sub-test. Panics (e.g. nil interface dereference) are caught and counted, not propagated.