| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 layer_tree_host()->SetRootLayer(root); | 124 layer_tree_host()->SetRootLayer(root); |
| 125 } | 125 } |
| 126 | 126 |
| 127 private: | 127 private: |
| 128 std::string json_; | 128 std::string json_; |
| 129 }; | 129 }; |
| 130 | 130 |
| 131 // Simulates a tab switcher scene with two stacks of 10 tabs each. | 131 // Simulates a tab switcher scene with two stacks of 10 tabs each. |
| 132 TEST_F(LayerTreeHostPerfTestJsonReader, TenTenSingleThread) { | 132 TEST_F(LayerTreeHostPerfTestJsonReader, TenTenSingleThread) { |
| 133 ReadTestFile("10_10_layer_tree"); | 133 ReadTestFile("10_10_layer_tree"); |
| 134 RunTest(false); | 134 RunTest(false, false); |
| 135 } | 135 } |
| 136 | 136 |
| 137 // Simulates a tab switcher scene with two stacks of 10 tabs each. | 137 // Simulates a tab switcher scene with two stacks of 10 tabs each. |
| 138 TEST_F(LayerTreeHostPerfTestJsonReader, | 138 TEST_F(LayerTreeHostPerfTestJsonReader, |
| 139 TenTenSingleThread_FullDamageEachFrame) { | 139 TenTenSingleThread_FullDamageEachFrame) { |
| 140 full_damage_each_frame_ = true; | 140 full_damage_each_frame_ = true; |
| 141 ReadTestFile("10_10_layer_tree"); | 141 ReadTestFile("10_10_layer_tree"); |
| 142 RunTest(false); | 142 RunTest(false, false); |
| 143 } | 143 } |
| 144 | 144 |
| 145 // Simulates main-thread scrolling on each frame. | 145 // Simulates main-thread scrolling on each frame. |
| 146 class ScrollingLayerTreePerfTest : public LayerTreeHostPerfTestJsonReader { | 146 class ScrollingLayerTreePerfTest : public LayerTreeHostPerfTestJsonReader { |
| 147 public: | 147 public: |
| 148 ScrollingLayerTreePerfTest() | 148 ScrollingLayerTreePerfTest() |
| 149 : LayerTreeHostPerfTestJsonReader() { | 149 : LayerTreeHostPerfTestJsonReader() { |
| 150 } | 150 } |
| 151 | 151 |
| 152 virtual void BuildTree() OVERRIDE { | 152 virtual void BuildTree() OVERRIDE { |
| 153 LayerTreeHostPerfTestJsonReader::BuildTree(); | 153 LayerTreeHostPerfTestJsonReader::BuildTree(); |
| 154 scrollable_ = layer_tree_host()->root_layer()->children()[1]; | 154 scrollable_ = layer_tree_host()->root_layer()->children()[1]; |
| 155 ASSERT_TRUE(scrollable_); | 155 ASSERT_TRUE(scrollable_); |
| 156 } | 156 } |
| 157 | 157 |
| 158 virtual void Layout() OVERRIDE { | 158 virtual void Layout() OVERRIDE { |
| 159 static const gfx::Vector2d delta = gfx::Vector2d(0, 10); | 159 static const gfx::Vector2d delta = gfx::Vector2d(0, 10); |
| 160 scrollable_->SetScrollOffset(scrollable_->scroll_offset() + delta); | 160 scrollable_->SetScrollOffset(scrollable_->scroll_offset() + delta); |
| 161 } | 161 } |
| 162 | 162 |
| 163 private: | 163 private: |
| 164 scoped_refptr<Layer> scrollable_; | 164 scoped_refptr<Layer> scrollable_; |
| 165 }; | 165 }; |
| 166 | 166 |
| 167 TEST_F(ScrollingLayerTreePerfTest, LongScrollablePage) { | 167 TEST_F(ScrollingLayerTreePerfTest, LongScrollablePage) { |
| 168 ReadTestFile("long_scrollable_page"); | 168 ReadTestFile("long_scrollable_page"); |
| 169 RunTest(false); | 169 RunTest(false, false); |
| 170 } | 170 } |
| 171 | 171 |
| 172 // Simulates impl-side painting. | 172 // Simulates impl-side painting. |
| 173 class ImplSidePaintingPerfTest : public LayerTreeHostPerfTestJsonReader { | 173 class ImplSidePaintingPerfTest : public LayerTreeHostPerfTestJsonReader { |
| 174 public: | 174 public: |
| 175 ImplSidePaintingPerfTest() | 175 ImplSidePaintingPerfTest() |
| 176 : LayerTreeHostPerfTestJsonReader() {} | 176 : LayerTreeHostPerfTestJsonReader() {} |
| 177 | 177 |
| 178 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { | 178 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { |
| 179 settings->impl_side_painting = true; | 179 settings->impl_side_painting = true; |
| 180 } | 180 } |
| 181 }; | 181 }; |
| 182 | 182 |
| 183 // Simulates a page with several large, transformed and animated layers. | 183 // Simulates a page with several large, transformed and animated layers. |
| 184 TEST_F(ImplSidePaintingPerfTest, HeavyPage) { | 184 TEST_F(ImplSidePaintingPerfTest, HeavyPage) { |
| 185 animation_driven_drawing_ = true; | 185 animation_driven_drawing_ = true; |
| 186 measure_commit_cost_ = true; | 186 measure_commit_cost_ = true; |
| 187 ReadTestFile("heavy_layer_tree"); | 187 ReadTestFile("heavy_layer_tree"); |
| 188 RunTest(true); | 188 RunTest(true, false); |
| 189 } | 189 } |
| 190 | 190 |
| 191 } // namespace | 191 } // namespace |
| 192 } // namespace cc | 192 } // namespace cc |
| OLD | NEW |