Commit 2e10c4be authored by Devlin Cronin's avatar Devlin Cronin Committed by Commit Bot

[Cleanup] Use WebContentsConsoleObserver in content/browser/download/

Update //content/browser/download/mhtml_generation_browsertest.cc to
use WebContentsConsoleObserver instead of ConsoleObserverDelegate.
This allows us to observe console messages added without overriding
the existing delegate of the WebContents.

Bug: 1034150
Change-Id: I79d7d6b8174e5e24c4a9ad776a94e2636ec6a9b3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2327287Reviewed-by: default avatarDavid Trainor <dtrainor@chromium.org>
Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#793659}
parent e573a56e
......@@ -359,18 +359,14 @@ class MHTMLGenerationTest
return;
// Loads the generated file to check if it is well formed.
WebContentsDelegate* old_delegate = shell()->web_contents()->GetDelegate();
ConsoleObserverDelegate console_delegate(shell()->web_contents(),
"Malformed multipart archive: *");
shell()->web_contents()->SetDelegate(&console_delegate);
WebContentsConsoleObserver console_observer(shell()->web_contents());
console_observer.SetPattern("Malformed multipart archive: *");
EXPECT_TRUE(
NavigateToURL(shell(), net::FilePathToFileURL(params.file_path)))
<< "Error navigating to the generated MHTML file";
EXPECT_EQ(0U, console_delegate.message().length())
EXPECT_TRUE(console_observer.messages().empty())
<< "The generated MHTML file is malformed";
shell()->web_contents()->SetDelegate(old_delegate);
}
void TwoStepSyncTestFor(const TaskOrder order);
......
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