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/layer_tree_host.h" | 5 #include "cc/layer_tree_host.h" |
6 | 6 |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 99 |
100 scoped_refptr<Layer> addChild(scoped_refptr<Layer> parent, scoped_refptr<Layer
> child) { | 100 scoped_refptr<Layer> addChild(scoped_refptr<Layer> parent, scoped_refptr<Layer
> child) { |
101 parent->addChild(child); | 101 parent->addChild(child); |
102 return child; | 102 return child; |
103 } | 103 } |
104 | 104 |
105 protected: | 105 protected: |
106 base::TimeTicks start_time_; | 106 base::TimeTicks start_time_; |
107 int num_draws_; | 107 int num_draws_; |
108 std::string test_name_; | 108 std::string test_name_; |
109 WebKitTests::FakeContentLayerClient fake_delegate_; | 109 FakeContentLayerClient fake_delegate_; |
110 }; | 110 }; |
111 | 111 |
112 class LayerTreeHostPerfTestSevenTabSwitcher : public LayerTreeHostPerfTest { | 112 class LayerTreeHostPerfTestSevenTabSwitcher : public LayerTreeHostPerfTest { |
113 public: | 113 public: |
114 LayerTreeHostPerfTestSevenTabSwitcher() | 114 LayerTreeHostPerfTestSevenTabSwitcher() |
115 : LayerTreeHostPerfTest() { | 115 : LayerTreeHostPerfTest() { |
116 test_name_ = "SevenTabSwitcher"; | 116 test_name_ = "SevenTabSwitcher"; |
117 } | 117 } |
118 | 118 |
119 virtual void buildTree() OVERRIDE { | 119 virtual void buildTree() OVERRIDE { |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 | 234 |
235 class LayerTreeHostPerfTestJsonReader : public LayerTreeHostPerfTest { | 235 class LayerTreeHostPerfTestJsonReader : public LayerTreeHostPerfTest { |
236 public: | 236 public: |
237 LayerTreeHostPerfTestJsonReader() | 237 LayerTreeHostPerfTestJsonReader() |
238 : LayerTreeHostPerfTest() { | 238 : LayerTreeHostPerfTest() { |
239 } | 239 } |
240 | 240 |
241 void readTestFile(std::string name) { | 241 void readTestFile(std::string name) { |
242 test_name_ = name; | 242 test_name_ = name; |
243 FilePath test_data_dir; | 243 FilePath test_data_dir; |
244 ASSERT_TRUE(PathService::Get(cc::test::DIR_TEST_DATA, &test_data_dir)); | 244 ASSERT_TRUE(PathService::Get(cc::DIR_TEST_DATA, &test_data_dir)); |
245 FilePath json_file = test_data_dir.AppendASCII(name + ".json"); | 245 FilePath json_file = test_data_dir.AppendASCII(name + ".json"); |
246 std::string json; | 246 std::string json; |
247 ASSERT_TRUE(file_util::ReadFileToString(json_file, &json)); | 247 ASSERT_TRUE(file_util::ReadFileToString(json_file, &json)); |
248 tree_.reset(base::JSONReader::Read(json)); | 248 tree_.reset(base::JSONReader::Read(json)); |
249 ASSERT_TRUE(tree_); | 249 ASSERT_TRUE(tree_); |
250 } | 250 } |
251 | 251 |
252 scoped_refptr<Layer> parseLayer(base::Value* val) { | 252 scoped_refptr<Layer> parseLayer(base::Value* val) { |
253 DictionaryValue* dict; | 253 DictionaryValue* dict; |
254 bool success = true; | 254 bool success = true; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 scoped_ptr<base::Value> tree_; | 325 scoped_ptr<base::Value> tree_; |
326 }; | 326 }; |
327 | 327 |
328 TEST_F(LayerTreeHostPerfTestJsonReader, tenTenSingleThread) { | 328 TEST_F(LayerTreeHostPerfTestJsonReader, tenTenSingleThread) { |
329 readTestFile("10_10_layer_tree"); | 329 readTestFile("10_10_layer_tree"); |
330 runTest(false); | 330 runTest(false); |
331 } | 331 } |
332 | 332 |
333 } // namespace | 333 } // namespace |
334 } // namespace cc | 334 } // namespace cc |
OLD | NEW |