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

Unified Diff: chrome/test/perf/frame_rate/frame_rate_tests.cc

Issue 8052016: Adding support for animated pages in the FrameRate tests (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/data/perf/frame_rate/head_animation.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/perf/frame_rate/frame_rate_tests.cc
===================================================================
--- chrome/test/perf/frame_rate/frame_rate_tests.cc (revision 106089)
+++ chrome/test/perf/frame_rate/frame_rate_tests.cc (working copy)
@@ -15,10 +15,53 @@
#include "chrome/test/ui/javascript_test_util.h"
#include "chrome/test/ui/ui_perf_test.h"
#include "net/base/net_util.h"
+#include "ui/gfx/gl/gl_switches.h"
-namespace {
+//namespace must be named so that the PrintTo overload is externally visible
+namespace FrameRateTestNamespace {
-class FrameRateTest : public UIPerfTest {
+enum FrameRateTestFlags {
+ kMakeBodyComposited = 1 << 0,
+ kDisableVsync = 1 << 1,
+ kDisableGpu = 1 << 2,
+ kReference = 1 << 3,
nduca 2011/10/19 19:25:49 kUseReferenceBuild
+};
+
+// Wrap flags into a class so that PrintTo can be overloaded
+class FrameRateTestVariant {
nduca 2011/10/19 19:25:49 Would this be cleaner with FrameRateTestVariant ha
+public:
+ explicit FrameRateTestVariant(unsigned flags) : flags_(flags){}
+ unsigned GetFlags() const {return flags_;}
+private:
+ unsigned flags_;
+};
+
+void PrintTo(const FrameRateTestVariant& v, std::ostream* os) {
+ bool has_val = false;
+
+#define PRINTFLAG( flag_name ) \
+ if (v.GetFlags() & flag_name) { \
+ if (has_val) { \
+ *os << " | "; \
+ } else { \
+ has_val = true; \
+ } \
+ *os << #flag_name; \
+ }
+
+ PRINTFLAG(kMakeBodyComposited)
+ PRINTFLAG(kDisableVsync)
+ PRINTFLAG(kDisableGpu)
+ // kReference flag deliberately omitted
+
+ if (!has_val) {
+ *os << "0";
+ }
+}
+
+class FrameRateTest :
+ public UIPerfTest,
+ public ::testing::WithParamInterface<FrameRateTestVariant> {
public:
FrameRateTest() {
show_window_ = true;
@@ -41,18 +84,29 @@
}
virtual void SetUp() {
- // UI tests boot up render views starting from about:blank. This causes the
- // renderer to start up thinking it cannot use the GPU. To work around that,
- // and allow the frame rate test to use the GPU, we must pass
- // kAllowWebUICompositing.
+ if (GetParam().GetFlags() & kReference) {
+ UseReferenceBuild();
+ }
+
+ // UI tests boot up render views starting from about:blank. This causes
+ // the renderer to start up thinking it cannot use the GPU. To work
+ // around that, and allow the frame rate test to use the GPU, we must
+ // pass kAllowWebUICompositing.
launch_arguments_.AppendSwitch(switches::kAllowWebUICompositing);
+ if (GetParam().GetFlags() & kDisableGpu) {
+ launch_arguments_.AppendSwitch(switches::kDisableAcceleratedCompositing);
+ launch_arguments_.AppendSwitch(switches::kDisableExperimentalWebGL);
+ }
+
+ if (GetParam().GetFlags() & kDisableVsync) {
+ launch_arguments_.AppendSwitch(switches::kDisableGpuVsync);
+ }
+
UIPerfTest::SetUp();
}
- void RunTest(const std::string& name,
- const std::string& suffix,
- bool make_body_composited) {
+ void RunTest(const std::string& name) {
FilePath test_path = GetDataPath(name);
ASSERT_TRUE(file_util::DirectoryExists(test_path))
<< "Missing test directory: " << test_path.value();
@@ -65,11 +119,16 @@
ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS,
tab->NavigateToURL(net::FilePathToFileURL(test_path)));
- if (make_body_composited) {
+ if (GetParam().GetFlags() & kMakeBodyComposited) {
ASSERT_TRUE(tab->NavigateToURLAsync(
- GURL("javascript:__make_body_composited();")));
+ GURL("javascript:__make_body_composited();")));
}
+ // Block until initialization completes.
+ ASSERT_TRUE(WaitUntilJavaScriptCondition(
+ tab, L"", L"window.domAutomationController.send(__initialized);",
+ TestTimeouts::large_test_timeout_ms()));
+
// Start the tests.
ASSERT_TRUE(tab->NavigateToURLAsync(GURL("javascript:__start_all();")));
@@ -95,7 +154,7 @@
ASSERT_TRUE(results.find("means") != results.end());
ASSERT_TRUE(results.find("sigmas") != results.end());
- std::string trace_name = "fps" + suffix;
+ std::string trace_name = "fps";
nduca 2011/10/19 19:25:49 can't you do suffix = (GetParam().GetFlags() & kRe
printf("GESTURES %s: %s= [%s] [%s] [%s]\n", name.c_str(),
trace_name.c_str(),
results["gestures"].c_str(),
@@ -108,39 +167,47 @@
}
};
-class FrameRateTest_Reference : public FrameRateTest {
- public:
- void SetUp() {
- UseReferenceBuild();
- FrameRateTest::SetUp();
- }
-};
+FrameRateTestVariant kTestVariant_Plain(0);
+FrameRateTestVariant kTestVariant_Comp(kMakeBodyComposited);
+FrameRateTestVariant kTestVariant_Reference(kReference);
+FrameRateTestVariant kTestVariant_Comp_Reference(kMakeBodyComposited
+ | kReference);
+FrameRateTestVariant kTestVariant_NoVsync(kDisableVsync);
+FrameRateTestVariant kTestVariant_NoGpu(kDisableGpu);
+FrameRateTestVariant kTestVariant_NoVsync_Reference(kDisableVsync
+ | kReference);
-#define FRAME_RATE_TEST(content) \
-TEST_F(FrameRateTest, content) { \
- RunTest(#content, "", false); \
-} \
-TEST_F(FrameRateTest_Reference, content) { \
- RunTest(#content, "_ref", false); \
-}
-
-
// Tests that trigger compositing with a -webkit-translateZ(0)
#define FRAME_RATE_TEST_WITH_AND_WITHOUT_ACCELERATED_COMPOSITING(content) \
-TEST_F(FrameRateTest, content) { \
- RunTest(#content, "", false); \
-} \
-TEST_F(FrameRateTest, content ## _comp) { \
- RunTest(#content, "_comp", true); \
-} \
-TEST_F(FrameRateTest_Reference, content) { \
- RunTest(#content, "_ref", false); \
-} \
-TEST_F(FrameRateTest_Reference, content ## _comp) { \
- RunTest(#content, "_comp_ref", true); \
+TEST_P(FrameRateTest, content) { \
+ RunTest(#content); \
}
FRAME_RATE_TEST_WITH_AND_WITHOUT_ACCELERATED_COMPOSITING(blank);
FRAME_RATE_TEST_WITH_AND_WITHOUT_ACCELERATED_COMPOSITING(googleblog);
+INSTANTIATE_TEST_CASE_P(, FrameRateTest, ::testing::Values(
+ kTestVariant_Plain,
+ kTestVariant_Comp));
+INSTANTIATE_TEST_CASE_P(Reference, FrameRateTest, ::testing::Values(
+ kTestVariant_Reference,
+ kTestVariant_Comp_Reference));
+
+// Must use a different class name to avoid test instantiation conflicts
+// with FrameRateTest (used above). An alias is good enough.
+typedef FrameRateTest FrameRateCanvasTest;
+
+#define FRAME_RATE_TEST_ANIMATED_2D_CANVAS(content) \
+TEST_P(FrameRateCanvasTest, content) { \
+ RunTest(#content); \
+} \
+
+INSTANTIATE_TEST_CASE_P(, FrameRateCanvasTest, ::testing::Values(
+ kTestVariant_Plain,
+ kTestVariant_NoVsync,
+ kTestVariant_NoGpu));
+INSTANTIATE_TEST_CASE_P(Reference, FrameRateCanvasTest, ::testing::Values(
+ kTestVariant_Reference,
+ kTestVariant_NoVsync_Reference));
+
} // namespace
« no previous file with comments | « chrome/test/data/perf/frame_rate/head_animation.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698