Commit 6d21a259 authored by Devlin Cronin's avatar Devlin Cronin Committed by Commit Bot

[Cleanup] Use WebContentsConsoleObserver in device_sensors

Update remaining tests under //content/browser/device_sensors 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: I422e3b5573d568f3694cc95a0056b16f0a1d5a6d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2319342Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#793673}
parent 99d03743
...@@ -351,16 +351,15 @@ IN_PROC_BROWSER_TEST_F(DeviceSensorBrowserTest, ...@@ -351,16 +351,15 @@ IN_PROC_BROWSER_TEST_F(DeviceSensorBrowserTest,
"https://github.com/WICG/feature-policy/blob/" "https://github.com/WICG/feature-policy/blob/"
"master/features.md#sensor-features"; "master/features.md#sensor-features";
auto console_delegate = std::make_unique<ConsoleObserverDelegate>( WebContentsConsoleObserver console_observer(shell()->web_contents());
shell()->web_contents(), kWarningMessage); console_observer.SetPattern(kWarningMessage);
shell()->web_contents()->SetDelegate(console_delegate.get());
EXPECT_TRUE(NavigateToURL(shell(), main_frame_url)); EXPECT_TRUE(NavigateToURL(shell(), main_frame_url));
EXPECT_TRUE(NavigateIframeToURL(shell()->web_contents(), EXPECT_TRUE(NavigateIframeToURL(shell()->web_contents(),
"cross_origin_iframe", iframe_url)); "cross_origin_iframe", iframe_url));
console_delegate->Wait(); console_observer.Wait();
EXPECT_EQ(kWarningMessage, console_delegate->message()); EXPECT_EQ(kWarningMessage, console_observer.GetMessageAt(0u));
} }
} // namespace } // namespace
......
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