Skip to content

Commit 0806b3d

Browse files
committed
cdp: add a Page.getFrameTree unit test
1 parent 94075e0 commit 0806b3d

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

src/cdp/page.zig

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,3 +316,42 @@ fn navigate(cmd: anytype) !void {
316316
.frameId = state.frame_id,
317317
}, .{ .session_id = session_id });
318318
}
319+
320+
const testing = @import("testing.zig");
321+
test "cdp.page: getFrameTree" {
322+
var ctx = testing.context();
323+
defer ctx.deinit();
324+
325+
const state = ctx.cdp();
326+
state.frame_id = "frame-id";
327+
state.loader_id = "loader-id";
328+
state.url = "chrome://newtab/";
329+
state.secure_context_type = "Secure";
330+
state.security_origin = "origin";
331+
332+
try ctx.processMessage(.{
333+
.id = 32,
334+
.sessionID = "leto",
335+
.method = "Page.getFrameTree",
336+
});
337+
338+
try ctx.expectSentCount(1);
339+
try ctx.expectSentResult(.{
340+
.frameTree = .{
341+
.frame = .{
342+
.id = state.frame_id,
343+
.loaderId = state.loader_id,
344+
.url = state.url,
345+
.domainAndRegistry = "",
346+
.securityOrigin = state.security_origin,
347+
.mimeType = "text/html",
348+
.adFrameStatus = .{
349+
.adFrameType = "none",
350+
},
351+
.secureContextType = state.secure_context_type,
352+
.crossOriginIsolatedContextType = "NotIsolated",
353+
.gatedAPIFeatures = [_][]const u8{},
354+
},
355+
},
356+
}, .{ .id = 32, .index = 0 });
357+
}

0 commit comments

Comments
 (0)