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

Unified Diff: gpu/command_buffer/service/feature_info_unittest.cc

Issue 331293003: Add common GLFence::IsSupported() check (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 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 | « gpu/command_buffer/service/feature_info.cc ('k') | gpu/command_buffer/service/gpu_service_test.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/feature_info_unittest.cc
diff --git a/gpu/command_buffer/service/feature_info_unittest.cc b/gpu/command_buffer/service/feature_info_unittest.cc
index be3e38a6715b75c6f32b8d699ff555566562458b..3b32f7a5bae6f7061a34080b5b78604ebcb57564 100644
--- a/gpu/command_buffer/service/feature_info_unittest.cc
+++ b/gpu/command_buffer/service/feature_info_unittest.cc
@@ -13,6 +13,7 @@
#include "gpu/command_buffer/service/texture_manager.h"
#include "gpu/config/gpu_driver_bug_workaround_type.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/gl/gl_fence.h"
#include "ui/gl/gl_implementation.h"
#include "ui/gl/gl_mock.h"
@@ -46,6 +47,7 @@ class FeatureInfoTest : public GpuServiceTest {
void SetupInitExpectationsWithGLVersion(
const char* extensions, const char* renderer, const char* version) {
+ GpuServiceTest::SetUpWithGLVersion(version, extensions);
TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion(
gl_.get(), extensions, renderer, version);
info_ = new FeatureInfo();
@@ -53,11 +55,13 @@ class FeatureInfoTest : public GpuServiceTest {
}
void SetupWithCommandLine(const CommandLine& command_line) {
+ GpuServiceTest::SetUp();
info_ = new FeatureInfo(command_line);
}
void SetupInitExpectationsWithCommandLine(
const char* extensions, const CommandLine& command_line) {
+ GpuServiceTest::SetUpWithGLVersion("2.0", extensions);
TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion(
gl_.get(), extensions, "", "");
info_ = new FeatureInfo(command_line);
@@ -65,11 +69,16 @@ class FeatureInfoTest : public GpuServiceTest {
}
void SetupWithoutInit() {
+ GpuServiceTest::SetUp();
info_ = new FeatureInfo();
}
protected:
- virtual void TearDown() {
+ virtual void SetUp() OVERRIDE {
+ // Do nothing here, since we are using the explicit Setup*() functions.
+ }
+
+ virtual void TearDown() OVERRIDE {
info_ = NULL;
GpuServiceTest::TearDown();
}
@@ -310,6 +319,7 @@ TEST_F(FeatureInfoTest, InitializeNoExtensions) {
GL_DEPTH24_STENCIL8_OES));
EXPECT_FALSE(info_->validators()->equation.IsValid(GL_MIN_EXT));
EXPECT_FALSE(info_->validators()->equation.IsValid(GL_MAX_EXT));
+ EXPECT_FALSE(info_->feature_flags().chromium_sync_query);
}
TEST_F(FeatureInfoTest, InitializeWithANGLE) {
@@ -1007,6 +1017,8 @@ TEST_F(FeatureInfoTest, InitializeWithES3) {
EXPECT_TRUE(
info_->validators()->texture_internal_format.IsValid(GL_DEPTH_STENCIL));
EXPECT_TRUE(info_->validators()->texture_format.IsValid(GL_DEPTH_STENCIL));
+ EXPECT_TRUE(info_->feature_flags().chromium_sync_query);
+ EXPECT_TRUE(gfx::GLFence::IsSupported());
}
TEST_F(FeatureInfoTest, InitializeWithoutSamplers) {
@@ -1014,11 +1026,6 @@ TEST_F(FeatureInfoTest, InitializeWithoutSamplers) {
EXPECT_FALSE(info_->feature_flags().enable_samplers);
}
-TEST_F(FeatureInfoTest, InitializeWithES3AndFences) {
- SetupInitExpectationsWithGLVersion("EGL_KHR_fence_sync", "", "OpenGL ES 3.0");
- EXPECT_TRUE(info_->feature_flags().use_async_readpixels);
-}
-
TEST_F(FeatureInfoTest, ParseDriverBugWorkaroundsSingle) {
CommandLine command_line(0, NULL);
command_line.AppendSwitchASCII(
@@ -1043,5 +1050,27 @@ TEST_F(FeatureInfoTest, ParseDriverBugWorkaroundsMultiple) {
EXPECT_EQ(4096, info_->workarounds().max_texture_size);
}
+TEST_F(FeatureInfoTest, InitializeWithARBSync) {
+ SetupInitExpectations("GL_ARB_sync");
+ EXPECT_TRUE(info_->feature_flags().chromium_sync_query);
+ EXPECT_TRUE(gfx::GLFence::IsSupported());
+}
+
+TEST_F(FeatureInfoTest, InitializeWithNVFence) {
+ SetupInitExpectations("GL_NV_fence");
+ EXPECT_TRUE(info_->feature_flags().chromium_sync_query);
+ EXPECT_TRUE(gfx::GLFence::IsSupported());
+}
+
+TEST_F(FeatureInfoTest, ARBSyncDisabled) {
+ CommandLine command_line(0, NULL);
+ command_line.AppendSwitchASCII(
+ switches::kGpuDriverBugWorkarounds,
+ base::IntToString(gpu::DISABLE_ARB_SYNC));
+ SetupInitExpectationsWithCommandLine("GL_ARB_sync", command_line);
+ EXPECT_FALSE(info_->feature_flags().chromium_sync_query);
+ EXPECT_FALSE(gfx::GLFence::IsSupported());
+}
+
} // namespace gles2
} // namespace gpu
« no previous file with comments | « gpu/command_buffer/service/feature_info.cc ('k') | gpu/command_buffer/service/gpu_service_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698