| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 layer_tree_host()->SetRootLayer(root); | 96 layer_tree_host()->SetRootLayer(root); |
| 97 } | 97 } |
| 98 | 98 |
| 99 private: | 99 private: |
| 100 std::string json_; | 100 std::string json_; |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 // Simulates a tab switcher scene with two stacks of 10 tabs each. | 103 // Simulates a tab switcher scene with two stacks of 10 tabs each. |
| 104 TEST_F(LayerTreeHostPerfTestJsonReader, TenTenSingleThread) { | 104 TEST_F(LayerTreeHostPerfTestJsonReader, TenTenSingleThread) { |
| 105 ReadTestFile("10_10_layer_tree"); | 105 ReadTestFile("10_10_layer_tree"); |
| 106 RunTest(false); | 106 RunTest(false, false); |
| 107 } | 107 } |
| 108 | 108 |
| 109 // Simulates a tab switcher scene with two stacks of 10 tabs each. | 109 // Simulates a tab switcher scene with two stacks of 10 tabs each. |
| 110 TEST_F(LayerTreeHostPerfTestJsonReader, | 110 TEST_F(LayerTreeHostPerfTestJsonReader, |
| 111 TenTenSingleThread_FullDamageEachFrame) { | 111 TenTenSingleThread_FullDamageEachFrame) { |
| 112 full_damage_each_frame_ = true; | 112 full_damage_each_frame_ = true; |
| 113 ReadTestFile("10_10_layer_tree"); | 113 ReadTestFile("10_10_layer_tree"); |
| 114 RunTest(false); | 114 RunTest(false, false); |
| 115 } | 115 } |
| 116 | 116 |
| 117 // Simulates main-thread scrolling on each frame. | 117 // Simulates main-thread scrolling on each frame. |
| 118 class ScrollingLayerTreePerfTest : public LayerTreeHostPerfTestJsonReader { | 118 class ScrollingLayerTreePerfTest : public LayerTreeHostPerfTestJsonReader { |
| 119 public: | 119 public: |
| 120 ScrollingLayerTreePerfTest() | 120 ScrollingLayerTreePerfTest() |
| 121 : LayerTreeHostPerfTestJsonReader() { | 121 : LayerTreeHostPerfTestJsonReader() { |
| 122 } | 122 } |
| 123 | 123 |
| 124 virtual void BuildTree() OVERRIDE { | 124 virtual void BuildTree() OVERRIDE { |
| 125 LayerTreeHostPerfTestJsonReader::BuildTree(); | 125 LayerTreeHostPerfTestJsonReader::BuildTree(); |
| 126 scrollable_ = layer_tree_host()->root_layer()->children()[1]; | 126 scrollable_ = layer_tree_host()->root_layer()->children()[1]; |
| 127 ASSERT_TRUE(scrollable_); | 127 ASSERT_TRUE(scrollable_); |
| 128 } | 128 } |
| 129 | 129 |
| 130 virtual void Layout() OVERRIDE { | 130 virtual void Layout() OVERRIDE { |
| 131 static const gfx::Vector2d delta = gfx::Vector2d(0, 10); | 131 static const gfx::Vector2d delta = gfx::Vector2d(0, 10); |
| 132 scrollable_->SetScrollOffset(scrollable_->scroll_offset() + delta); | 132 scrollable_->SetScrollOffset(scrollable_->scroll_offset() + delta); |
| 133 } | 133 } |
| 134 | 134 |
| 135 private: | 135 private: |
| 136 scoped_refptr<Layer> scrollable_; | 136 scoped_refptr<Layer> scrollable_; |
| 137 }; | 137 }; |
| 138 | 138 |
| 139 TEST_F(ScrollingLayerTreePerfTest, LongScrollablePage) { | 139 TEST_F(ScrollingLayerTreePerfTest, LongScrollablePage) { |
| 140 ReadTestFile("long_scrollable_page"); | 140 ReadTestFile("long_scrollable_page"); |
| 141 RunTest(false); | 141 RunTest(false, false); |
| 142 } | 142 } |
| 143 | 143 |
| 144 } // namespace | 144 } // namespace |
| 145 } // namespace cc | 145 } // namespace cc |
| OLD | NEW |