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

Side by Side Diff: cc/layer_tree_host_perftest.cc

Issue 11412289: Basic pixel tests for cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: moves png comparison code to cc/test, does actual comparison Created 8 years 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 | Annotate | Revision Log
OLDNEW
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/base_paths.h" 7 #include "base/base_paths.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
11 #include "base/path_service.h" 11 #include "base/path_service.h"
12 #include "base/string_piece.h" 12 #include "base/string_piece.h"
13 #include "cc/cc_paths.h"
13 #include "cc/content_layer.h" 14 #include "cc/content_layer.h"
14 #include "cc/nine_patch_layer.h" 15 #include "cc/nine_patch_layer.h"
15 #include "cc/solid_color_layer.h" 16 #include "cc/solid_color_layer.h"
16 #include "cc/test/fake_content_layer_client.h" 17 #include "cc/test/fake_content_layer_client.h"
17 #include "cc/test/layer_tree_test_common.h" 18 #include "cc/test/layer_tree_test_common.h"
18 19
19 namespace cc { 20 namespace cc {
20 namespace { 21 namespace {
21 22
22 static const int kTimeLimitMillis = 2000; 23 static const int kTimeLimitMillis = 2000;
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 } 234 }
234 235
235 class LayerTreeHostPerfTestJsonReader : public LayerTreeHostPerfTest { 236 class LayerTreeHostPerfTestJsonReader : public LayerTreeHostPerfTest {
236 public: 237 public:
237 LayerTreeHostPerfTestJsonReader() 238 LayerTreeHostPerfTestJsonReader()
238 : LayerTreeHostPerfTest() { 239 : LayerTreeHostPerfTest() {
239 } 240 }
240 241
241 void readTestFile(std::string name) { 242 void readTestFile(std::string name) {
242 test_name_ = name; 243 test_name_ = name;
243 FilePath filepath; 244 FilePath test_data_dir;
244 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &filepath)); 245 ASSERT_TRUE(PathService::Get(cc::DIR_TEST_DATA, &test_data_dir));
245 filepath = filepath.AppendASCII("cc").AppendASCII("test") 246 FilePath json_file = test_data_dir.AppendASCII(name + ".json");
246 .AppendASCII("data").AppendASCII(name + ".json");
247 std::string json; 247 std::string json;
248 ASSERT_TRUE(file_util::ReadFileToString(filepath, &json)); 248 ASSERT_TRUE(file_util::ReadFileToString(json_file, &json));
249 tree_.reset(base::JSONReader::Read(json)); 249 tree_.reset(base::JSONReader::Read(json));
250 ASSERT_TRUE(tree_); 250 ASSERT_TRUE(tree_);
251 } 251 }
252 252
253 scoped_refptr<Layer> parseLayer(base::Value* val) { 253 scoped_refptr<Layer> parseLayer(base::Value* val) {
254 DictionaryValue* dict; 254 DictionaryValue* dict;
255 bool success = true; 255 bool success = true;
256 success &= val->GetAsDictionary(&dict); 256 success &= val->GetAsDictionary(&dict);
257 std::string layer_type; 257 std::string layer_type;
258 success &= dict->GetString("LayerType", &layer_type); 258 success &= dict->GetString("LayerType", &layer_type);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 scoped_ptr<base::Value> tree_; 318 scoped_ptr<base::Value> tree_;
319 }; 319 };
320 320
321 TEST_F(LayerTreeHostPerfTestJsonReader, tenTenSingleThread) { 321 TEST_F(LayerTreeHostPerfTestJsonReader, tenTenSingleThread) {
322 readTestFile("10_10_layer_tree"); 322 readTestFile("10_10_layer_tree");
323 runTest(false); 323 runTest(false);
324 } 324 }
325 325
326 } // namespace 326 } // namespace
327 } // namespace cc 327 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698