OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/file_path.h" | 6 #include "base/file_path.h" |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
11 #include "base/stringprintf.h" | 11 #include "base/stringprintf.h" |
12 #include "base/string_number_conversions.h" | 12 #include "base/string_number_conversions.h" |
13 #include "base/test/trace_event_analyzer.h" | 13 #include "base/test/trace_event_analyzer.h" |
14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "chrome/browser/net/url_fixer_upper.h" |
15 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
16 #include "chrome/browser/ui/browser_window.h" | 17 #include "chrome/browser/ui/browser_window.h" |
17 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 18 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
18 #include "chrome/browser/ui/window_snapshot/window_snapshot.h" | 19 #include "chrome/browser/ui/window_snapshot/window_snapshot.h" |
19 #include "chrome/common/chrome_paths.h" | 20 #include "chrome/common/chrome_paths.h" |
20 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
21 #include "chrome/test/base/test_switches.h" | 22 #include "chrome/test/base/test_switches.h" |
22 #include "chrome/test/base/tracing.h" | 23 #include "chrome/test/base/tracing.h" |
23 #include "chrome/test/base/ui_test_utils.h" | 24 #include "chrome/test/base/ui_test_utils.h" |
24 #include "chrome/test/perf/browser_perf_test.h" | 25 #include "chrome/test/perf/browser_perf_test.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 } | 64 } |
64 | 65 |
65 // Parse flags from JSON to control the test behavior. | 66 // Parse flags from JSON to control the test behavior. |
66 bool ParseFlagsFromJSON(const FilePath& json_dir, | 67 bool ParseFlagsFromJSON(const FilePath& json_dir, |
67 const std::string& json, | 68 const std::string& json, |
68 int index) { | 69 int index) { |
69 scoped_ptr<base::Value> root; | 70 scoped_ptr<base::Value> root; |
70 root.reset(base::JSONReader::Read(json, false)); | 71 root.reset(base::JSONReader::Read(json, false)); |
71 | 72 |
72 ListValue* root_list = NULL; | 73 ListValue* root_list = NULL; |
73 if (!root.get() || !root->GetAsList(&root_list)) | 74 if (!root.get() || !root->GetAsList(&root_list)) { |
| 75 LOG(ERROR) << "JSON missing root list element"; |
74 return false; | 76 return false; |
| 77 } |
75 | 78 |
76 DictionaryValue* item = NULL; | 79 DictionaryValue* item = NULL; |
77 if (!root_list->GetDictionary(index, &item)) | 80 if (!root_list->GetDictionary(index, &item)) { |
| 81 LOG(ERROR) << "index " << index << " not found in JSON"; |
78 return false; | 82 return false; |
| 83 } |
79 | 84 |
80 std::string str; | 85 std::string str; |
81 if (!item->GetStringASCII("url", &str)) | 86 if (item->GetStringASCII("url", &str)) { |
| 87 gurl_ = GURL(str); |
| 88 } else if (item->GetStringASCII("file", &str)) { |
| 89 FilePath empty; |
| 90 gurl_ = URLFixerUpper::FixupRelativeFile(empty, empty.AppendASCII(str)); |
| 91 } else { |
| 92 LOG(ERROR) << "missing url or file"; |
82 return false; | 93 return false; |
83 gurl_ = GURL(str); | 94 } |
| 95 |
| 96 if (!gurl_.is_valid()) { |
| 97 LOG(ERROR) << "invalid url: " << gurl_.possibly_invalid_spec(); |
| 98 return false; |
| 99 } |
84 | 100 |
85 FilePath::StringType cache_dir; | 101 FilePath::StringType cache_dir; |
86 if (item->GetString("local_path", &cache_dir)) | 102 if (item->GetString("local_path", &cache_dir)) |
87 local_cache_path_ = json_dir.Append(cache_dir); | 103 local_cache_path_ = json_dir.Append(cache_dir); |
88 | 104 |
89 int num; | 105 int num; |
90 if (item->GetInteger("spinup_time", &num)) | 106 if (item->GetInteger("spinup_time", &num)) |
91 spinup_time_ms_ = num * 1000; | 107 spinup_time_ms_ = num * 1000; |
92 if (item->GetInteger("run_time", &num)) | 108 if (item->GetInteger("run_time", &num)) |
93 run_time_ms_ = num * 1000; | 109 run_time_ms_ = num * 1000; |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 | 516 |
501 IN_PROC_BROWSER_TEST_F(ThroughputTestSW, CanvasManyImagesSW) { | 517 IN_PROC_BROWSER_TEST_F(ThroughputTestSW, CanvasManyImagesSW) { |
502 RunCanvasBenchTest("many_images", kNone); | 518 RunCanvasBenchTest("many_images", kNone); |
503 } | 519 } |
504 | 520 |
505 IN_PROC_BROWSER_TEST_F(ThroughputTestGPU, CanvasManyImagesGPU) { | 521 IN_PROC_BROWSER_TEST_F(ThroughputTestGPU, CanvasManyImagesGPU) { |
506 RunCanvasBenchTest("many_images", kNone); | 522 RunCanvasBenchTest("many_images", kNone); |
507 } | 523 } |
508 | 524 |
509 } // namespace | 525 } // namespace |
OLD | NEW |