Commit 63d3885c authored by Devlin Cronin's avatar Devlin Cronin Committed by Commit Bot

[Cleanup] Avoid content::ConsoleObserverDelegate in doodle browsertests

Avoid using content::ConsoleObserverDelegate in LocalNTPDoodleTests.
Instead, use:
- content::WebContentsConsoleObserver, when we're awaiting a specific
  message.
- A new helper class, FailOnConsoleMessage, when the console observer
  was only used to record all console messages and fail whenever one was
  present.

This allows us to avoid overriding the existing WebContentsDelegate,
if any (which can mask behavior unintentional changes, and also
required extra code to set the original delegate *back* in some
scenarios).

Additionally, correct cases where the console observer was monitoring
for messages (presumably for failure), but never checking the result.
FailOnConsoleMessage automatically adds a failure when a console
message is received, rather than needing to explicitly check for one.

Bug: 1034150
Change-Id: I161ba6256bdcd8db6b2d65d5cc0b345874db5727
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1980959Reviewed-by: default avatarDan Beam <dbeam@chromium.org>
Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#727585}
parent da37ba3f
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment