| Index: cc/trees/layer_tree_host_unittest.cc
|
| diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
|
| index 93cc08272f8c20764d74f652a9d4df597011c43d..a9f7b7ef7e520283d2a691b5dd983a53774d9529 100644
|
| --- a/cc/trees/layer_tree_host_unittest.cc
|
| +++ b/cc/trees/layer_tree_host_unittest.cc
|
| @@ -1735,6 +1735,74 @@ class LayerTreeHostTestDeviceScaleFactorChange : public LayerTreeHostTest {
|
|
|
| SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDeviceScaleFactorChange);
|
|
|
| +class LayerTreeHostTestDeviceColorSpaceChange : public LayerTreeHostTest {
|
| + public:
|
| + void SetupTree() override {
|
| + space1_ = gfx::ColorSpace::CreateXYZD50();
|
| + space2_ = gfx::ColorSpace::CreateSRGB();
|
| +
|
| + root_layer_ = Layer::Create();
|
| + root_layer_->SetBounds(gfx::Size(10, 20));
|
| +
|
| + child_layer_ = FakePictureLayer::Create(&client_);
|
| + child_layer_->SetBounds(gfx::Size(10, 10));
|
| + root_layer_->AddChild(child_layer_);
|
| +
|
| + layer_tree()->SetRootLayer(root_layer_);
|
| + layer_tree()->SetDeviceColorSpace(space1_);
|
| + LayerTreeHostTest::SetupTree();
|
| + client_.set_bounds(root_layer_->bounds());
|
| + }
|
| +
|
| + void BeginTest() override { PostSetNeedsCommitToMainThread(); }
|
| +
|
| + void DidCommit() override {
|
| + if (layer_tree_host()->source_frame_number() == 1)
|
| + layer_tree()->SetDeviceColorSpace(space2_);
|
| + }
|
| +
|
| + void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
|
| + if (host_impl->sync_tree()->source_frame_number() == 1) {
|
| + EXPECT_TRUE(space2_ == host_impl->sync_tree()->device_color_space());
|
| + if (host_impl->pending_tree()) {
|
| + // The active tree's device color space shouldn't change until
|
| + // activation.
|
| + EXPECT_TRUE(space1_ == host_impl->active_tree()->device_color_space());
|
| + }
|
| + }
|
| + }
|
| +
|
| + DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
|
| + LayerTreeHostImpl::FrameData* frame_data,
|
| + DrawResult draw_result) override {
|
| + if (host_impl->active_tree()->source_frame_number() == 0) {
|
| + EXPECT_TRUE(space1_ == host_impl->active_tree()->device_color_space());
|
| + } else {
|
| + gfx::Rect root_damage_rect =
|
| + frame_data->render_passes.back()->damage_rect;
|
| + EXPECT_EQ(
|
| + gfx::Rect(
|
| + host_impl->active_tree()->root_layer_for_testing()->bounds()),
|
| + root_damage_rect);
|
| + EXPECT_TRUE(space2_ == host_impl->active_tree()->device_color_space());
|
| + EndTest();
|
| + }
|
| +
|
| + return draw_result;
|
| + }
|
| +
|
| + void AfterTest() override {}
|
| +
|
| + private:
|
| + gfx::ColorSpace space1_;
|
| + gfx::ColorSpace space2_;
|
| + FakeContentLayerClient client_;
|
| + scoped_refptr<Layer> root_layer_;
|
| + scoped_refptr<Layer> child_layer_;
|
| +};
|
| +
|
| +SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDeviceColorSpaceChange);
|
| +
|
| class LayerTreeHostTestSetNextCommitForcesRedraw : public LayerTreeHostTest {
|
| public:
|
| LayerTreeHostTestSetNextCommitForcesRedraw()
|
|
|