Index: chrome/test/perf/frame_rate/frame_rate_tests.cc |
=================================================================== |
--- chrome/test/perf/frame_rate/frame_rate_tests.cc (revision 102775) |
+++ chrome/test/perf/frame_rate/frame_rate_tests.cc (working copy) |
@@ -18,9 +18,17 @@ |
namespace { |
-class FrameRateTest : public UIPerfTest { |
+enum FrameRateTestFlags { |
+ kMakeBodyComposited = 1 << 0, |
+ kDisableRaf = 1 << 1, |
+ kDisableGpu = 1 << 2, |
+ kReference = 1 << 3, |
+}; |
+ |
+template<unsigned TestFlags> |
+class FrameRateTest_ : public UIPerfTest { |
public: |
- FrameRateTest() { |
+ FrameRateTest_() { |
show_window_ = true; |
dom_automation_enabled_ = true; |
// Since this is a performance test, try to use the host machine's GPU |
@@ -41,18 +49,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. |
- launch_arguments_.AppendSwitch(switches::kAllowWebUICompositing); |
+ if (TestFlags & kReference) { |
+ UseReferenceBuild(); |
+ } |
+ if (TestFlags & kDisableGpu) { |
nduca
2011/10/14 21:01:46
Do we have a global flag for this? @zmo might know
|
+ launch_arguments_.AppendSwitch(switches::kDisableAccelerated2dCanvas); |
+ launch_arguments_.AppendSwitch(switches::kDisableAcceleratedCompositing); |
+ launch_arguments_.AppendSwitch(switches::kDisableAcceleratedLayers); |
+ launch_arguments_.AppendSwitch(switches::kDisableAcceleratedPlugins); |
+ launch_arguments_.AppendSwitch(switches::kDisableAcceleratedVideo); |
+ } else { |
+ // 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); |
nduca
2011/10/14 21:01:46
Append this always? There's no harm in it if we pu
|
+ } |
+ |
UIPerfTest::SetUp(); |
} |
void RunTest(const std::string& name, |
- const std::string& suffix, |
- bool make_body_composited) { |
+ const std::string& suffix) { |
FilePath test_path = GetDataPath(name); |
ASSERT_TRUE(file_util::DirectoryExists(test_path)) |
<< "Missing test directory: " << test_path.value(); |
@@ -65,11 +84,21 @@ |
ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, |
tab->NavigateToURL(net::FilePathToFileURL(test_path))); |
- if (make_body_composited) { |
+ if (TestFlags & kMakeBodyComposited) { |
ASSERT_TRUE(tab->NavigateToURLAsync( |
- GURL("javascript:__make_body_composited();"))); |
+ GURL("javascript:__make_body_composited();"))); |
} |
+ if (TestFlags & kDisableRaf) { |
+ ASSERT_TRUE(tab->NavigateToURLAsync( |
+ GURL("javascript:__init_raf(false);"))); |
+ } |
+ |
+ // 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();"))); |
@@ -108,38 +137,80 @@ |
} |
}; |
-class FrameRateTest_Reference : public FrameRateTest { |
- public: |
- void SetUp() { |
- UseReferenceBuild(); |
- FrameRateTest::SetUp(); |
- } |
-}; |
+typedef FrameRateTest_<0> |
nduca
2011/10/14 21:01:46
I think gtest has parameterized tests, though it m
|
+ FrameRateTest; |
+typedef FrameRateTest_<kReference> |
+ FrameRateTest_Reference; |
+typedef FrameRateTest_<kMakeBodyComposited> |
+ FrameRateTest_Comp; |
+typedef FrameRateTest_<kReference | kMakeBodyComposited> |
+ FrameRateTest_Comp_Reference; |
+typedef FrameRateTest_<kDisableRaf> |
+ FrameRateTest_NoRaf; |
+typedef FrameRateTest_<kReference | kDisableRaf> |
+ FrameRateTest_NoRaf_Reference; |
+typedef FrameRateTest_<kDisableGpu> |
+ FrameRateTest_NoGpu; |
+typedef FrameRateTest_<kReference | kDisableGpu> |
+ FrameRateTest_NoGpu_Reference; |
+typedef FrameRateTest_<kDisableRaf | kDisableGpu> |
+ FrameRateTest_NoRaf_NoGpu; |
+typedef FrameRateTest_<kReference | kDisableRaf | kDisableGpu> |
+ FrameRateTest_NoRaf_NoGpu_Reference; |
+ |
#define FRAME_RATE_TEST(content) \ |
TEST_F(FrameRateTest, content) { \ |
- RunTest(#content, "", false); \ |
+ RunTest(#content, ""); \ |
} \ |
TEST_F(FrameRateTest_Reference, content) { \ |
- RunTest(#content, "_ref", false); \ |
+ RunTest(#content, "_ref"); \ |
} |
// 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); \ |
+ RunTest(#content, ""); \ |
} \ |
-TEST_F(FrameRateTest, content ## _comp) { \ |
- RunTest(#content, "_comp", true); \ |
+TEST_F(FrameRateTest_Comp, content ## _comp) { \ |
+ RunTest(#content, "_comp"); \ |
} \ |
TEST_F(FrameRateTest_Reference, content) { \ |
- RunTest(#content, "_ref", false); \ |
+ RunTest(#content, "_ref"); \ |
} \ |
-TEST_F(FrameRateTest_Reference, content ## _comp) { \ |
- RunTest(#content, "_comp_ref", true); \ |
+TEST_F(FrameRateTest_Comp_Reference, content ## _comp) { \ |
+ RunTest(#content, "_comp_ref"); \ |
} |
+// Tests for pages that have animated 2d canvas content. |
+// Tests run with and without RAF, and with and without GPU acceleration. |
+#define FRAME_RATE_TEST_ANIMATED_2D_CANVAS(content) \ |
nduca
2011/10/14 21:01:46
I really think you should factor this differently.
|
+TEST_F(FrameRateTest, content) { \ |
+ RunTest(#content, ""); \ |
+} \ |
+TEST_F(FrameRateTest_NoRaf, content) { \ |
+ RunTest(#content, "_noraf"); \ |
+} \ |
+TEST_F(FrameRateTest_NoGpu, content) { \ |
+ RunTest(#content, "_nogpu"); \ |
+} \ |
+TEST_F(FrameRateTest_NoRaf_NoGpu, content) { \ |
+ RunTest(#content, "_noraf_nogpu"); \ |
+} \ |
+TEST_F(FrameRateTest_Reference, content) { \ |
+ RunTest(#content, "_ref"); \ |
+} \ |
+TEST_F(FrameRateTest_NoRaf_Reference, content) { \ |
+ RunTest(#content, "_noraf_ref"); \ |
+} \ |
+TEST_F(FrameRateTest_NoGpu_Reference, content) { \ |
+ RunTest(#content, "_nogpu_ref"); \ |
+} \ |
+TEST_F(FrameRateTest_NoRaf_NoGpu_Reference, content) { \ |
+ RunTest(#content, "_noraf_nogpu_ref"); \ |
+} \ |
+ |
FRAME_RATE_TEST_WITH_AND_WITHOUT_ACCELERATED_COMPOSITING(blank); |
nduca
2011/10/14 21:01:46
move these up next to the define?
|
FRAME_RATE_TEST_WITH_AND_WITHOUT_ACCELERATED_COMPOSITING(googleblog); |