• Matt Falkenhagen's avatar
    service worker: Refactoring in job unittest to use signal instead of RunUntilIdle. · 3372a247
    Matt Falkenhagen authored
    This is more preparation for changing EmbeddedWorkerTestHelper tests
    to use Mojo.
    
    The job tests were overly constrained about what tasks ran when, when
    they just need to make assertions about whether a version became
    activated, etc. This introduces a mechanism to wait for a version status
    change, instead of relying on various RunUntilIdle()-like calls.
    
    More details: My plan is to change the RequestTermination() mechanism in
    this file to use the Mojo method
    EmbeddedWorkerInstanceHost::RequestTermination() rather than calling
    ServiceWorkerVersion::RequestTermination() directly. But in the Mojo
    version, it's not easy to just wait for the callback, since the browser
    actually sends back StopWorker() first and then the callback. The
    default mock client would immediately simulate stopping and sever
    the Mojo connection in StopWorker(), so the RequestTermination callback
    is never invoked.
    
    But these tests shouldn't be concerned with the details of
    RequestTermination() callback and StopWorker() order. They just want to
    assert that an update occurred.
    
    Bug: 927651
    Change-Id: I0b4729f731e1880f0731d7ba4f766b8b52e8b93c
    Reviewed-on: https://chromium-review.googlesource.com/c/1454203
    Commit-Queue: Matt Falkenhagen <falken@chromium.org>
    Reviewed-by: default avatarMakoto Shimazu <shimazu@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#629619}
    3372a247
BUILD.gn 93.9 KB