Changeset 293320 in webkit
- Timestamp:
- Apr 25, 2022, 4:47:39 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 7 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/ipc/send-semaphore-expected.txt (added)
-
LayoutTests/ipc/send-semaphore.html (added)
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/Shared/IPCTester.cpp (modified) (2 diffs)
-
Source/WebKit/Shared/IPCTester.h (modified) (1 diff)
-
Source/WebKit/Shared/IPCTester.messages.in (modified) (1 diff)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebKitCocoa/IPCTestingAPI.mm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r293311 r293320 1 2022-04-25 Kimmo Kinnunen <kkinnunen@apple.com> 2 3 REGRESSION (249585@main): TestWebKitAPI.IPCTestingAPI.CanReceiveIPCSemaphore is timing out 4 https://bugs.webkit.org/show_bug.cgi?id=239507 5 6 Reviewed by Wenson Hsieh. 7 8 * ipc/send-semaphore-expected.txt: Added. 9 * ipc/send-semaphore.html: Added. 10 1 11 2022-04-24 Youenn Fablet <youenn@apple.com> 2 12 -
trunk/Source/WebKit/ChangeLog
r293310 r293320 1 2022-04-25 Kimmo Kinnunen <kkinnunen@apple.com> 2 3 REGRESSION (249585@main): TestWebKitAPI.IPCTestingAPI.CanReceiveIPCSemaphore is timing out 4 https://bugs.webkit.org/show_bug.cgi?id=239507 5 6 Reviewed by Wenson Hsieh. 7 8 Add purpose-built test interfaces for testing sending IPC::Semaphore via the IPC. 9 10 Test: ipc/send-semaphore.html 11 12 * Shared/IPCTester.cpp: 13 (WebKit::IPCTester::sendSameSemaphoreBack): 14 (WebKit::IPCTester::sendSemaphoreBackAndSignalProtocol): 15 * Shared/IPCTester.h: 16 * Shared/IPCTester.messages.in: 17 1 18 2022-04-24 Youenn Fablet <youenn@apple.com> 2 19 -
trunk/Source/WebKit/Shared/IPCTester.cpp
r292197 r293320 31 31 #include "Decoder.h" 32 32 #include "IPCStreamTester.h" 33 #include "IPCTesterMessages.h" 33 34 34 35 #include <atomic> … … 146 147 } 147 148 149 void IPCTester::sendSameSemaphoreBack(IPC::Connection& connection, IPC::Semaphore&& semaphore) 150 { 151 connection.send(Messages::IPCTester::SendSameSemaphoreBack(semaphore), 0); 152 } 153 154 void IPCTester::sendSemaphoreBackAndSignalProtocol(IPC::Connection& connection, IPC::Semaphore&& semaphore) 155 { 156 IPC::Semaphore newSemaphore; 157 connection.send(Messages::IPCTester::SendSemaphoreBackAndSignalProtocol(newSemaphore), 0); 158 if (!semaphore.waitFor(10_s)) { 159 ASSERT_IS_TESTING_IPC(); 160 return; 161 } 162 newSemaphore.signal(); 163 // Wait for protocol commit. Otherwise newSemaphore will be destroyed, and the waiter on the other side 164 // will fail to wait. 165 if (!semaphore.waitFor(10_s)) { 166 ASSERT_IS_TESTING_IPC(); 167 return; 168 } 169 } 170 148 171 void IPCTester::stopIfNeeded() 149 172 { -
trunk/Source/WebKit/Shared/IPCTester.h
r292803 r293320 70 70 void createStreamTester(IPC::Connection&, IPCStreamTesterIdentifier, IPC::StreamConnectionBuffer&&); 71 71 void releaseStreamTester(IPCStreamTesterIdentifier, CompletionHandler<void()>&&); 72 void sendSameSemaphoreBack(IPC::Connection&, IPC::Semaphore&&); 73 void sendSemaphoreBackAndSignalProtocol(IPC::Connection&, IPC::Semaphore&&); 72 74 73 75 void stopIfNeeded(); -
trunk/Source/WebKit/Shared/IPCTester.messages.in
r290505 r293320 28 28 CreateStreamTester(WebKit::IPCStreamTesterIdentifier identifier, IPC::StreamConnectionBuffer stream) WantsConnection 29 29 ReleaseStreamTester(WebKit::IPCStreamTesterIdentifier identifier) -> () Synchronous 30 31 SendSameSemaphoreBack(IPC::Semaphore semaphore) WantsConnection 32 SendSemaphoreBackAndSignalProtocol(IPC::Semaphore semaphore) WantsConnection 30 33 } 31 34 -
trunk/Tools/ChangeLog
r293318 r293320 1 2022-04-25 Kimmo Kinnunen <kkinnunen@apple.com> 2 3 REGRESSION (249585@main): TestWebKitAPI.IPCTestingAPI.CanReceiveIPCSemaphore is timing out 4 https://bugs.webkit.org/show_bug.cgi?id=239507 5 6 Reviewed by Wenson Hsieh. 7 8 * TestWebKitAPI/Tests/WebKitCocoa/IPCTestingAPI.mm: 9 Move CanReceiveIPCSemaphore and CanSendIPCSemaphore test logic 10 to LayoutTests/ipc/send-semaphore.html 11 The tests were using audio and canvas implementation detail 12 messages to test that IPC system can send IPC::Semaphore via IPC. 13 Canvas implementation details changed and the test started 14 to fail. 15 16 The new tests use IPC messages that are purpose-built to test this 17 feature. The new tests also actually test that the sent semaphores 18 work. 19 1 20 2022-04-16 Philippe Normand <philn@igalia.com> 2 21 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/IPCTestingAPI.mm
r291773 r293320 287 287 } 288 288 289 TEST(IPCTestingAPI, CanReceiveIPCSemaphore)290 {291 auto webView = createWebViewWithIPCTestingAPI();292 293 auto delegate = adoptNS([[IPCTestingAPIDelegate alloc] init]);294 [webView setUIDelegate:delegate.get()];295 296 done = false;297 auto html = @"<!DOCTYPE html>"298 "<script>"299 "const bufferSize = 1 << 16;"300 "const streamConnection = IPC.createStreamClientConnection('GPU', bufferSize);"301 "IPC.sendMessage('GPU', 0, IPC.messages.GPUConnectionToWebProcess_CreateRenderingBackend.name, ["302 " { type: 'RemoteRenderingBackendCreationParameters', 'identifier': 123, 'pageProxyID': IPC.webPageProxyID, 'pageID': IPC.pageID },"303 " { type: 'StreamConnectionBuffer', value: streamConnection.streamBuffer() },"304 "]);"305 "const arguments = IPC.waitForMessage('GPU', 123, IPC.messages.RemoteRenderingBackendProxy_DidCreateWakeUpSemaphoreForDisplayListStream.name, 100);"306 "alert(arguments.length + ':' + arguments[0].type + ':' + arguments[0].value.waitFor(100));"307 "</script>";308 [webView synchronouslyLoadHTMLString:html];309 TestWebKitAPI::Util::run(&done);310 311 EXPECT_STREQ([alertMessage UTF8String], "1:Semaphore:false");312 }313 314 289 #endif // ENABLE(GPU_PROCESS) 315 316 TEST(IPCTestingAPI, CanCreateIPCSemaphore)317 {318 auto webView = createWebViewWithIPCTestingAPI();319 320 auto delegate = adoptNS([[IPCTestingAPIDelegate alloc] init]);321 [webView setUIDelegate:delegate.get()];322 323 done = false;324 [webView synchronouslyLoadHTMLString:@"<!DOCTYPE html><script>alert(IPC.createSemaphore().waitFor(100));</script>"];325 TestWebKitAPI::Util::run(&done);326 327 EXPECT_FALSE([alertMessage boolValue]);328 }329 290 330 291 TEST(IPCTestingAPI, CanCreateSharedMemory) … … 345 306 EXPECT_EQ([webView stringByEvaluatingJavaScript:@"sharedMemory.writeBytes(new Int8Array([101, 102, 103, 104, 105, 106]), 2, 3)"].intValue, 0); 346 307 EXPECT_STREQ([webView stringByEvaluatingJavaScript:@"Array.from(new Int8Array(sharedMemory.readBytes())).toString()"].UTF8String, "1,2,101,102,103,32,0,0"); 347 }348 349 TEST(IPCTestingAPI, CanSendSemaphore)350 {351 auto webView = createWebViewWithIPCTestingAPI();352 353 auto delegate = adoptNS([[IPCTestingAPIDelegate alloc] init]);354 [webView setUIDelegate:delegate.get()];355 356 auto* html = @R"HTML(<!DOCTYPE html>357 <body>358 <script>359 const audioContext = new AudioContext;360 const destination = audioContext.createMediaStreamDestination();361 const semaphore = IPC.createSemaphore();362 const result = IPC.sendSyncMessage('GPU', 0, IPC.messages.RemoteAudioDestinationManager_CreateAudioDestination.name, 100,363 [{type: 'String', value: 'some device'},364 {type: 'uint32_t', value: destination.numberOfInputs},365 {type: 'uint32_t', value: destination.channelCount},366 {type: 'float', value: audioContext.sampleRate}, {type: 'float', value: audioContext.sampleRate},367 {type: 'Semaphore', value: semaphore}]);368 alert(result.arguments[0].type);369 </script>370 </body>)HTML";371 372 done = false;373 [webView synchronouslyLoadHTMLString:html];374 TestWebKitAPI::Util::run(&done);375 376 EXPECT_STREQ([alertMessage UTF8String], "uint64_t");377 308 } 378 309
Note:
See TracChangeset
for help on using the changeset viewer.