Chromium Code Reviews

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

Issue 367002: Added Pepper 3D render context that instantiates the GPU plugin.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « gpu/command_buffer/service/command_buffer_service.cc ('k') | gpu/command_buffer/service/common_decoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/command_buffer_service_unittest.cc
===================================================================
--- gpu/command_buffer/service/command_buffer_service_unittest.cc (revision 35153)
+++ gpu/command_buffer/service/command_buffer_service_unittest.cc (working copy)
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "base/thread.h"
+#include "gpu/command_buffer/common/cmd_buffer_common.h"
#include "gpu/command_buffer/service/command_buffer_service.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -26,20 +27,28 @@
};
TEST_F(CommandBufferServiceTest, NullRingBufferByDefault) {
- EXPECT_TRUE(NULL == command_buffer_->GetRingBuffer());
+ EXPECT_TRUE(NULL == command_buffer_->GetRingBuffer().ptr);
}
TEST_F(CommandBufferServiceTest, InitializesCommandBuffer) {
- base::SharedMemory* ring_buffer = command_buffer_->Initialize(1024);
- EXPECT_TRUE(NULL != ring_buffer);
- EXPECT_EQ(ring_buffer, command_buffer_->GetRingBuffer());
- EXPECT_GT(command_buffer_->GetSize(), 0);
+ EXPECT_TRUE(command_buffer_->Initialize(1024));
+ EXPECT_TRUE(NULL != command_buffer_->GetRingBuffer().ptr);
+ EXPECT_EQ(1024, command_buffer_->GetSize());
+ EXPECT_EQ(1024 * sizeof(CommandBufferEntry),
+ command_buffer_->GetRingBuffer().size);
}
+TEST_F(CommandBufferServiceTest, InitializationSizeIsInEntriesNotBytes) {
+ EXPECT_TRUE(command_buffer_->Initialize(1024));
+ EXPECT_TRUE(NULL != command_buffer_->GetRingBuffer().ptr);
+ EXPECT_GE(1024 * sizeof(CommandBufferEntry),
+ command_buffer_->GetRingBuffer().size);
+}
+
TEST_F(CommandBufferServiceTest, InitializeFailsSecondTime) {
SharedMemory* ring_buffer = new SharedMemory;
- EXPECT_TRUE(NULL != command_buffer_->Initialize(1024));
- EXPECT_TRUE(NULL == command_buffer_->Initialize(1024));
+ EXPECT_TRUE(command_buffer_->Initialize(1024));
+ EXPECT_FALSE(command_buffer_->Initialize(1024));
}
TEST_F(CommandBufferServiceTest, GetAndPutOffsetsDefaultToZero) {
@@ -77,23 +86,23 @@
}
TEST_F(CommandBufferServiceTest, ZeroHandleMapsToNull) {
- EXPECT_TRUE(NULL == command_buffer_->GetTransferBuffer(0));
+ EXPECT_TRUE(NULL == command_buffer_->GetTransferBuffer(0).ptr);
}
TEST_F(CommandBufferServiceTest, NegativeHandleMapsToNull) {
- EXPECT_TRUE(NULL == command_buffer_->GetTransferBuffer(-1));
+ EXPECT_TRUE(NULL == command_buffer_->GetTransferBuffer(-1).ptr);
}
TEST_F(CommandBufferServiceTest, OutOfRangeHandleMapsToNull) {
- EXPECT_TRUE(NULL == command_buffer_->GetTransferBuffer(1));
+ EXPECT_TRUE(NULL == command_buffer_->GetTransferBuffer(1).ptr);
}
TEST_F(CommandBufferServiceTest, CanCreateTransferBuffers) {
int32 handle = command_buffer_->CreateTransferBuffer(1024);
EXPECT_EQ(1, handle);
- SharedMemory* buffer = command_buffer_->GetTransferBuffer(handle);
- ASSERT_TRUE(NULL != buffer);
- EXPECT_EQ(1024, buffer->max_size());
+ Buffer buffer = command_buffer_->GetTransferBuffer(handle);
+ ASSERT_TRUE(NULL != buffer.ptr);
+ EXPECT_EQ(1024, buffer.size);
}
TEST_F(CommandBufferServiceTest, CreateTransferBufferReturnsDistinctHandles) {
@@ -111,7 +120,7 @@
TEST_F(CommandBufferServiceTest, CannotUnregisterHandleZero) {
command_buffer_->DestroyTransferBuffer(0);
- EXPECT_TRUE(NULL == command_buffer_->GetTransferBuffer(0));
+ EXPECT_TRUE(NULL == command_buffer_->GetTransferBuffer(0).ptr);
EXPECT_EQ(1, command_buffer_->CreateTransferBuffer(1024));
}
« no previous file with comments | « gpu/command_buffer/service/command_buffer_service.cc ('k') | gpu/command_buffer/service/common_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine