mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 07:03:29 +00:00
cdp: add test for setIgnoreCertificateErrors
This commit is contained in:
@@ -35,15 +35,34 @@ fn setIgnoreCertificateErrors(cmd: anytype) !void {
|
|||||||
ignore: bool,
|
ignore: bool,
|
||||||
})) orelse return error.InvalidParams;
|
})) orelse return error.InvalidParams;
|
||||||
|
|
||||||
const bc = cmd.browser_context orelse return error.BrowserContextNotLoaded;
|
|
||||||
|
|
||||||
if (params.ignore) {
|
if (params.ignore) {
|
||||||
try cmd.cdp.browser.http_client.disableTlsVerify();
|
try cmd.cdp.browser.http_client.disableTlsVerify();
|
||||||
} else {
|
} else {
|
||||||
try cmd.cdp.browser.http_client.enableTlsVerify();
|
try cmd.cdp.browser.http_client.enableTlsVerify();
|
||||||
}
|
}
|
||||||
|
|
||||||
return cmd.sendResult(.{
|
return cmd.sendResult(null, .{});
|
||||||
.browserContextId = bc.id,
|
}
|
||||||
}, .{});
|
|
||||||
|
const testing = @import("../testing.zig");
|
||||||
|
|
||||||
|
test "cdp.Security: setIgnoreCertificateErrors" {
|
||||||
|
var ctx = testing.context();
|
||||||
|
defer ctx.deinit();
|
||||||
|
|
||||||
|
_ = try ctx.loadBrowserContext(.{ .id = "BID-9" });
|
||||||
|
|
||||||
|
try ctx.processMessage(.{
|
||||||
|
.id = 8,
|
||||||
|
.method = "Security.setIgnoreCertificateErrors",
|
||||||
|
.params = .{ .ignore = true },
|
||||||
|
});
|
||||||
|
try ctx.expectSentResult(null, .{ .id = 8 });
|
||||||
|
|
||||||
|
try ctx.processMessage(.{
|
||||||
|
.id = 9,
|
||||||
|
.method = "Security.setIgnoreCertificateErrors",
|
||||||
|
.params = .{ .ignore = false },
|
||||||
|
});
|
||||||
|
try ctx.expectSentResult(null, .{ .id = 9 });
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user