Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(556)

Side by Side Diff: cc/trees/layer_tree_host_unittest.cc

Issue 2325773003: cc: Plumb the monitor color profile to renderer for rasterization (Closed)
Patch Set: Make public_deps instead of deps Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 1717 matching lines...) Expand 10 before | Expand all | Expand 10 after
1728 void AfterTest() override {} 1728 void AfterTest() override {}
1729 1729
1730 private: 1730 private:
1731 FakeContentLayerClient client_; 1731 FakeContentLayerClient client_;
1732 scoped_refptr<Layer> root_layer_; 1732 scoped_refptr<Layer> root_layer_;
1733 scoped_refptr<Layer> child_layer_; 1733 scoped_refptr<Layer> child_layer_;
1734 }; 1734 };
1735 1735
1736 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDeviceScaleFactorChange); 1736 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDeviceScaleFactorChange);
1737 1737
1738 class LayerTreeHostTestDeviceColorSpaceChange : public LayerTreeHostTest {
1739 public:
1740 void SetupTree() override {
1741 space1_ = gfx::ColorSpace::CreateXYZD50();
1742 space2_ = gfx::ColorSpace::CreateSRGB();
1743
1744 root_layer_ = Layer::Create();
1745 root_layer_->SetBounds(gfx::Size(10, 20));
1746
1747 child_layer_ = FakePictureLayer::Create(&client_);
1748 child_layer_->SetBounds(gfx::Size(10, 10));
1749 root_layer_->AddChild(child_layer_);
1750
1751 layer_tree()->SetRootLayer(root_layer_);
1752 layer_tree()->SetDeviceColorSpace(space1_);
1753 LayerTreeHostTest::SetupTree();
1754 client_.set_bounds(root_layer_->bounds());
1755 }
1756
1757 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
1758
1759 void DidCommit() override {
1760 if (layer_tree_host()->source_frame_number() == 1)
1761 layer_tree()->SetDeviceColorSpace(space2_);
1762 }
1763
1764 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
1765 if (host_impl->sync_tree()->source_frame_number() == 1) {
1766 EXPECT_TRUE(space2_ == host_impl->sync_tree()->device_color_space());
1767 if (host_impl->pending_tree()) {
1768 // The active tree's device color space shouldn't change until
1769 // activation.
1770 EXPECT_TRUE(space1_ == host_impl->active_tree()->device_color_space());
1771 }
1772 }
1773 }
1774
1775 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
1776 LayerTreeHostImpl::FrameData* frame_data,
1777 DrawResult draw_result) override {
1778 if (host_impl->active_tree()->source_frame_number() == 0) {
1779 EXPECT_TRUE(space1_ == host_impl->active_tree()->device_color_space());
1780 } else {
1781 gfx::Rect root_damage_rect =
1782 frame_data->render_passes.back()->damage_rect;
1783 EXPECT_EQ(
1784 gfx::Rect(
1785 host_impl->active_tree()->root_layer_for_testing()->bounds()),
1786 root_damage_rect);
1787 EXPECT_TRUE(space2_ == host_impl->active_tree()->device_color_space());
1788 EndTest();
1789 }
1790
1791 return draw_result;
1792 }
1793
1794 void AfterTest() override {}
1795
1796 private:
1797 gfx::ColorSpace space1_;
1798 gfx::ColorSpace space2_;
1799 FakeContentLayerClient client_;
1800 scoped_refptr<Layer> root_layer_;
1801 scoped_refptr<Layer> child_layer_;
1802 };
1803
1804 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDeviceColorSpaceChange);
1805
1738 class LayerTreeHostTestSetNextCommitForcesRedraw : public LayerTreeHostTest { 1806 class LayerTreeHostTestSetNextCommitForcesRedraw : public LayerTreeHostTest {
1739 public: 1807 public:
1740 LayerTreeHostTestSetNextCommitForcesRedraw() 1808 LayerTreeHostTestSetNextCommitForcesRedraw()
1741 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {} 1809 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {}
1742 1810
1743 void BeginTest() override { 1811 void BeginTest() override {
1744 root_layer_ = FakePictureLayer::Create(&client_); 1812 root_layer_ = FakePictureLayer::Create(&client_);
1745 root_layer_->SetIsDrawable(true); 1813 root_layer_->SetIsDrawable(true);
1746 root_layer_->SetBounds(bounds_); 1814 root_layer_->SetBounds(bounds_);
1747 layer_tree()->SetRootLayer(root_layer_); 1815 layer_tree()->SetRootLayer(root_layer_);
(...skipping 5379 matching lines...) Expand 10 before | Expand all | Expand 10 after
7127 EndTest(); 7195 EndTest();
7128 } 7196 }
7129 7197
7130 void AfterTest() override {} 7198 void AfterTest() override {}
7131 }; 7199 };
7132 7200
7133 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSubmitFrameResources); 7201 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSubmitFrameResources);
7134 7202
7135 } // namespace 7203 } // namespace
7136 } // namespace cc 7204 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree.cc ('k') | cc/trees/layer_tree_impl.h » ('j') | cc/trees/layer_tree_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698