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

Side by Side Diff: gpu/command_buffer/service/cmd_parser_test.cc

Issue 7253052: Execute all GL commands up to the put offset reported by a flush. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Tests for the command parser. 5 // Tests for the command parser.
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "gpu/command_buffer/service/cmd_parser.h" 9 #include "gpu/command_buffer/service/cmd_parser.h"
10 #include "gpu/command_buffer/service/mocks.h" 10 #include "gpu/command_buffer/service/mocks.h"
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 // correctly. 281 // correctly.
282 EXPECT_EQ(put_post_fail, parser->get()); 282 EXPECT_EQ(put_post_fail, parser->get());
283 Mock::VerifyAndClearExpectations(api_mock()); 283 Mock::VerifyAndClearExpectations(api_mock());
284 // make the second one succeed, and check that the parser recovered fine. 284 // make the second one succeed, and check that the parser recovered fine.
285 AddDoCommandExpect(error::kNoError, 4, 0, NULL); 285 AddDoCommandExpect(error::kNoError, 4, 0, NULL);
286 EXPECT_EQ(error::kNoError, parser->ProcessAllCommands()); 286 EXPECT_EQ(error::kNoError, parser->ProcessAllCommands());
287 EXPECT_EQ(put, parser->get()); 287 EXPECT_EQ(put, parser->get());
288 Mock::VerifyAndClearExpectations(api_mock()); 288 Mock::VerifyAndClearExpectations(api_mock());
289 } 289 }
290 290
291 TEST_F(CommandParserTest, TestWaiting) {
292 const unsigned int kNumEntries = 5;
293 scoped_ptr<CommandParser> parser(MakeParser(kNumEntries));
294 CommandBufferOffset put = parser->put();
295 CommandHeader header;
296
297 // Generate a command with size 1.
298 header.size = 1;
299 header.command = 3;
300 buffer()[put++].value_header = header;
301
302 parser->set_put(put);
303 // A command that returns kWaiting should not advance the get pointer.
304 AddDoCommandExpect(error::kWaiting, 3, 0, NULL);
305 EXPECT_EQ(error::kWaiting, parser->ProcessAllCommands());
306 EXPECT_EQ(0, parser->get());
307 Mock::VerifyAndClearExpectations(api_mock());
308 // Not waiting should advance the get pointer.
309 AddDoCommandExpect(error::kNoError, 3, 0, NULL);
310 EXPECT_EQ(error::kNoError, parser->ProcessAllCommands());
311 EXPECT_EQ(put, parser->get());
312 Mock::VerifyAndClearExpectations(api_mock());
313 }
314
315 } // namespace gpu 291 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/cmd_parser.cc ('k') | gpu/command_buffer/service/command_buffer_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698