Commit c3d6cfc6 authored by Minoru Chikamune's avatar Minoru Chikamune Committed by Chromium LUCI CQ

Fix WebViewTest.SetBaseBackgroundColorBeforeMainFrame failure with NULL WebAgentGroupScheduler

Before this CL, `out/Default/blink_unittests --single-process-tests` was failing. This is because even though WebViewHelper creates AgentGroupScheduler, the tests created another AgentGroupScheduler.

This CL fixes this problem.

Bug: 1166542, 1105403
Change-Id: I96cf2e43896d0c6ac706d3bdd354647b12d4c8db
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2629149Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarKouhei Ueno <kouhei@chromium.org>
Commit-Queue: Minoru Chikamune <chikamune@chromium.org>
Cr-Commit-Position: refs/heads/master@{#843833}
parent a61e8610
......@@ -480,17 +480,13 @@ TEST_F(WebViewTest, SetBaseBackgroundColorBeforeMainFrame) {
// Note: this test doesn't use WebViewHelper since it intentionally runs
// initialization code between WebView and WebLocalFrame creation.
frame_test_helpers::TestWebViewClient web_view_client;
std::unique_ptr<blink::scheduler::WebAgentGroupScheduler>
agent_group_scheduler =
blink::scheduler::WebThreadScheduler::MainThreadScheduler()
->CreateAgentGroupScheduler();
WebViewImpl* web_view = static_cast<WebViewImpl*>(
WebView::Create(&web_view_client,
/*is_hidden=*/false,
/*is_inside_portal=*/false,
/*compositing_enabled=*/true,
/*opener=*/nullptr, mojo::NullAssociatedReceiver(),
*agent_group_scheduler));
web_view_helper_.GetAgentGroupScheduler()));
EXPECT_NE(SK_ColorBLUE, web_view->BackgroundColor());
// WebView does not have a frame yet, but we should still be able to set the
......@@ -2715,14 +2711,11 @@ ExternalDateTimeChooser* WebViewTest::GetExternalDateTimeChooser(
TEST_F(WebViewTest, ClientTapHandlingNullWebViewClient) {
// Note: this test doesn't use WebViewHelper since WebViewHelper creates an
// internal WebViewClient on demand if the supplied WebViewClient is null.
std::unique_ptr<blink::scheduler::WebAgentGroupScheduler>
agent_group_scheduler =
blink::scheduler::WebThreadScheduler::MainThreadScheduler()
->CreateAgentGroupScheduler();
WebViewImpl* web_view = static_cast<WebViewImpl*>(WebView::Create(
/*client=*/nullptr, /*is_hidden=*/false, /*is_inside_portal=*/false,
/*compositing_enabled=*/false, /*opener=*/nullptr,
mojo::NullAssociatedReceiver(), *agent_group_scheduler));
mojo::NullAssociatedReceiver(),
web_view_helper_.GetAgentGroupScheduler()));
frame_test_helpers::TestWebFrameClient web_frame_client;
WebLocalFrame* local_frame =
WebLocalFrame::CreateMainFrame(web_view, &web_frame_client, nullptr,
......
......@@ -452,6 +452,10 @@ class WebViewHelper : public ScopedMockOverlayScrollbars {
is_for_child_local_root, is_for_nested_main_frame);
}
blink::scheduler::WebAgentGroupScheduler& GetAgentGroupScheduler() {
return *agent_group_scheduler_;
}
private:
void InitializeWebView(TestWebViewClient*,
class WebView* opener);
......
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