Skip to content

Commit 510c61c

Browse files
committed
cdp: add test for setIgnoreCertificateErrors
1 parent 6915738 commit 510c61c

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

src/cdp/domains/security.zig

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,34 @@ fn setIgnoreCertificateErrors(cmd: anytype) !void {
3535
ignore: bool,
3636
})) orelse return error.InvalidParams;
3737

38-
const bc = cmd.browser_context orelse return error.BrowserContextNotLoaded;
39-
4038
if (params.ignore) {
4139
try cmd.cdp.browser.http_client.disableTlsVerify();
4240
} else {
4341
try cmd.cdp.browser.http_client.enableTlsVerify();
4442
}
4543

46-
return cmd.sendResult(.{
47-
.browserContextId = bc.id,
48-
}, .{});
44+
return cmd.sendResult(null, .{});
45+
}
46+
47+
const testing = @import("../testing.zig");
48+
49+
test "cdp.Security: setIgnoreCertificateErrors" {
50+
var ctx = testing.context();
51+
defer ctx.deinit();
52+
53+
_ = try ctx.loadBrowserContext(.{ .id = "BID-9" });
54+
55+
try ctx.processMessage(.{
56+
.id = 8,
57+
.method = "Security.setIgnoreCertificateErrors",
58+
.params = .{ .ignore = true },
59+
});
60+
try ctx.expectSentResult(null, .{ .id = 8 });
61+
62+
try ctx.processMessage(.{
63+
.id = 9,
64+
.method = "Security.setIgnoreCertificateErrors",
65+
.params = .{ .ignore = false },
66+
});
67+
try ctx.expectSentResult(null, .{ .id = 9 });
4968
}

0 commit comments

Comments
 (0)