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

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

Issue 560002: Fixed compile/link errors for gpu unit-tests. I had to mostly fix signed/unsi... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 10 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
« no previous file with comments | « no previous file | gpu/command_buffer/service/command_buffer_service_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "gpu/command_buffer/service/precompile.h" 7 #include "gpu/command_buffer/service/precompile.h"
8 8
9 #include "base/scoped_ptr.h" 9 #include "base/scoped_ptr.h"
10 #include "gpu/command_buffer/service/cmd_parser.h" 10 #include "gpu/command_buffer/service/cmd_parser.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 private: 63 private:
64 unsigned int buffer_entry_count_; 64 unsigned int buffer_entry_count_;
65 scoped_ptr<AsyncAPIMock> api_mock_; 65 scoped_ptr<AsyncAPIMock> api_mock_;
66 scoped_array<CommandBufferEntry> buffer_; 66 scoped_array<CommandBufferEntry> buffer_;
67 Sequence sequence_; 67 Sequence sequence_;
68 }; 68 };
69 69
70 // Tests initialization conditions. 70 // Tests initialization conditions.
71 TEST_F(CommandParserTest, TestInit) { 71 TEST_F(CommandParserTest, TestInit) {
72 scoped_ptr<CommandParser> parser(MakeParser(10)); 72 scoped_ptr<CommandParser> parser(MakeParser(10));
73 EXPECT_EQ(0u, parser->get()); 73 EXPECT_EQ(0, parser->get());
74 EXPECT_EQ(0u, parser->put()); 74 EXPECT_EQ(0, parser->put());
75 EXPECT_TRUE(parser->IsEmpty()); 75 EXPECT_TRUE(parser->IsEmpty());
76 } 76 }
77 77
78 // Tests simple commands. 78 // Tests simple commands.
79 TEST_F(CommandParserTest, TestSimple) { 79 TEST_F(CommandParserTest, TestSimple) {
80 scoped_ptr<CommandParser> parser(MakeParser(10)); 80 scoped_ptr<CommandParser> parser(MakeParser(10));
81 CommandBufferOffset put = parser->put(); 81 CommandBufferOffset put = parser->put();
82 CommandHeader header; 82 CommandHeader header;
83 83
84 // add a single command, no args 84 // add a single command, no args
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 // add 1 command with 1 arg (2 words). That should put us at the end of the 194 // add 1 command with 1 arg (2 words). That should put us at the end of the
195 // buffer. 195 // buffer.
196 header.size = 2; 196 header.size = 2;
197 header.command = 3; 197 header.command = 3;
198 buffer()[put++].value_header = header; 198 buffer()[put++].value_header = header;
199 buffer()[put++].value_int32 = 5; 199 buffer()[put++].value_int32 = 5;
200 CommandBufferEntry param; 200 CommandBufferEntry param;
201 param.value_int32 = 5; 201 param.value_int32 = 5;
202 AddDoCommandExpect(error::kNoError, 3, 1, &param); 202 AddDoCommandExpect(error::kNoError, 3, 1, &param);
203 203
204 DCHECK_EQ(5u, put); 204 DCHECK_EQ(5, put);
205 put = 0; 205 put = 0;
206 parser->set_put(put); 206 parser->set_put(put);
207 EXPECT_EQ(put, parser->put()); 207 EXPECT_EQ(put, parser->put());
208 EXPECT_EQ(error::kNoError, parser->ProcessAllCommands()); 208 EXPECT_EQ(error::kNoError, parser->ProcessAllCommands());
209 EXPECT_EQ(put, parser->get()); 209 EXPECT_EQ(put, parser->get());
210 Mock::VerifyAndClearExpectations(api_mock()); 210 Mock::VerifyAndClearExpectations(api_mock());
211 211
212 // add 1 command with 1 arg (2 words). 212 // add 1 command with 1 arg (2 words).
213 header.size = 2; 213 header.size = 2;
214 header.command = 4; 214 header.command = 4;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 EXPECT_EQ(put_post_fail, parser->get()); 279 EXPECT_EQ(put_post_fail, parser->get());
280 Mock::VerifyAndClearExpectations(api_mock()); 280 Mock::VerifyAndClearExpectations(api_mock());
281 // make the second one succeed, and check that the parser recovered fine. 281 // make the second one succeed, and check that the parser recovered fine.
282 AddDoCommandExpect(error::kNoError, 4, 0, NULL); 282 AddDoCommandExpect(error::kNoError, 4, 0, NULL);
283 EXPECT_EQ(error::kNoError, parser->ProcessAllCommands()); 283 EXPECT_EQ(error::kNoError, parser->ProcessAllCommands());
284 EXPECT_EQ(put, parser->get()); 284 EXPECT_EQ(put, parser->get());
285 Mock::VerifyAndClearExpectations(api_mock()); 285 Mock::VerifyAndClearExpectations(api_mock());
286 } 286 }
287 287
288 } // namespace gpu 288 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/service/command_buffer_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698