summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorgman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-09 19:36:32 +0000
committergman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-09 19:36:32 +0000
commit5e4d24d67febed160e2020f5c8f13d8073921fc4 (patch)
treea7bf338152224e5e30e11bcee4c0e64c3b12f8a4 /gpu
parent8c996fc152cc5de0a2a1e573d339b668115cdd00 (diff)
downloadchromium_src-5e4d24d67febed160e2020f5c8f13d8073921fc4.zip
chromium_src-5e4d24d67febed160e2020f5c8f13d8073921fc4.tar.gz
chromium_src-5e4d24d67febed160e2020f5c8f13d8073921fc4.tar.bz2
Add command buffer test for case where command inserted
exactly matches the space left in the command buffer. TEST=unit test BUG=none Review URL: http://codereview.chromium.org/672009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41066 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r--gpu/command_buffer/client/cmd_buffer_helper_test.cc26
1 files changed, 25 insertions, 1 deletions
diff --git a/gpu/command_buffer/client/cmd_buffer_helper_test.cc b/gpu/command_buffer/client/cmd_buffer_helper_test.cc
index 7ababa2..afbb117 100644
--- a/gpu/command_buffer/client/cmd_buffer_helper_test.cc
+++ b/gpu/command_buffer/client/cmd_buffer_helper_test.cc
@@ -180,7 +180,7 @@ TEST_F(CommandBufferHelperTest, TestCommandProcessing) {
TEST_F(CommandBufferHelperTest, TestCommandWrapping) {
// Add 5 commands of size 3 through the helper to make sure we do wrap.
CommandBufferEntry args1[2];
- args1[0].value_uint32 = 3;
+ args1[0].value_uint32 = 5;
args1[1].value_float = 4.f;
for (unsigned int i = 0; i < 5; ++i) {
@@ -195,6 +195,30 @@ TEST_F(CommandBufferHelperTest, TestCommandWrapping) {
EXPECT_EQ(error::kNoError, GetError());
}
+// Checks the case where the command inserted exactly matches the space left in
+// the command buffer.
+TEST_F(CommandBufferHelperTest, TestCommandWrappingExactMultiple) {
+ const int32 kCommandSize = 5;
+ const int32 kNumArgs = kCommandSize - 1;
+ COMPILE_ASSERT(kNumCommandEntries % kCommandSize == 0,
+ Not_multiple_of_num_command_entries);
+ CommandBufferEntry args1[kNumArgs];
+ for (size_t ii = 0; ii < kNumArgs; ++ii) {
+ args1[0].value_uint32 = ii + 1;
+ }
+
+ for (unsigned int i = 0; i < 5; ++i) {
+ AddCommandWithExpect(error::kNoError, i + 1, kNumArgs, args1);
+ }
+
+ helper_->Finish();
+ // Check that the commands did happen.
+ Mock::VerifyAndClearExpectations(api_mock_.get());
+
+ // Check the error status.
+ EXPECT_EQ(error::kNoError, GetError());
+}
+
// Checks that asking for available entries work, and that the parser
// effectively won't use that space.
TEST_F(CommandBufferHelperTest, TestAvailableEntries) {