OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <map> | 5 #include <map> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 test_path = test_path.Append(FILE_PATH_LITERAL("content")); | 77 test_path = test_path.Append(FILE_PATH_LITERAL("content")); |
78 } | 78 } |
79 test_path = test_path.AppendASCII(name); | 79 test_path = test_path.AppendASCII(name); |
80 return test_path; | 80 return test_path; |
81 } | 81 } |
82 | 82 |
83 virtual void SetUp() { | 83 virtual void SetUp() { |
84 if (HasFlag(kUseReferenceBuild)) | 84 if (HasFlag(kUseReferenceBuild)) |
85 UseReferenceBuild(); | 85 UseReferenceBuild(); |
86 | 86 |
| 87 // Turn on chrome.Interval to get higher-resolution timestamps on frames. |
| 88 launch_arguments_.AppendSwitch(switches::kEnableBenchmarking); |
| 89 |
| 90 // Required additional argument to make the kEnableBenchmarking switch work. |
| 91 launch_arguments_.AppendSwitch(switches::kEnableStatsTable); |
| 92 |
87 // UI tests boot up render views starting from about:blank. This causes | 93 // UI tests boot up render views starting from about:blank. This causes |
88 // the renderer to start up thinking it cannot use the GPU. To work | 94 // the renderer to start up thinking it cannot use the GPU. To work |
89 // around that, and allow the frame rate test to use the GPU, we must | 95 // around that, and allow the frame rate test to use the GPU, we must |
90 // pass kAllowWebUICompositing. | 96 // pass kAllowWebUICompositing. |
91 launch_arguments_.AppendSwitch(switches::kAllowWebUICompositing); | 97 launch_arguments_.AppendSwitch(switches::kAllowWebUICompositing); |
92 | 98 |
93 // Some of the tests may launch http requests through JSON or AJAX | 99 // Some of the tests may launch http requests through JSON or AJAX |
94 // which causes a security error (cross domain request) when the page | 100 // which causes a security error (cross domain request) when the page |
95 // is loaded from the local file system ( file:// ). The following switch | 101 // is loaded from the local file system ( file:// ). The following switch |
96 // fixes that error. | 102 // fixes that error. |
(...skipping 28 matching lines...) Expand all Loading... |
125 Query(EVENT_HAS_NUMBER_ARG, "GLImpl")); | 131 Query(EVENT_HAS_NUMBER_ARG, "GLImpl")); |
126 if (gpu_event) | 132 if (gpu_event) |
127 gl_impl = static_cast<gfx::GLImplementation>( | 133 gl_impl = static_cast<gfx::GLImplementation>( |
128 gpu_event->GetKnownArgAsInt("GLImpl")); | 134 gpu_event->GetKnownArgAsInt("GLImpl")); |
129 return (gl_impl == gfx::kGLImplementationDesktopGL || | 135 return (gl_impl == gfx::kGLImplementationDesktopGL || |
130 gl_impl == gfx::kGLImplementationEGLGLES2); | 136 gl_impl == gfx::kGLImplementationEGLGLES2); |
131 } | 137 } |
132 | 138 |
133 void RunTest(const std::string& name) { | 139 void RunTest(const std::string& name) { |
134 if (HasFlag(kUseGpu) && !IsGpuAvailable()) { | 140 if (HasFlag(kUseGpu) && !IsGpuAvailable()) { |
135 printf("Test skipped: requires gpu\n"); | 141 printf("Test skipped: requires gpu. Pass --enable-gpu on the command " |
| 142 "line if use of GPU is desired.\n"); |
136 return; | 143 return; |
137 } | 144 } |
138 | 145 |
139 // Verify flag combinations. | 146 // Verify flag combinations. |
140 ASSERT_TRUE(HasFlag(kUseGpu) || !HasFlag(kForceGpuComposited)); | 147 ASSERT_TRUE(HasFlag(kUseGpu) || !HasFlag(kForceGpuComposited)); |
141 ASSERT_TRUE(!HasFlag(kUseGpu) || IsGpuAvailable()); | 148 ASSERT_TRUE(!HasFlag(kUseGpu) || IsGpuAvailable()); |
142 | 149 |
143 FilePath test_path = GetDataPath(name); | 150 FilePath test_path = GetDataPath(name); |
144 ASSERT_TRUE(file_util::DirectoryExists(test_path)) | 151 ASSERT_TRUE(file_util::DirectoryExists(test_path)) |
145 << "Missing test directory: " << test_path.value(); | 152 << "Missing test directory: " << test_path.value(); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 | 218 |
212 std::map<std::string, std::string> results; | 219 std::map<std::string, std::string> results; |
213 ASSERT_TRUE(JsonDictionaryToMap(WideToUTF8(json), &results)); | 220 ASSERT_TRUE(JsonDictionaryToMap(WideToUTF8(json), &results)); |
214 | 221 |
215 ASSERT_TRUE(results.find("mean") != results.end()); | 222 ASSERT_TRUE(results.find("mean") != results.end()); |
216 ASSERT_TRUE(results.find("sigma") != results.end()); | 223 ASSERT_TRUE(results.find("sigma") != results.end()); |
217 ASSERT_TRUE(results.find("gestures") != results.end()); | 224 ASSERT_TRUE(results.find("gestures") != results.end()); |
218 ASSERT_TRUE(results.find("means") != results.end()); | 225 ASSERT_TRUE(results.find("means") != results.end()); |
219 ASSERT_TRUE(results.find("sigmas") != results.end()); | 226 ASSERT_TRUE(results.find("sigmas") != results.end()); |
220 | 227 |
221 std::string trace_name = "fps" + GetSuffixForTestFlags(); | 228 std::string trace_name = "interval" + GetSuffixForTestFlags(); |
222 printf("GESTURES %s: %s= [%s] [%s] [%s]\n", name.c_str(), | 229 printf("GESTURES %s: %s= [%s] [%s] [%s]\n", name.c_str(), |
223 trace_name.c_str(), | 230 trace_name.c_str(), |
224 results["gestures"].c_str(), | 231 results["gestures"].c_str(), |
225 results["means"].c_str(), | 232 results["means"].c_str(), |
226 results["sigmas"].c_str()); | 233 results["sigmas"].c_str()); |
227 | 234 |
228 std::string mean_and_error = results["mean"] + "," + results["sigma"]; | 235 std::string mean_and_error = results["mean"] + "," + results["sigma"]; |
229 PrintResultMeanAndError(name, "", trace_name, mean_and_error, | 236 PrintResultMeanAndError(name, "", trace_name, mean_and_error, |
230 "frames-per-second", true); | 237 "frames-per-second", true); |
231 } | 238 } |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 kInternal | kHasRedirect | kUseGpu, | 290 kInternal | kHasRedirect | kUseGpu, |
284 kInternal | kHasRedirect | kUseGpu | kDisableVsync, | 291 kInternal | kHasRedirect | kUseGpu | kDisableVsync, |
285 kUseReferenceBuild | kInternal | kHasRedirect | kUseGpu, | 292 kUseReferenceBuild | kInternal | kHasRedirect | kUseGpu, |
286 kUseReferenceBuild | kInternal | kHasRedirect | kUseGpu | kDisableVsync)); | 293 kUseReferenceBuild | kInternal | kHasRedirect | kUseGpu | kDisableVsync)); |
287 | 294 |
288 INTERNAL_FRAME_RATE_TEST_CANVAS_GPU(fireflies) | 295 INTERNAL_FRAME_RATE_TEST_CANVAS_GPU(fireflies) |
289 INTERNAL_FRAME_RATE_TEST_CANVAS_GPU(FishIE) | 296 INTERNAL_FRAME_RATE_TEST_CANVAS_GPU(FishIE) |
290 INTERNAL_FRAME_RATE_TEST_CANVAS_GPU(speedreading) | 297 INTERNAL_FRAME_RATE_TEST_CANVAS_GPU(speedreading) |
291 | 298 |
292 } // namespace | 299 } // namespace |
OLD | NEW |