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

Unified Diff: chrome/test/gpu/gpu_feature_browsertest.cc

Issue 8692013: Improve GPU tests to fail when GPU drawing fails (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tests seem to be fixed Created 9 years, 1 month 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
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 3329150fd1e41478b2c6d8c09b1343c6185372d5..2cd003659447db130ff060c6d482db978e4fce92 100644
--- a/chrome/test/gpu/gpu_feature_browsertest.cc
+++ b/chrome/test/gpu/gpu_feature_browsertest.cc
@@ -18,6 +18,11 @@
namespace {
+typedef uint32 GpuResultFlags;
+#define EXPECT_NO_GPU_PROCESS GpuResultFlags(0)
+#define EXPECT_GPU_PROCESS GpuResultFlags(1<<0)
+#define EXPECT_GPU_SWAP_BUFFERS GpuResultFlags(1<<1)
+
class GpuFeatureTest : public InProcessBrowserTest {
public:
GpuFeatureTest() {}
@@ -36,9 +41,12 @@ class GpuFeatureTest : public InProcessBrowserTest {
GpuDataManager::GetInstance()->SetBuiltInGpuBlacklist(blacklist);
}
- void RunTest(const FilePath& url, bool expect_gpu_process) {
+ void RunTest(const FilePath& url, GpuResultFlags expectations) {
using namespace trace_analyzer;
+ bool expect_gpu_process = (expectations & EXPECT_GPU_PROCESS);
+ bool expect_gpu_swap = (expectations & EXPECT_GPU_SWAP_BUFFERS);
+
FilePath test_path;
PathService::Get(chrome::DIR_TEST_DATA, &test_path);
test_path = test_path.Append(FILE_PATH_LITERAL("gpu"));
@@ -63,6 +71,10 @@ class GpuFeatureTest : public InProcessBrowserTest {
scoped_ptr<TraceAnalyzer> analyzer(TraceAnalyzer::Create(json_events));
EXPECT_EQ(expect_gpu_process, analyzer->FindOneEvent(
Query(EVENT_NAME) == Query::String("GpuProcessLaunched")) != NULL);
+ if (expect_gpu_swap) {
+ EXPECT_TRUE(analyzer->FindOneEvent(
+ Query(EVENT_NAME) == Query::String("SwapBuffers")) != NULL);
+ }
Zhenyao Mo 2011/11/30 18:58:47 This should match the previous line EXPECT_EQ styl
jbates 2011/11/30 20:21:52 Done.
}
};
@@ -70,9 +82,8 @@ IN_PROC_BROWSER_TEST_F(GpuFeatureTest, AcceleratedCompositingAllowed) {
GpuFeatureFlags flags = GpuDataManager::GetInstance()->GetGpuFeatureFlags();
EXPECT_EQ(flags.flags(), 0u);
- const bool expect_gpu_process = true;
const FilePath url(FILE_PATH_LITERAL("feature_compositing.html"));
- RunTest(url, expect_gpu_process);
+ RunTest(url, EXPECT_GPU_PROCESS | EXPECT_GPU_SWAP_BUFFERS);
}
IN_PROC_BROWSER_TEST_F(GpuFeatureTest, AcceleratedCompositingBlocked) {
@@ -95,24 +106,16 @@ IN_PROC_BROWSER_TEST_F(GpuFeatureTest, AcceleratedCompositingBlocked) {
flags.flags(),
static_cast<uint32>(GpuFeatureFlags::kGpuFeatureAcceleratedCompositing));
- const bool expect_gpu_process = false;
const FilePath url(FILE_PATH_LITERAL("feature_compositing.html"));
- RunTest(url, expect_gpu_process);
+ RunTest(url, EXPECT_NO_GPU_PROCESS);
}
-#if defined(OS_LINUX)
-// http://crbug.com/104142
-#define MAYBE_WebGLAllowed DISABLED_WebGLAllowed
-#else
-#define MAYBE_WebGLAllowed WebGLAllowed
-#endif
jbates 2011/11/30 02:24:35 Let's see if this works now...
-IN_PROC_BROWSER_TEST_F(GpuFeatureTest, MAYBE_WebGLAllowed) {
+IN_PROC_BROWSER_TEST_F(GpuFeatureTest, FLAKY_WebGLAllowed) {
GpuFeatureFlags flags = GpuDataManager::GetInstance()->GetGpuFeatureFlags();
EXPECT_EQ(flags.flags(), 0u);
- const bool expect_gpu_process = true;
const FilePath url(FILE_PATH_LITERAL("feature_webgl.html"));
- RunTest(url, expect_gpu_process);
+ RunTest(url, EXPECT_GPU_PROCESS | EXPECT_GPU_SWAP_BUFFERS);
}
IN_PROC_BROWSER_TEST_F(GpuFeatureTest, WebGLBlocked) {
@@ -135,9 +138,8 @@ IN_PROC_BROWSER_TEST_F(GpuFeatureTest, WebGLBlocked) {
flags.flags(),
static_cast<uint32>(GpuFeatureFlags::kGpuFeatureWebgl));
- const bool expect_gpu_process = false;
const FilePath url(FILE_PATH_LITERAL("feature_webgl.html"));
- RunTest(url, expect_gpu_process);
+ RunTest(url, EXPECT_NO_GPU_PROCESS);
}
#if defined(OS_LINUX)
@@ -150,12 +152,13 @@ IN_PROC_BROWSER_TEST_F(GpuFeatureTest, Canvas2DAllowed) {
#if defined(OS_MACOSX)
// TODO(zmo): enabling Mac when skia backend is enabled.
- const bool expect_gpu_process = false;
+ const GpuResultFlags expectations = EXPECT_NO_GPU_PROCESS;
#else
- const bool expect_gpu_process = true;
+ const GpuResultFlags expectations = EXPECT_GPU_PROCESS |
+ EXPECT_GPU_SWAP_BUFFERS;
#endif
const FilePath url(FILE_PATH_LITERAL("feature_canvas2d.html"));
- RunTest(url, expect_gpu_process);
+ RunTest(url, expectations);
}
IN_PROC_BROWSER_TEST_F(GpuFeatureTest, Canvas2DBlocked) {
@@ -178,9 +181,8 @@ IN_PROC_BROWSER_TEST_F(GpuFeatureTest, Canvas2DBlocked) {
flags.flags(),
static_cast<uint32>(GpuFeatureFlags::kGpuFeatureAccelerated2dCanvas));
- const bool expect_gpu_process = false;
const FilePath url(FILE_PATH_LITERAL("feature_canvas2d.html"));
- RunTest(url, expect_gpu_process);
+ RunTest(url, EXPECT_NO_GPU_PROCESS);
}
} // namespace anonymous
« chrome/test/data/gpu/feature_webgl.html ('K') | « chrome/test/data/gpu/feature_webgl.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698