summaryrefslogtreecommitdiffstats
path: root/gpu/command_buffer/service
diff options
context:
space:
mode:
authorkbr@google.com <kbr@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-26 18:39:05 +0000
committerkbr@google.com <kbr@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-26 18:39:05 +0000
commit304b4a5c92e957f089bf9366445d43f610b25571 (patch)
tree1930e84332e9d09cc200b9d6098e40ba74e0cbf9 /gpu/command_buffer/service
parentaefdb477a4fb4ee11b85d2e8fa265aea531d8bf5 (diff)
downloadchromium_src-304b4a5c92e957f089bf9366445d43f610b25571.zip
chromium_src-304b4a5c92e957f089bf9366445d43f610b25571.tar.gz
chromium_src-304b4a5c92e957f089bf9366445d43f610b25571.tar.bz2
Fixed GPU unit tests on Mac.
- Added mocks for Mac-specific methods - Conditionally declared storage for static const integer values in classes - Deleted unused variables BUG=none TEST=ran GPU unit tests on Mac Review URL: http://codereview.chromium.org/1376002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42787 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/command_buffer/service')
-rw-r--r--gpu/command_buffer/service/framebuffer_manager_unittest.cc1
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc4
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_mock.h7
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc69
-rw-r--r--gpu/command_buffer/service/program_manager_unittest.cc31
-rw-r--r--gpu/command_buffer/service/renderbuffer_manager_unittest.cc1
-rw-r--r--gpu/command_buffer/service/texture_manager_unittest.cc8
7 files changed, 118 insertions, 3 deletions
diff --git a/gpu/command_buffer/service/framebuffer_manager_unittest.cc b/gpu/command_buffer/service/framebuffer_manager_unittest.cc
index 29cc31c..36bbbe9 100644
--- a/gpu/command_buffer/service/framebuffer_manager_unittest.cc
+++ b/gpu/command_buffer/service/framebuffer_manager_unittest.cc
@@ -25,7 +25,6 @@ class FramebufferManagerTest : public testing::Test {
TEST_F(FramebufferManagerTest, Basic) {
const GLuint kFramebuffer1Id = 1;
- const GLsizeiptr kFramebuffer1Size = 123;
const GLuint kFramebuffer2Id = 2;
// Check we can create framebuffer.
manager_.CreateFramebufferInfo(kFramebuffer1Id);
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 23c3423..92b1312 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -1591,7 +1591,9 @@ void GLES2DecoderImpl::UnregisterObjects(
}
bool GLES2DecoderImpl::InitPlatformSpecific() {
+#if !defined(UNIT_TEST)
bool offscreen = pending_size_.width() > 0 && pending_size_.height() > 0;
+#endif
#if defined(UNIT_TEST)
#elif defined(GLES2_GPU_SERVICE_BACKEND_NATIVE_GLES2)
#elif defined(OS_WIN)
@@ -1861,7 +1863,9 @@ TransportDIB::Handle GLES2DecoderImpl::SetWindowSizeForTransportDIB(
void GLES2DecoderImpl::SetTransportDIBAllocAndFree(
Callback2<size_t, TransportDIB::Handle*>::Type* allocator,
Callback1<TransportDIB::Id>::Type* deallocator) {
+#if !defined(UNIT_TEST)
surface_.SetTransportDIBAllocAndFree(allocator, deallocator);
+#endif
}
#endif // defined(OS_MACOSX)
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_mock.h b/gpu/command_buffer/service/gles2_cmd_decoder_mock.h
index f94eb7d..4ba9217 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_mock.h
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_mock.h
@@ -27,7 +27,12 @@ class MockGLES2Decoder : public GLES2Decoder {
}
#if defined(OS_MACOSX)
- MOCK_METHOD2(SetWindowSize, uint64(int32 width, int32 height));
+ MOCK_METHOD2(SetWindowSizeForIOSurface, uint64(int32 width, int32 height));
+ MOCK_METHOD2(SetWindowSizeForTransportDIB,
+ TransportDIB::Handle(int32 width, int32 height));
+ MOCK_METHOD2(SetTransportDIBAllocAndFree,
+ void(Callback2<size_t, TransportDIB::Handle*>::Type* allocator,
+ Callback1<TransportDIB::Id>::Type* deallocator));
#endif
MOCK_METHOD3(Initialize, bool(GLES2Decoder* parent,
const gfx::Size& size,
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
index 10acd1b..ffe6cf0 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
@@ -219,6 +219,37 @@ void GLES2DecoderTestBase::DoTexImage2D(
EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
}
+// GCC requires these declarations, but MSVC requires they not be present
+#ifndef COMPILER_MSVC
+const GLint GLES2DecoderTestBase::kMaxTextureSize;
+const GLint GLES2DecoderTestBase::kMaxCubeMapTextureSize;
+const GLint GLES2DecoderTestBase::kNumVertexAttribs;
+const GLint GLES2DecoderTestBase::kNumTextureUnits;
+
+const GLuint GLES2DecoderTestBase::kServiceBlackTexture2dId;
+const GLuint GLES2DecoderTestBase::kServiceBlackTextureCubemapId;
+
+const GLuint GLES2DecoderTestBase::kServiceBufferId;
+const GLuint GLES2DecoderTestBase::kServiceFramebufferId;
+const GLuint GLES2DecoderTestBase::kServiceRenderbufferId;
+const GLuint GLES2DecoderTestBase::kServiceTextureId;
+const GLuint GLES2DecoderTestBase::kServiceProgramId;
+const GLuint GLES2DecoderTestBase::kServiceShaderId;
+const GLuint GLES2DecoderTestBase::kServiceElementBufferId;
+
+const int32 GLES2DecoderTestBase::kSharedMemoryId;
+const size_t GLES2DecoderTestBase::kSharedBufferSize;
+const uint32 GLES2DecoderTestBase::kSharedMemoryOffset;
+const int32 GLES2DecoderTestBase::kInvalidSharedMemoryId;
+const uint32 GLES2DecoderTestBase::kInvalidSharedMemoryOffset;
+const uint32 GLES2DecoderTestBase::kInitialResult;
+const uint8 GLES2DecoderTestBase::kInitialMemoryValue;
+
+const uint32 GLES2DecoderTestBase::kNewClientId;
+const uint32 GLES2DecoderTestBase::kNewServiceId;
+const uint32 GLES2DecoderTestBase::kInvalidClientId;
+#endif
+
void GLES2DecoderWithShaderTestBase::SetUp() {
GLES2DecoderTestBase::SetUp();
@@ -448,6 +479,44 @@ void GLES2DecoderWithShaderTestBase::DeleteIndexBuffer() {
DoDeleteBuffer(client_element_buffer_id_, kServiceElementBufferId);
}
+// GCC requires these declarations, but MSVC requires they not be present
+#ifndef COMPILER_MSVC
+const GLsizei GLES2DecoderWithShaderTestBase::kNumVertices;
+const GLsizei GLES2DecoderWithShaderTestBase::kNumIndices;
+const int GLES2DecoderWithShaderTestBase::kValidIndexRangeStart;
+const int GLES2DecoderWithShaderTestBase::kValidIndexRangeCount;
+const int GLES2DecoderWithShaderTestBase::kInvalidIndexRangeStart;
+const int GLES2DecoderWithShaderTestBase::kInvalidIndexRangeCount;
+const int GLES2DecoderWithShaderTestBase::kOutOfRangeIndexRangeEnd;
+
+const GLint GLES2DecoderWithShaderTestBase::kMaxAttribLength;
+const GLint GLES2DecoderWithShaderTestBase::kAttrib1Size;
+const GLint GLES2DecoderWithShaderTestBase::kAttrib2Size;
+const GLint GLES2DecoderWithShaderTestBase::kAttrib3Size;
+const GLint GLES2DecoderWithShaderTestBase::kAttrib1Location;
+const GLint GLES2DecoderWithShaderTestBase::kAttrib2Location;
+const GLint GLES2DecoderWithShaderTestBase::kAttrib3Location;
+const GLenum GLES2DecoderWithShaderTestBase::kAttrib1Type;
+const GLenum GLES2DecoderWithShaderTestBase::kAttrib2Type;
+const GLenum GLES2DecoderWithShaderTestBase::kAttrib3Type;
+const GLint GLES2DecoderWithShaderTestBase::kInvalidAttribLocation;
+const GLint GLES2DecoderWithShaderTestBase::kBadAttribIndex;
+
+const GLint GLES2DecoderWithShaderTestBase::kMaxUniformLength;
+const GLint GLES2DecoderWithShaderTestBase::kUniform1Size;
+const GLint GLES2DecoderWithShaderTestBase::kUniform2Size;
+const GLint GLES2DecoderWithShaderTestBase::kUniform3Size;
+const GLint GLES2DecoderWithShaderTestBase::kUniform1Location;
+const GLint GLES2DecoderWithShaderTestBase::kUniform2Location;
+const GLint GLES2DecoderWithShaderTestBase::kUniform2ElementLocation;
+const GLint GLES2DecoderWithShaderTestBase::kUniform3Location;
+const GLenum GLES2DecoderWithShaderTestBase::kUniform1Type;
+const GLenum GLES2DecoderWithShaderTestBase::kUniform2Type;
+const GLenum GLES2DecoderWithShaderTestBase::kUniform3Type;
+const GLint GLES2DecoderWithShaderTestBase::kInvalidUniformLocation;
+const GLint GLES2DecoderWithShaderTestBase::kBadUniformIndex;
+#endif
+
const char* GLES2DecoderWithShaderTestBase::kAttrib1Name = "attrib1";
const char* GLES2DecoderWithShaderTestBase::kAttrib2Name = "attrib2";
const char* GLES2DecoderWithShaderTestBase::kAttrib3Name = "attrib3";
diff --git a/gpu/command_buffer/service/program_manager_unittest.cc b/gpu/command_buffer/service/program_manager_unittest.cc
index b75b628..2ec65f8 100644
--- a/gpu/command_buffer/service/program_manager_unittest.cc
+++ b/gpu/command_buffer/service/program_manager_unittest.cc
@@ -222,6 +222,37 @@ ProgramManagerWithShaderTest::AttribInfo
{ kAttrib3Name, kAttrib3Size, kAttrib3Type, kAttrib3Location, },
};
+// GCC requires these declarations, but MSVC requires they not be present
+#ifndef COMPILER_MSVC
+const GLint ProgramManagerWithShaderTest::kNumVertexAttribs;
+const GLuint ProgramManagerWithShaderTest::kProgramId;
+const GLint ProgramManagerWithShaderTest::kMaxAttribLength;
+const GLint ProgramManagerWithShaderTest::kAttrib1Size;
+const GLint ProgramManagerWithShaderTest::kAttrib2Size;
+const GLint ProgramManagerWithShaderTest::kAttrib3Size;
+const GLint ProgramManagerWithShaderTest::kAttrib1Location;
+const GLint ProgramManagerWithShaderTest::kAttrib2Location;
+const GLint ProgramManagerWithShaderTest::kAttrib3Location;
+const GLenum ProgramManagerWithShaderTest::kAttrib1Type;
+const GLenum ProgramManagerWithShaderTest::kAttrib2Type;
+const GLenum ProgramManagerWithShaderTest::kAttrib3Type;
+const GLint ProgramManagerWithShaderTest::kInvalidAttribLocation;
+const GLint ProgramManagerWithShaderTest::kBadAttribIndex;
+const GLint ProgramManagerWithShaderTest::kMaxUniformLength;
+const GLint ProgramManagerWithShaderTest::kUniform1Size;
+const GLint ProgramManagerWithShaderTest::kUniform2Size;
+const GLint ProgramManagerWithShaderTest::kUniform3Size;
+const GLint ProgramManagerWithShaderTest::kUniform1Location;
+const GLint ProgramManagerWithShaderTest::kUniform2Location;
+const GLint ProgramManagerWithShaderTest::kUniform2ElementLocation;
+const GLint ProgramManagerWithShaderTest::kUniform3Location;
+const GLenum ProgramManagerWithShaderTest::kUniform1Type;
+const GLenum ProgramManagerWithShaderTest::kUniform2Type;
+const GLenum ProgramManagerWithShaderTest::kUniform3Type;
+const GLint ProgramManagerWithShaderTest::kInvalidUniformLocation;
+const GLint ProgramManagerWithShaderTest::kBadUniformIndex;
+#endif
+
const size_t ProgramManagerWithShaderTest::kNumAttribs =
arraysize(ProgramManagerWithShaderTest::kAttribs);
diff --git a/gpu/command_buffer/service/renderbuffer_manager_unittest.cc b/gpu/command_buffer/service/renderbuffer_manager_unittest.cc
index 3582924..7f9d064 100644
--- a/gpu/command_buffer/service/renderbuffer_manager_unittest.cc
+++ b/gpu/command_buffer/service/renderbuffer_manager_unittest.cc
@@ -25,7 +25,6 @@ class RenderbufferManagerTest : public testing::Test {
TEST_F(RenderbufferManagerTest, Basic) {
const GLuint kRenderbuffer1Id = 1;
- const GLsizeiptr kRenderbuffer1Size = 123;
const GLuint kRenderbuffer2Id = 2;
// Check we can create renderbuffer.
manager_.CreateRenderbufferInfo(kRenderbuffer1Id);
diff --git a/gpu/command_buffer/service/texture_manager_unittest.cc b/gpu/command_buffer/service/texture_manager_unittest.cc
index d80af31..0383864a 100644
--- a/gpu/command_buffer/service/texture_manager_unittest.cc
+++ b/gpu/command_buffer/service/texture_manager_unittest.cc
@@ -29,6 +29,14 @@ class TextureManagerTest : public testing::Test {
TextureManager manager_;
};
+// GCC requires these declarations, but MSVC requires they not be present
+#ifndef COMPILER_MSVC
+const GLint TextureManagerTest::kMaxTextureSize;
+const GLint TextureManagerTest::kMaxCubeMapTextureSize;
+const GLint TextureManagerTest::kMax2dLevels;
+const GLint TextureManagerTest::kMaxCubeMapLevels;
+#endif
+
TEST_F(TextureManagerTest, Basic) {
const GLuint kTexture1Id = 1;
const GLuint kTexture2Id = 2;