| Index: chrome/test/gpu/gpu_feature_browsertest.cc
|
| diff --git a/chrome/test/gpu/gpu_feature_browsertest.cc b/chrome/test/gpu/gpu_feature_browsertest.cc
|
| index 36059bbbc8c7cb2c9c970f23316b699a2e1d5a6b..e2ceeced90ea42d809fdf958826b3275bf2312ad 100644
|
| --- a/chrome/test/gpu/gpu_feature_browsertest.cc
|
| +++ b/chrome/test/gpu/gpu_feature_browsertest.cc
|
| @@ -41,16 +41,15 @@ using trace_analyzer::TraceEventVector;
|
|
|
| namespace {
|
|
|
| -typedef uint32 GpuResultFlags;
|
| -#define EXPECT_NO_GPU_SWAP_BUFFERS GpuResultFlags(1<<0)
|
| -// Expect a SwapBuffers to occur (see gles2_cmd_decoder.cc).
|
| -#define EXPECT_GPU_SWAP_BUFFERS GpuResultFlags(1<<1)
|
| +const char kSwapBuffersEvent[] = "SwapBuffers";
|
| +const char kAcceleratedCanvasCreationEvent[] = "Canvas2DLayerBridgeCreation";
|
| +const char kWebGLCreationEvent[] = "DrawingBufferCreation";
|
|
|
| class GpuFeatureTest : public InProcessBrowserTest {
|
| public:
|
| GpuFeatureTest() : trace_categories_("test_gpu"), gpu_enabled_(false) {}
|
|
|
| - virtual void SetUpInProcessBrowserTestFixture() {
|
| + virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
|
| FilePath test_dir;
|
| ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir));
|
| gpu_test_dir_ = test_dir.AppendASCII("gpu");
|
| @@ -110,7 +109,10 @@ class GpuFeatureTest : public InProcessBrowserTest {
|
| EXPECT_STREQ(expected_reply, result.c_str());
|
| }
|
|
|
| - void RunTest(const FilePath& url, GpuResultFlags expectations) {
|
| + // Open the URL and check the trace stream for the given event.
|
| + void RunEventTest(const FilePath& url,
|
| + const char* event_name = NULL,
|
| + bool event_expected = false) {
|
| #if defined(OS_LINUX) && !defined(NDEBUG)
|
| // Bypass tests on GPU Linux Debug bots.
|
| if (gpu_enabled_)
|
| @@ -133,16 +135,16 @@ class GpuFeatureTest : public InProcessBrowserTest {
|
| analyzer_->AssociateBeginEndEvents();
|
| TraceEventVector events;
|
|
|
| - if (expectations & EXPECT_NO_GPU_SWAP_BUFFERS) {
|
| - EXPECT_EQ(analyzer_->FindEvents(Query::EventNameIs("SwapBuffers"),
|
| - &events), size_t(0));
|
| - }
|
| + if (!event_name)
|
| + return;
|
|
|
| - // Check for swap buffers if expected:
|
| - if (expectations & EXPECT_GPU_SWAP_BUFFERS) {
|
| - EXPECT_GT(analyzer_->FindEvents(Query::EventNameIs("SwapBuffers"),
|
| - &events), size_t(0));
|
| - }
|
| + size_t event_count =
|
| + analyzer_->FindEvents(Query::EventNameIs(event_name), &events);
|
| +
|
| + if (event_expected)
|
| + EXPECT_GT(event_count, 0U);
|
| + else
|
| + EXPECT_EQ(event_count, 0U);
|
| }
|
|
|
| // Trigger a resize of the chrome window, and use tracing to wait for the
|
| @@ -178,7 +180,7 @@ IN_PROC_BROWSER_TEST_F(GpuFeatureTest, AcceleratedCompositingAllowed) {
|
| EXPECT_EQ(type, 0);
|
|
|
| const FilePath url(FILE_PATH_LITERAL("feature_compositing.html"));
|
| - RunTest(url, EXPECT_GPU_SWAP_BUFFERS);
|
| + RunEventTest(url, kSwapBuffersEvent, true);
|
| }
|
|
|
| // Flash Stage3D may be blacklisted for other reasons on XP, so ignore it.
|
| @@ -191,8 +193,11 @@ GpuFeatureType IgnoreGpuFeatures(GpuFeatureType type) {
|
| return type;
|
| }
|
|
|
| -IN_PROC_BROWSER_TEST_F(GpuFeatureTest, AcceleratedCompositingBlocked) {
|
| - const std::string json_blacklist =
|
| +class AcceleratedCompositingBlockedTest : public GpuFeatureTest {
|
| + public:
|
| + virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
|
| + GpuFeatureTest::SetUpInProcessBrowserTestFixture();
|
| + const std::string json_blacklist =
|
| "{\n"
|
| " \"name\": \"gpu blacklist\",\n"
|
| " \"version\": \"1.0\",\n"
|
| @@ -205,14 +210,20 @@ IN_PROC_BROWSER_TEST_F(GpuFeatureTest, AcceleratedCompositingBlocked) {
|
| " }\n"
|
| " ]\n"
|
| "}";
|
| - SetupBlacklist(json_blacklist);
|
| + SetupBlacklist(json_blacklist);
|
| + }
|
| +};
|
| +
|
| +IN_PROC_BROWSER_TEST_F(AcceleratedCompositingBlockedTest,
|
| + AcceleratedCompositingBlocked) {
|
| GpuFeatureType type =
|
| GpuDataManager::GetInstance()->GetBlacklistedFeatures();
|
| type = IgnoreGpuFeatures(type);
|
| +
|
| EXPECT_EQ(type, content::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING);
|
|
|
| const FilePath url(FILE_PATH_LITERAL("feature_compositing.html"));
|
| - RunTest(url, EXPECT_NO_GPU_SWAP_BUFFERS);
|
| + RunEventTest(url, kSwapBuffersEvent, false);
|
| }
|
|
|
| class AcceleratedCompositingTest : public GpuFeatureTest {
|
| @@ -226,7 +237,7 @@ class AcceleratedCompositingTest : public GpuFeatureTest {
|
| IN_PROC_BROWSER_TEST_F(AcceleratedCompositingTest,
|
| AcceleratedCompositingDisabled) {
|
| const FilePath url(FILE_PATH_LITERAL("feature_compositing.html"));
|
| - RunTest(url, EXPECT_NO_GPU_SWAP_BUFFERS);
|
| + RunEventTest(url, kSwapBuffersEvent, false);
|
| }
|
|
|
| IN_PROC_BROWSER_TEST_F(GpuFeatureTest, WebGLAllowed) {
|
| @@ -235,7 +246,7 @@ IN_PROC_BROWSER_TEST_F(GpuFeatureTest, WebGLAllowed) {
|
| EXPECT_EQ(type, 0);
|
|
|
| const FilePath url(FILE_PATH_LITERAL("feature_webgl.html"));
|
| - RunTest(url, EXPECT_GPU_SWAP_BUFFERS);
|
| + RunEventTest(url, kWebGLCreationEvent, true);
|
| }
|
|
|
| IN_PROC_BROWSER_TEST_F(GpuFeatureTest, WebGLBlocked) {
|
| @@ -259,7 +270,7 @@ IN_PROC_BROWSER_TEST_F(GpuFeatureTest, WebGLBlocked) {
|
| EXPECT_EQ(type, content::GPU_FEATURE_TYPE_WEBGL);
|
|
|
| const FilePath url(FILE_PATH_LITERAL("feature_webgl.html"));
|
| - RunTest(url, EXPECT_NO_GPU_SWAP_BUFFERS);
|
| + RunEventTest(url, kWebGLCreationEvent, false);
|
| }
|
|
|
| class WebGLTest : public GpuFeatureTest {
|
| @@ -275,7 +286,7 @@ class WebGLTest : public GpuFeatureTest {
|
|
|
| IN_PROC_BROWSER_TEST_F(WebGLTest, WebGLDisabled) {
|
| const FilePath url(FILE_PATH_LITERAL("feature_webgl.html"));
|
| - RunTest(url, EXPECT_NO_GPU_SWAP_BUFFERS);
|
| + RunEventTest(url, kWebGLCreationEvent, false);
|
| }
|
|
|
| IN_PROC_BROWSER_TEST_F(GpuFeatureTest, MultisamplingAllowed) {
|
| @@ -356,7 +367,7 @@ IN_PROC_BROWSER_TEST_F(GpuFeatureTest, Canvas2DAllowed) {
|
| EXPECT_EQ(type, 0);
|
|
|
| const FilePath url(FILE_PATH_LITERAL("feature_canvas2d.html"));
|
| - RunTest(url, EXPECT_GPU_SWAP_BUFFERS);
|
| + RunEventTest(url, kAcceleratedCanvasCreationEvent, true);
|
| }
|
|
|
| IN_PROC_BROWSER_TEST_F(GpuFeatureTest, Canvas2DBlocked) {
|
| @@ -380,7 +391,7 @@ IN_PROC_BROWSER_TEST_F(GpuFeatureTest, Canvas2DBlocked) {
|
| EXPECT_EQ(type, content::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS);
|
|
|
| const FilePath url(FILE_PATH_LITERAL("feature_canvas2d.html"));
|
| - RunTest(url, EXPECT_NO_GPU_SWAP_BUFFERS);
|
| + RunEventTest(url, kAcceleratedCanvasCreationEvent, false);
|
| }
|
|
|
| class Canvas2DDisabledTest : public GpuFeatureTest {
|
| @@ -393,7 +404,7 @@ class Canvas2DDisabledTest : public GpuFeatureTest {
|
|
|
| IN_PROC_BROWSER_TEST_F(Canvas2DDisabledTest, Canvas2DDisabled) {
|
| const FilePath url(FILE_PATH_LITERAL("feature_canvas2d.html"));
|
| - RunTest(url, EXPECT_NO_GPU_SWAP_BUFFERS);
|
| + RunEventTest(url, kAcceleratedCanvasCreationEvent, false);
|
| }
|
|
|
| IN_PROC_BROWSER_TEST_F(GpuFeatureTest,
|
| @@ -418,13 +429,13 @@ class ThreadedCompositorTest : public GpuFeatureTest {
|
| // disabled in http://crbug.com/123503
|
| IN_PROC_BROWSER_TEST_F(ThreadedCompositorTest, ThreadedCompositor) {
|
| const FilePath url(FILE_PATH_LITERAL("feature_compositing.html"));
|
| - RunTest(url, EXPECT_GPU_SWAP_BUFFERS);
|
| + RunEventTest(url, kSwapBuffersEvent, true);
|
| }
|
|
|
| IN_PROC_BROWSER_TEST_F(GpuFeatureTest, RafNoDamage) {
|
| trace_categories_ = "-test_*";
|
| const FilePath url(FILE_PATH_LITERAL("feature_raf_no_damage.html"));
|
| - RunTest(url, GpuResultFlags(0));
|
| + RunEventTest(url);
|
|
|
| if (!analyzer_.get())
|
| return;
|
|
|