autofill: Remove redundant RunUntilIdle() calls in FormAutofillTest [chromium/src : main]

0 views
Skip to first unread message

Tamino Bauknecht (Gerrit)

unread,
Jun 11, 2026, 10:53:33 AM (12 days ago) Jun 11
to Jihad Hanna, Daniel Cheng, Chromium LUCI CQ, chromium...@chromium.org, blink-re...@chromium.org, blink-revi...@chromium.org, blink-...@chromium.org, jshin...@chromium.org, browser-comp...@chromium.org
Attention needed from Jihad Hanna

Tamino Bauknecht added 1 comment

Patchset-level comments
File-level comment, Patchset 6:
Tamino Bauknecht . unresolved

@jihad...@google.com I removed my previous changes in `RenderViewTest` because I noticed that `ExecuteJavaScriptForTests` does not even need the `RunLoop` and it seems like the form extraction is triggered manually which also shouldn't need a `RunLoop`.

I ran the test case for 200 times and didn't experience any flakiness on my local machine, do you think this change could cause issues? Initially, I coupled the end of the `RunLoop` to the end of the javascript execution, but that doesn't actually make sense because the execution was already synchronous before. Do you see an issue removing the `RunLoop` and if yes, can you maybe explain what I can use to call `base::RunLoop::Quit()`?

Open in Gerrit

Related details

Attention is currently required from:
  • Jihad Hanna
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I87e79b26e2c95c979f522e1be9537c95f57cdc3e
Gerrit-Change-Number: 7918095
Gerrit-PatchSet: 6
Gerrit-Owner: Tamino Bauknecht <tam...@chromium.org>
Gerrit-Reviewer: Jihad Hanna <jihad...@google.com>
Gerrit-Reviewer: Tamino Bauknecht <tam...@chromium.org>
Gerrit-CC: Daniel Cheng <dch...@chromium.org>
Gerrit-Attention: Jihad Hanna <jihad...@google.com>
Gerrit-Comment-Date: Thu, 11 Jun 2026 14:53:19 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Jihad Hanna (Gerrit)

unread,
Jun 11, 2026, 11:05:24 AM (12 days ago) Jun 11
to Tamino Bauknecht, Jan Keitel, Daniel Cheng, Chromium LUCI CQ, chromium...@chromium.org, blink-re...@chromium.org, blink-revi...@chromium.org, blink-...@chromium.org, jshin...@chromium.org, browser-comp...@chromium.org
Attention needed from Jan Keitel and Tamino Bauknecht

Jihad Hanna voted and added 2 comments

Votes added by Jihad Hanna

Code-Review+1

2 comments

Patchset-level comments
Tamino Bauknecht . unresolved

@jihad...@google.com I removed my previous changes in `RenderViewTest` because I noticed that `ExecuteJavaScriptForTests` does not even need the `RunLoop` and it seems like the form extraction is triggered manually which also shouldn't need a `RunLoop`.

I ran the test case for 200 times and didn't experience any flakiness on my local machine, do you think this change could cause issues? Initially, I coupled the end of the `RunLoop` to the end of the javascript execution, but that doesn't actually make sense because the execution was already synchronous before. Do you see an issue removing the `RunLoop` and if yes, can you maybe explain what I can use to call `base::RunLoop::Quit()`?

Jihad Hanna

That's very interesting. I had never checked whether `ExecuteJavaScriptForTests()` was synchronous or not, I always assumed it was async.

If it is synchronous I agree there's no point in having them, but I guess there's so many instances around our test code where these waiting mechanisms around `ExecuteJavaScriptForTests()`

File-level comment, Patchset 7 (Latest):
Jihad Hanna . resolved

Hey Jan, Could you please take a second look? Thank you!

Open in Gerrit

Related details

Attention is currently required from:
  • Jan Keitel
  • Tamino Bauknecht
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I87e79b26e2c95c979f522e1be9537c95f57cdc3e
Gerrit-Change-Number: 7918095
Gerrit-PatchSet: 7
Gerrit-Owner: Tamino Bauknecht <tam...@chromium.org>
Gerrit-Reviewer: Jan Keitel <jke...@google.com>
Gerrit-Reviewer: Jihad Hanna <jihad...@google.com>
Gerrit-Reviewer: Tamino Bauknecht <tam...@chromium.org>
Gerrit-CC: Daniel Cheng <dch...@chromium.org>
Gerrit-Attention: Jan Keitel <jke...@google.com>
Gerrit-Attention: Tamino Bauknecht <tam...@chromium.org>
Gerrit-Comment-Date: Thu, 11 Jun 2026 15:04:55 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Tamino Bauknecht <tam...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Jan Keitel (Gerrit)

unread,
Jun 11, 2026, 11:19:10 AM (12 days ago) Jun 11
to Tamino Bauknecht, Jihad Hanna, Daniel Cheng, Chromium LUCI CQ, chromium...@chromium.org, blink-re...@chromium.org, blink-revi...@chromium.org, blink-...@chromium.org, jshin...@chromium.org, browser-comp...@chromium.org
Attention needed from Tamino Bauknecht

Jan Keitel voted and added 1 comment

Votes added by Jan Keitel

Code-Review+1

1 comment

Patchset-level comments
Tamino Bauknecht . unresolved

@jihad...@google.com I removed my previous changes in `RenderViewTest` because I noticed that `ExecuteJavaScriptForTests` does not even need the `RunLoop` and it seems like the form extraction is triggered manually which also shouldn't need a `RunLoop`.

I ran the test case for 200 times and didn't experience any flakiness on my local machine, do you think this change could cause issues? Initially, I coupled the end of the `RunLoop` to the end of the javascript execution, but that doesn't actually make sense because the execution was already synchronous before. Do you see an issue removing the `RunLoop` and if yes, can you maybe explain what I can use to call `base::RunLoop::Quit()`?

Jihad Hanna

That's very interesting. I had never checked whether `ExecuteJavaScriptForTests()` was synchronous or not, I always assumed it was async.

If it is synchronous I agree there's no point in having them, but I guess there's so many instances around our test code where these waiting mechanisms around `ExecuteJavaScriptForTests()`

Jan Keitel

This looks fine to me. We do asynchronous work in `FormTracker`, but since we already trigger extraction manually, that does not seem relevant.

@tam...@chromium.org, on your more general question:
Normally, the recommended pattern is something along the following lines:
```
base::RunLoop run_loop;
my_object.DoSomethingAsync(/*on_completion_callback=*/run_loop.QuitClosure());
run_loop.Run();

// continue testing other things - run only once the quit closure is called
```

`Run()` then starts a new run loop that is only terminated when the completion callback is run.

Open in Gerrit

Related details

Attention is currently required from:
  • Tamino Bauknecht
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I87e79b26e2c95c979f522e1be9537c95f57cdc3e
    Gerrit-Change-Number: 7918095
    Gerrit-PatchSet: 7
    Gerrit-Owner: Tamino Bauknecht <tam...@chromium.org>
    Gerrit-Reviewer: Jan Keitel <jke...@google.com>
    Gerrit-Reviewer: Jihad Hanna <jihad...@google.com>
    Gerrit-Reviewer: Tamino Bauknecht <tam...@chromium.org>
    Gerrit-CC: Daniel Cheng <dch...@chromium.org>
    Gerrit-Attention: Tamino Bauknecht <tam...@chromium.org>
    Gerrit-Comment-Date: Thu, 11 Jun 2026 15:18:41 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Comment-In-Reply-To: Tamino Bauknecht <tam...@chromium.org>
    Comment-In-Reply-To: Jihad Hanna <jihad...@google.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Tamino Bauknecht (Gerrit)

    unread,
    Jun 11, 2026, 12:25:33 PM (12 days ago) Jun 11
    to Jan Keitel, Jihad Hanna, Daniel Cheng, Chromium LUCI CQ, chromium...@chromium.org, blink-re...@chromium.org, blink-revi...@chromium.org, blink-...@chromium.org, jshin...@chromium.org, browser-comp...@chromium.org

    Tamino Bauknecht added 1 comment

    Patchset-level comments
    File-level comment, Patchset 6:
    Tamino Bauknecht . resolved

    @jihad...@google.com I removed my previous changes in `RenderViewTest` because I noticed that `ExecuteJavaScriptForTests` does not even need the `RunLoop` and it seems like the form extraction is triggered manually which also shouldn't need a `RunLoop`.

    I ran the test case for 200 times and didn't experience any flakiness on my local machine, do you think this change could cause issues? Initially, I coupled the end of the `RunLoop` to the end of the javascript execution, but that doesn't actually make sense because the execution was already synchronous before. Do you see an issue removing the `RunLoop` and if yes, can you maybe explain what I can use to call `base::RunLoop::Quit()`?

    Jihad Hanna

    That's very interesting. I had never checked whether `ExecuteJavaScriptForTests()` was synchronous or not, I always assumed it was async.

    If it is synchronous I agree there's no point in having them, but I guess there's so many instances around our test code where these waiting mechanisms around `ExecuteJavaScriptForTests()`

    Jan Keitel

    This looks fine to me. We do asynchronous work in `FormTracker`, but since we already trigger extraction manually, that does not seem relevant.

    @tam...@chromium.org, on your more general question:
    Normally, the recommended pattern is something along the following lines:
    ```
    base::RunLoop run_loop;
    my_object.DoSomethingAsync(/*on_completion_callback=*/run_loop.QuitClosure());
    run_loop.Run();

    // continue testing other things - run only once the quit closure is called
    ```

    `Run()` then starts a new run loop that is only terminated when the completion callback is run.

    Tamino Bauknecht

    Acknowledged, @jke...@google.com thank you for your explanation! I've actually already used that pattern in an earlier patchset :) It is just hard to find the correct function on the correct observer for an `EXPECT_CALL` and so far none of the methods I needed it for directly accepted such a completion callback out-of-box :|

    Open in Gerrit

    Related details

    Attention set is empty
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I87e79b26e2c95c979f522e1be9537c95f57cdc3e
      Gerrit-Change-Number: 7918095
      Gerrit-PatchSet: 7
      Gerrit-Owner: Tamino Bauknecht <tam...@chromium.org>
      Gerrit-Reviewer: Jan Keitel <jke...@google.com>
      Gerrit-Reviewer: Jihad Hanna <jihad...@google.com>
      Gerrit-Reviewer: Tamino Bauknecht <tam...@chromium.org>
      Gerrit-CC: Daniel Cheng <dch...@chromium.org>
      Gerrit-Comment-Date: Thu, 11 Jun 2026 16:24:44 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Jan Keitel <jke...@google.com>
      satisfied_requirement
      open
      diffy

      Jan Keitel (Gerrit)

      unread,
      Jun 12, 2026, 2:00:38 AM (12 days ago) Jun 12
      to Tamino Bauknecht, Jihad Hanna, Daniel Cheng, Chromium LUCI CQ, chromium...@chromium.org, blink-re...@chromium.org, blink-revi...@chromium.org, blink-...@chromium.org, jshin...@chromium.org, browser-comp...@chromium.org
      Attention needed from Tamino Bauknecht

      Jan Keitel added 1 comment

      Patchset-level comments
      Tamino Bauknecht . resolved

      @jihad...@google.com I removed my previous changes in `RenderViewTest` because I noticed that `ExecuteJavaScriptForTests` does not even need the `RunLoop` and it seems like the form extraction is triggered manually which also shouldn't need a `RunLoop`.

      I ran the test case for 200 times and didn't experience any flakiness on my local machine, do you think this change could cause issues? Initially, I coupled the end of the `RunLoop` to the end of the javascript execution, but that doesn't actually make sense because the execution was already synchronous before. Do you see an issue removing the `RunLoop` and if yes, can you maybe explain what I can use to call `base::RunLoop::Quit()`?

      Jihad Hanna

      That's very interesting. I had never checked whether `ExecuteJavaScriptForTests()` was synchronous or not, I always assumed it was async.

      If it is synchronous I agree there's no point in having them, but I guess there's so many instances around our test code where these waiting mechanisms around `ExecuteJavaScriptForTests()`

      Jan Keitel

      This looks fine to me. We do asynchronous work in `FormTracker`, but since we already trigger extraction manually, that does not seem relevant.

      @tam...@chromium.org, on your more general question:
      Normally, the recommended pattern is something along the following lines:
      ```
      base::RunLoop run_loop;
      my_object.DoSomethingAsync(/*on_completion_callback=*/run_loop.QuitClosure());
      run_loop.Run();

      // continue testing other things - run only once the quit closure is called
      ```

      `Run()` then starts a new run loop that is only terminated when the completion callback is run.

      Tamino Bauknecht

      Acknowledged, @jke...@google.com thank you for your explanation! I've actually already used that pattern in an earlier patchset :) It is just hard to find the correct function on the correct observer for an `EXPECT_CALL` and so far none of the methods I needed it for directly accepted such a completion callback out-of-box :|

      Jan Keitel

      Yep, that's unfortunately often true - which is why `RunUntilIdle` still gets used frequently.

      Another variant is [`base::test::RunUntil`](https://source.chromium.org/chromium/chromium/src/+/main:base/test/run_until.h;l=34;drc=018839f06e031df1485167f95948ed2b81f87a1f), but AFAIK that's vulnerable to the same issue as `RunUntilIdle` - if, somehow, a machine is extremely busy, it may time out, because it also waits for a moment in which the task loop becomes idle before attempting to verify the condition again.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Tamino Bauknecht
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I87e79b26e2c95c979f522e1be9537c95f57cdc3e
      Gerrit-Change-Number: 7918095
      Gerrit-PatchSet: 7
      Gerrit-Owner: Tamino Bauknecht <tam...@chromium.org>
      Gerrit-Reviewer: Jan Keitel <jke...@google.com>
      Gerrit-Reviewer: Jihad Hanna <jihad...@google.com>
      Gerrit-Reviewer: Tamino Bauknecht <tam...@chromium.org>
      Gerrit-CC: Daniel Cheng <dch...@chromium.org>
      Gerrit-Attention: Tamino Bauknecht <tam...@chromium.org>
      Gerrit-Comment-Date: Fri, 12 Jun 2026 06:00:06 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Tamino Bauknecht <tam...@chromium.org>
      Comment-In-Reply-To: Jan Keitel <jke...@google.com>
      Comment-In-Reply-To: Jihad Hanna <jihad...@google.com>
      satisfied_requirement
      open
      diffy

      Tamino Bauknecht (Gerrit)

      unread,
      Jun 15, 2026, 4:21:10 AM (8 days ago) Jun 15
      to Jan Keitel, Jihad Hanna, Daniel Cheng, Chromium LUCI CQ, chromium...@chromium.org, blink-re...@chromium.org, blink-revi...@chromium.org, blink-...@chromium.org, jshin...@chromium.org, browser-comp...@chromium.org

      Tamino Bauknecht voted Commit-Queue+2

      Commit-Queue+2
      Open in Gerrit

      Related details

      Attention set is empty
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I87e79b26e2c95c979f522e1be9537c95f57cdc3e
      Gerrit-Change-Number: 7918095
      Gerrit-PatchSet: 14
      Gerrit-Owner: Tamino Bauknecht <tam...@chromium.org>
      Gerrit-Reviewer: Jan Keitel <jke...@google.com>
      Gerrit-Reviewer: Jihad Hanna <jihad...@google.com>
      Gerrit-Reviewer: Tamino Bauknecht <tam...@chromium.org>
      Gerrit-CC: Daniel Cheng <dch...@chromium.org>
      Gerrit-Comment-Date: Mon, 15 Jun 2026 08:20:51 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      open
      diffy

      Chromium LUCI CQ (Gerrit)

      unread,
      Jun 15, 2026, 6:00:30 AM (8 days ago) Jun 15
      to Tamino Bauknecht, Jan Keitel, Jihad Hanna, Daniel Cheng, chromium...@chromium.org, blink-re...@chromium.org, blink-revi...@chromium.org, blink-...@chromium.org, jshin...@chromium.org, browser-comp...@chromium.org

      Chromium LUCI CQ submitted the change

      Unreviewed changes

      7 is the latest approved patch-set.
      No files were changed between the latest approved patch-set and the submitted one.

      Change information

      Commit message:
      autofill: Remove redundant RunUntilIdle() calls in FormAutofillTest

      Since `RenderViewTest::ExecuteJavaScriptForTests` is already synchronous
      and the asynchronous form extraction is also manually triggered
      synchronously afterwards by `UpdateFormCache`, no `RunLoop` is required.
      There should be no cross-process communication either, so the calls to
      `base::RunLoop::RunUntilIdle()` were removed.
      Bug: 41483772
      Change-Id: I87e79b26e2c95c979f522e1be9537c95f57cdc3e
      Reviewed-by: Jihad Hanna <jihad...@google.com>
      Reviewed-by: Jan Keitel <jke...@google.com>
      Commit-Queue: Tamino Bauknecht <tam...@chromium.org>
      Cr-Commit-Position: refs/heads/main@{#1646679}
      Files:
      • M chrome/renderer/autofill/form_autofill_browsertest.cc
      Change size: XS
      Delta: 1 file changed, 0 insertions(+), 2 deletions(-)
      Branch: refs/heads/main
      Submit Requirements:
      • requirement satisfiedCode-Review: +1 by Jan Keitel, +1 by Jihad Hanna
      Open in Gerrit
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: merged
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I87e79b26e2c95c979f522e1be9537c95f57cdc3e
      Gerrit-Change-Number: 7918095
      Gerrit-PatchSet: 15
      Gerrit-Owner: Tamino Bauknecht <tam...@chromium.org>
      Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
      Gerrit-Reviewer: Jan Keitel <jke...@google.com>
      Gerrit-Reviewer: Jihad Hanna <jihad...@google.com>
      Gerrit-Reviewer: Tamino Bauknecht <tam...@chromium.org>
      open
      diffy
      satisfied_requirement
      Reply all
      Reply to author
      Forward
      0 new messages