mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 23:23:28 +00:00
Turn CDP into a generic so that mocks can be injected for testing
ADD CDP testing helpers (mock Browser, Session, Page and Client). These are placeholders until tests are added which use them. Added a couple CDP tests.
This commit is contained in:
@@ -592,7 +592,7 @@ fn ClientT(comptime S: type, comptime C: type) type {
|
||||
self.server.queueClose(self.socket);
|
||||
return false;
|
||||
},
|
||||
.text, .binary => if (self.cdp.?.processMessage(msg.data) == false) {
|
||||
.text, .binary => if (self.cdp.?.handleMessage(msg.data) == false) {
|
||||
self.close(null);
|
||||
return false;
|
||||
},
|
||||
@@ -1747,7 +1747,7 @@ const MockCDP = struct {
|
||||
self.messages.deinit(allocator);
|
||||
}
|
||||
|
||||
fn processMessage(self: *MockCDP, message: []const u8) bool {
|
||||
fn handleMessage(self: *MockCDP, message: []const u8) bool {
|
||||
const owned = self.allocator.dupe(u8, message) catch unreachable;
|
||||
self.messages.append(self.allocator, owned) catch unreachable;
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user