Commit 12d4b780 authored by Xianzhu Wang's avatar Xianzhu Wang Committed by Chromium LUCI CQ

Set non-empty main frame widget size in SimTest::SetUp()

Previously the main frame widget was 0x0, which was not realistic.
Some tests relying on painting would fail if we didn't paint empty
frames.

Also modify NotifySwapTimesWebFrameWidgetTest to meet the requirement
of cc for layer lists. Otherwise the cc would complain about
incomplete paint property setup.

Change-Id: I774b166dc96396706075fa7129e07337ba2a06c9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2609913Reviewed-by: default avatarStefan Zager <szager@chromium.org>
Auto-Submit: Xianzhu Wang <wangxianzhu@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#840048}
parent 9f02ea32
......@@ -8,6 +8,7 @@
#include "base/test/metrics/histogram_tester.h"
#include "build/build_config.h"
#include "cc/layers/solid_color_layer.h"
#include "cc/test/property_tree_test_utils.h"
#include "components/viz/common/surfaces/parent_local_surface_id_allocator.h"
#include "third_party/blink/public/common/input/synthetic_web_input_event_builders.h"
#include "third_party/blink/renderer/core/dom/events/add_event_listener_options_resolved.h"
......@@ -468,14 +469,12 @@ class NotifySwapTimesWebFrameWidgetTest : public SimTest {
WebView().StopDeferringMainFrameUpdate();
FrameWidgetBase()->UpdateCompositorViewportRect(gfx::Rect(200, 100));
auto root_layer = cc::SolidColorLayer::Create();
root_layer->SetBounds(gfx::Size(200, 100));
root_layer->SetBackgroundColor(SK_ColorGREEN);
FrameWidgetBase()->LayerTreeHostForTesting()->SetRootLayer(root_layer);
auto* root_layer =
FrameWidgetBase()->LayerTreeHostForTesting()->root_layer();
auto color_layer = cc::SolidColorLayer::Create();
color_layer->SetBounds(gfx::Size(100, 100));
root_layer->AddChild(color_layer);
cc::CopyProperties(root_layer, color_layer.get());
root_layer->SetChildLayerList(cc::LayerList({color_layer}));
color_layer->SetBackgroundColor(SK_ColorRED);
}
......
......@@ -57,6 +57,8 @@ void SimTest::SetUp() {
local_frame_root_ = WebView().MainFrameImpl();
compositor_->SetLayerTreeHost(
local_frame_root_->FrameWidgetImpl()->LayerTreeHostForTesting());
WebView().MainFrameViewWidget()->Resize(gfx::Size(300, 200));
}
void SimTest::TearDown() {
......
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