Add Emulation domain

Signed-off-by: Francis Bouvier <francis@lightpanda.io>
This commit is contained in:
Francis Bouvier
2024-04-16 01:02:44 +02:00
parent 86b1c851c0
commit aff2250504
2 changed files with 37 additions and 0 deletions

34
src/cdp/emulation.zig Normal file
View File

@@ -0,0 +1,34 @@
const std = @import("std");
const server = @import("../server.zig");
const Ctx = server.Cmd;
const result = @import("cdp.zig").result;
const getParams = @import("cdp.zig").getParams;
const stringify = @import("cdp.zig").stringify;
const EmulationMethods = enum {
setEmulatedMedia,
};
pub fn emulation(
alloc: std.mem.Allocator,
id: u64,
action: []const u8,
scanner: *std.json.Scanner,
ctx: *Ctx,
) ![]const u8 {
const method = std.meta.stringToEnum(EmulationMethods, action) orelse
return error.UnknownMethod;
return switch (method) {
.setEmulatedMedia => setEmulatedMedia(alloc, id, scanner, ctx),
};
}
fn setEmulatedMedia(
alloc: std.mem.Allocator,
id: u64,
_: *std.json.Scanner,
_: *Ctx,
) ![]const u8 {
return result(alloc, id, null, null);
}