| Code-Review | +1 |
lgtm once the comment has been addressed
Though I think @mich...@chromium.org should also take a look. Can you wait for their +1 too?
OnPageLoaded(web::PageLoadCompletionStatus::SUCCESS);This block capture `this` which is unsafe.
Since `WebState` has a method `GetWeakPtr()`, we should use it here to make this safe in case the test destroy the `FakeWebState` after calling `LoadData(...)` and before the block executes.
So something like this:
```
base::SequencedTaskRunner::GetCurrentDefault()->PostTask(
FROM_HERE,
base::BindOnce(
&FakeWebState::OnPageLoaded,
weak_ptr_factory_.GetWeakPtr(),
web::PageLoadCompletionStatus::SUCCESS));
```
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
lgtm once the comment has been addressed
Though I think @mich...@chromium.org should also take a look. Can you wait for their +1 too?
Thanks Sylvain. After additional conversation on the underlying patch, I may be re-writing it in such a way where I would no longer need the asynchronicity in tests. I'm happy to keep the current code if you think there would be general value otherwise I can revert to avoid the additional complexity.
@mich...@chromium.org let me know if you think there would still be value in exposing this asynchronous OnPageLoaded call in FakeWebState more generally. Besides the unittest included in this patch I didn't find any other major changes needed in the code to support it, though now developers would need to include a `TaskEnvironment` in their unittest if they need FakeWebState.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |