Index: chrome/test/perf/frame_rate/frame_rate_tests.cc |
diff --git a/chrome/test/perf/frame_rate/frame_rate_tests.cc b/chrome/test/perf/frame_rate/frame_rate_tests.cc |
index 72477c029a9b28d3735ab5805f4a7eb109c37c8f..6e4cf10643a700062dfb54d5b98d46d77739b70c 100644 |
--- a/chrome/test/perf/frame_rate/frame_rate_tests.cc |
+++ b/chrome/test/perf/frame_rate/frame_rate_tests.cc |
@@ -4,6 +4,7 @@ |
#include <map> |
+#include "base/debug/trace_event_test_utils.h" |
#include "base/file_util.h" |
#include "base/path_service.h" |
#include "base/string_number_conversions.h" |
@@ -11,6 +12,8 @@ |
#include "base/utf_string_conversions.h" |
#include "chrome/common/chrome_paths.h" |
#include "chrome/common/chrome_switches.h" |
+#include "chrome/test/automation/automation_proxy.h" |
+#include "chrome/test/automation/browser_proxy.h" |
#include "chrome/test/automation/tab_proxy.h" |
#include "chrome/test/ui/javascript_test_util.h" |
#include "chrome/test/ui/ui_perf_test.h" |
@@ -53,6 +56,9 @@ class FrameRateTest : public UIPerfTest { |
void RunTest(const std::string& name, |
const std::string& suffix, |
bool make_body_composited) { |
+ using namespace base::debug; |
+ using namespace base::debug::trace; |
+ |
FilePath test_path = GetDataPath(name); |
ASSERT_TRUE(file_util::DirectoryExists(test_path)) |
<< "Missing test directory: " << test_path.value(); |
@@ -70,6 +76,12 @@ class FrameRateTest : public UIPerfTest { |
GURL("javascript:__make_body_composited();"))); |
} |
+ // Create a browser proxy. |
+ scoped_refptr<BrowserProxy> browser = automation()->GetBrowserWindow(0); |
+ |
+ // Start tracing category "test_frame_rate_tests". |
+ ASSERT_TRUE(browser->BeginTracing("test_frame_rate_tests")); |
+ |
// Start the tests. |
ASSERT_TRUE(tab->NavigateToURLAsync(GURL("javascript:__start_all();"))); |
@@ -78,6 +90,10 @@ class FrameRateTest : public UIPerfTest { |
tab, L"", L"window.domAutomationController.send(!__running_all);", |
TestTimeouts::large_test_timeout_ms())); |
+ // Stop tracing. |
+ std::string json_events; |
+ ASSERT_TRUE(browser->EndTracing(&json_events)); |
+ |
// Read out the results. |
std::wstring json; |
ASSERT_TRUE(tab->ExecuteAndExtractString( |
@@ -95,7 +111,21 @@ class FrameRateTest : public UIPerfTest { |
ASSERT_TRUE(results.find("means") != results.end()); |
ASSERT_TRUE(results.find("sigmas") != results.end()); |
- std::string trace_name = "fps" + suffix; |
+ // Check trace for GPU accleration. |
+ TraceAnalyzer analyzer(json_events); |
+ const TestTraceEvent* gpu_event = |
+ analyzer.FindEvent(Query(EVENT_NAME) == "SwapBuffers" && |
+ Query(EVENT_ARG, "is_GPU")); |
+ |
+ // Verify that sanity-check DoDeferredUpdate event exists. |
+ ASSERT_TRUE(analyzer.FindEvent(Query(EVENT_NAME) == "DoDeferredUpdate")); |
+ |
+ // If GPU acceleration is requested, set the appropriate suffix. _swfb means |
+ // software fallback (GPU acceleration requested but not available). |
+ std::string gpu_suffix = gpu_event ? "_gpu" : |
+ make_body_composited ? "_swfb" : ""; |
+ |
+ std::string trace_name = "fps" + suffix + gpu_suffix; |
printf("GESTURES %s: %s= [%s] [%s] [%s]\n", name.c_str(), |
trace_name.c_str(), |
results["gestures"].c_str(), |