Commit ecc9400
Fix flaky BraveWalletSignMessageBrowserTest.SIWE test (#34285)
* Fix flaky BraveWalletSignMessageBrowserTest.SIWE test
The SIWE test sends two sign messages per iteration: one with matching
origin and one with a different origin ("www.a.com"). The second message
is rejected immediately by the provider, overwriting the global
signMessageResult variable with an error. After
NotifySignMessageRequestProcessed approves the first message, the test
immediately checked signMessageResult, but the mojo approval response
may not have been delivered to the renderer yet, so signMessageResult
still contained the rejection error.
Fix by replacing the immediate getSignMessageResult() check with a
Promise-based wait that polls until signMessageResult is a string
starting with "0x" (the signature). This is safe because both the
rejection and approval go through the same mojo interface, so the
rejection always arrives before the approval.
Resolves brave/brave-browser#53167
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Address review: fix same race condition in other sign message tests
Apply the same async polling pattern to UserApprovedRequest and
UserRejectedRequest tests, which had the same race condition of
calling getSignMessageResult() immediately after
NotifySignMessageRequestProcessed() without waiting for the mojo
response to arrive at the renderer.
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent fb3dc2f commit ecc9400
File tree
1 file changed
+46
-3
lines changed- browser/brave_wallet
1 file changed
+46
-3
lines changedLines changed: 46 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
40 | 61 | | |
41 | 62 | | |
42 | 63 | | |
| |||
168 | 189 | | |
169 | 190 | | |
170 | 191 | | |
171 | | - | |
| 192 | + | |
172 | 193 | | |
173 | 194 | | |
174 | 195 | | |
| |||
196 | 217 | | |
197 | 218 | | |
198 | 219 | | |
199 | | - | |
| 220 | + | |
200 | 221 | | |
201 | 222 | | |
202 | 223 | | |
| |||
334 | 355 | | |
335 | 356 | | |
336 | 357 | | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
337 | 380 | | |
338 | | - | |
| 381 | + | |
339 | 382 | | |
340 | 383 | | |
341 | 384 | | |
| |||
0 commit comments