| <!doctype html><!-- webkit-test-runner [ IPCTestingAPIEnabled=true ] --> |
| <script src="../resources/js-test.js"></script> |
| <script> |
| function fuzz() { |
| description("Send IPC messages between GPU process and WebProcess to create RenderingBackend then ImageBuffer then get the ShareableBitmap"); |
| window.jsTestIsAsync = true; |
| |
| if (!window.IPC) { |
| finishJSTest(); |
| return; |
| } |
| |
| const defaultTimeout = 1000; |
| o4=IPC.pageID; |
| o5=IPC.webPageProxyID; |
| let pair = IPC.createStreamClientConnection(14, defaultTimeout); |
| o35=pair[0]; |
| o36=pair[1]; |
| o35.open(); |
| |
| // Use random identifiers in case this test is run multiple times in the same process. |
| let backendID = Math.floor(Math.random() * 100000000) + 1; |
| let imageBufferID = Math.floor(Math.random() * 100000000) + 1; |
| |
| try { |
| IPC.sendMessage('GPU',0,IPC.messages.GPUConnectionToWebProcess_CreateRenderingBackend.name, |
| [{type: 'uint64_t', value: backendID}, |
| {type: 'uint64_t', value: o5}, |
| {type: 'uint64_t', value: o4}, |
| {type: 'StreamServerConnectionHandle', value: o36}]) |
| } catch (error) { |
| if (!(error instanceof TypeError)) |
| debug("Failed: " + error) |
| } |
| try { |
| resp = o35.waitForMessage(backendID, IPC.messages.RemoteRenderingBackendProxy_DidInitialize.name) |
| } catch (error) { |
| if (!(error instanceof TypeError)) |
| debug("Failed: " + error) |
| } |
| try { |
| o35.setSemaphores(resp[0].value, resp[1].value); |
| } catch (error) { |
| if (!(error instanceof TypeError)) |
| debug("Failed: " + error) |
| } |
| try { |
| o35.sendMessage(backendID, IPC.messages.RemoteRenderingBackend_CreateImageBuffer.name, |
| [{type: 'float', value: 804}, |
| {type: 'float', value: 486}, |
| {type: 'uint8_t', value: 0}, |
| {type: 'uint8_t', value: 2}, |
| {type: 'float', value: 184}, |
| {type: 'uint8_t', value: 0}, |
| {type: 'uint8_t', value: 0}, |
| {type: 'uint64_t', value: imageBufferID}]) |
| } catch (error) { |
| if (!(error instanceof TypeError)) |
| debug("Failed: " + error) |
| } |
| try { |
| o35.waitForMessage(imageBufferID, IPC.messages.RemoteImageBufferProxy_DidCreateBackend.name); |
| } catch (error) { |
| if (!(error instanceof TypeError)) |
| debug("Failed: " + error) |
| } |
| try { |
| o35.sendSyncMessage(imageBufferID,IPC.messages.RemoteImageBuffer_GetShareableBitmap.name, [{type: 'bool',value: 0}]); |
| } catch (error) { |
| if (!(error instanceof TypeError)) |
| debug("Failed: " + error) |
| } finally { |
| o35.invalidate(); |
| finishJSTest(); |
| } |
| } |
| </script> |
| <body onload='fuzz()'></body> |