diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-12-10 03:01:30 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-12-10 03:01:30 +0900 |
| commit | b72d502f1c5568cd8f93c9142247fa0d94caece5 (patch) | |
| tree | 85a71fe040304d950e41e3f3021330fb141c6ad7 /internal/system/pipewire_test.go | |
| parent | f8b3db3f6641f79cf1bf1bbb9aa28d6922afe422 (diff) | |
internal/outcome: populate instance metadata for PipeWire
These have similar semantics to equivalent Wayland security-context-v1 fields.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/system/pipewire_test.go')
| -rw-r--r-- | internal/system/pipewire_test.go | 70 |
1 files changed, 64 insertions, 6 deletions
diff --git a/internal/system/pipewire_test.go b/internal/system/pipewire_test.go index 127e3f25..9c4950c6 100644 --- a/internal/system/pipewire_test.go +++ b/internal/system/pipewire_test.go @@ -18,6 +18,8 @@ func TestPipeWireOp(t *testing.T) { checkOpBehaviour(t, checkNoParallel, []opBehaviourTestCase{ {"success", 0xbeef, 0xff, &pipewireOp{nil, m(path.Join(t.TempDir(), "pipewire")), + "org.chromium.Chromium", + "ebf083d1b175911782d413369b64ce7c", }, []stub.Call{ call("pipewireConnect", stub.ExpectArgs{}, func() *pipewire.Context { if ctx, err := pipewire.New(&stubPipeWireConn{sendmsg: []string{ @@ -154,11 +156,11 @@ func TestPipeWireOp(t *testing.T) { string([]byte{ // header: SecurityContext::Create 3, 0, 0, 0, - 0xa8, 0, 0, 1, + 0x40, 1, 0, 1, 5, 0, 0, 0, 2, 0, 0, 0, // Struct - 0xa0, 0, 0, 0, + 0x38, 1, 0, 0, 0xe, 0, 0, 0, // Fd: listen_fd = 1 8, 0, 0, 0, @@ -171,12 +173,12 @@ func TestPipeWireOp(t *testing.T) { 0, 0, 0, 0, 0, 0, 0, 0, // Struct: spa_dict - 0x78, 0, 0, 0, + 0x10, 1, 0, 0, 0xe, 0, 0, 0, - // Int: n_items = 2 + // Int: n_items = 4 + 4, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, - 2, 0, 0, 0, 0, 0, 0, 0, // String: key = "pipewire.sec.engine" 0x14, 0, 0, 0, @@ -194,6 +196,48 @@ func TestPipeWireOp(t *testing.T) { 0x68, 0x61, 0x6b, 0x75, 0x72, 0x65, 0x69, 0, 0, 0, 0, 0, + // String: key = "pipewire.sec.app-id" + 0x14, 0, 0, 0, + 8, 0, 0, 0, + 0x70, 0x69, 0x70, 0x65, + 0x77, 0x69, 0x72, 0x65, + 0x2e, 0x73, 0x65, 0x63, + 0x2e, 0x61, 0x70, 0x70, + 0x2d, 0x69, 0x64, 0, + 0, 0, 0, 0, + // String: value = "org.chromium.Chromium" + 0x16, 0, 0, 0, + 8, 0, 0, 0, + 0x6f, 0x72, 0x67, 0x2e, + 0x63, 0x68, 0x72, 0x6f, + 0x6d, 0x69, 0x75, 0x6d, + 0x2e, 0x43, 0x68, 0x72, + 0x6f, 0x6d, 0x69, 0x75, + // String: key = "pipewire.sec.instance-id" + 0x6d, 0, 0, 0, + 0x19, 0, 0, 0, + 8, 0, 0, 0, + 0x70, 0x69, 0x70, 0x65, + 0x77, 0x69, 0x72, 0x65, + 0x2e, 0x73, 0x65, 0x63, + 0x2e, 0x69, 0x6e, 0x73, + 0x74, 0x61, 0x6e, 0x63, + 0x65, 0x2d, 0x69, 0x64, + 0, 0, 0, 0, + 0, 0, 0, 0, + // String: value = "ebf083d1b175911782d413369b64ce7c" + 0x21, 0, 0, 0, + 8, 0, 0, 0, + 0x65, 0x62, 0x66, 0x30, + 0x38, 0x33, 0x64, 0x31, + 0x62, 0x31, 0x37, 0x35, + 0x39, 0x31, 0x31, 0x37, + 0x38, 0x32, 0x64, 0x34, + 0x31, 0x33, 0x33, 0x36, + 0x39, 0x62, 0x36, 0x34, + 0x63, 0x65, 0x37, 0x63, + 0, 0, 0, 0, + 0, 0, 0, 0, // String: key = "pipewire.access" 0x10, 0, 0, 0, 8, 0, 0, 0, @@ -386,29 +430,43 @@ func TestPipeWireOp(t *testing.T) { checkOpsBuilder(t, "PipeWire", []opsBuilderTestCase{ {"sample", 0xcafe, func(_ *testing.T, sys *I) { - sys.PipeWire(m("/tmp/hakurei.1971/ebf083d1b175911782d413369b64ce7c/pipewire")) + sys.PipeWire(m("/tmp/hakurei.1971/ebf083d1b175911782d413369b64ce7c/pipewire"), + "org.chromium.Chromium", + "ebf083d1b175911782d413369b64ce7c") }, []Op{&pipewireOp{nil, m("/tmp/hakurei.1971/ebf083d1b175911782d413369b64ce7c/pipewire"), + "org.chromium.Chromium", + "ebf083d1b175911782d413369b64ce7c", }}, stub.Expect{}}, }) checkOpIs(t, []opIsTestCase{ {"dst differs", &pipewireOp{nil, m("/tmp/hakurei.1971/ebf083d1b175911782d413369b64ce7d/pipewire"), + "org.chromium.Chromium", + "ebf083d1b175911782d413369b64ce7c", }, &pipewireOp{nil, m("/tmp/hakurei.1971/ebf083d1b175911782d413369b64ce7c/pipewire"), + "org.chromium.Chromium", + "ebf083d1b175911782d413369b64ce7c", }, false}, {"equals", &pipewireOp{nil, m("/tmp/hakurei.1971/ebf083d1b175911782d413369b64ce7c/pipewire"), + "org.chromium.Chromium", + "ebf083d1b175911782d413369b64ce7c", }, &pipewireOp{nil, m("/tmp/hakurei.1971/ebf083d1b175911782d413369b64ce7c/pipewire"), + "org.chromium.Chromium", + "ebf083d1b175911782d413369b64ce7c", }, true}, }) checkOpMeta(t, []opMetaTestCase{ {"sample", &pipewireOp{nil, m("/tmp/hakurei.1971/ebf083d1b175911782d413369b64ce7c/pipewire"), + "org.chromium.Chromium", + "ebf083d1b175911782d413369b64ce7c", }, Process, "/tmp/hakurei.1971/ebf083d1b175911782d413369b64ce7c/pipewire", `pipewire socket at "/tmp/hakurei.1971/ebf083d1b175911782d413369b64ce7c/pipewire"`}, }) |
