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

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

Issue 465099: Removed command buffer's last dependency on NPAPI.... (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. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright 2009, Google Inc. 2 * Copyright 2009, Google Inc.
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 CommandHeader header; 148 CommandHeader header;
149 149
150 // add 2 commands, test with single ProcessCommand() 150 // add 2 commands, test with single ProcessCommand()
151 header.size = 2; 151 header.size = 2;
152 header.command = 789; 152 header.command = 789;
153 buffer()[put++].value_header = header; 153 buffer()[put++].value_header = header;
154 buffer()[put++].value_int32 = 5151; 154 buffer()[put++].value_int32 = 5151;
155 155
156 CommandBufferOffset put_cmd2 = put; 156 CommandBufferOffset put_cmd2 = put;
157 header.size = 2; 157 header.size = 2;
158 header.command = 2121; 158 header.command = 876;
159 buffer()[put++].value_header = header; 159 buffer()[put++].value_header = header;
160 buffer()[put++].value_int32 = 3434; 160 buffer()[put++].value_int32 = 3434;
161 161
162 parser->set_put(put); 162 parser->set_put(put);
163 EXPECT_EQ(put, parser->put()); 163 EXPECT_EQ(put, parser->put());
164 164
165 CommandBufferEntry param_array[2]; 165 CommandBufferEntry param_array[2];
166 param_array[0].value_int32 = 5151; 166 param_array[0].value_int32 = 5151;
167 AddDoCommandExpect(parse_error::kParseNoError, 789, 1, param_array); 167 AddDoCommandExpect(parse_error::kParseNoError, 789, 1, param_array);
168 param_array[1].value_int32 = 3434; 168 param_array[1].value_int32 = 3434;
169 AddDoCommandExpect(parse_error::kParseNoError, 2121, 1, 169 AddDoCommandExpect(parse_error::kParseNoError, 876, 1,
170 param_array+1); 170 param_array+1);
171 171
172 EXPECT_EQ(parse_error::kParseNoError, parser->ProcessCommand()); 172 EXPECT_EQ(parse_error::kParseNoError, parser->ProcessCommand());
173 EXPECT_EQ(put_cmd2, parser->get()); 173 EXPECT_EQ(put_cmd2, parser->get());
174 EXPECT_EQ(parse_error::kParseNoError, parser->ProcessCommand()); 174 EXPECT_EQ(parse_error::kParseNoError, parser->ProcessCommand());
175 EXPECT_EQ(put, parser->get()); 175 EXPECT_EQ(put, parser->get());
176 Mock::VerifyAndClearExpectations(api_mock()); 176 Mock::VerifyAndClearExpectations(api_mock());
177 177
178 // add 2 commands again, test with ProcessAllCommands() 178 // add 2 commands again, test with ProcessAllCommands()
179 header.size = 2; 179 header.size = 2;
180 header.command = 4545; 180 header.command = 123;
181 buffer()[put++].value_header = header; 181 buffer()[put++].value_header = header;
182 buffer()[put++].value_int32 = 5656; 182 buffer()[put++].value_int32 = 5656;
183 183
184 header.size = 2; 184 header.size = 2;
185 header.command = 6767; 185 header.command = 321;
186 buffer()[put++].value_header = header; 186 buffer()[put++].value_header = header;
187 buffer()[put++].value_int32 = 7878; 187 buffer()[put++].value_int32 = 7878;
188 188
189 parser->set_put(put); 189 parser->set_put(put);
190 EXPECT_EQ(put, parser->put()); 190 EXPECT_EQ(put, parser->put());
191 191
192 param_array[0].value_int32 = 5656; 192 param_array[0].value_int32 = 5656;
193 AddDoCommandExpect(parse_error::kParseNoError, 4545, 1, param_array); 193 AddDoCommandExpect(parse_error::kParseNoError, 123, 1, param_array);
194 param_array[1].value_int32 = 7878; 194 param_array[1].value_int32 = 7878;
195 AddDoCommandExpect(parse_error::kParseNoError, 6767, 1, 195 AddDoCommandExpect(parse_error::kParseNoError, 321, 1,
196 param_array+1); 196 param_array+1);
197 197
198 EXPECT_EQ(parse_error::kParseNoError, parser->ProcessAllCommands()); 198 EXPECT_EQ(parse_error::kParseNoError, parser->ProcessAllCommands());
199 EXPECT_EQ(put, parser->get()); 199 EXPECT_EQ(put, parser->get());
200 Mock::VerifyAndClearExpectations(api_mock()); 200 Mock::VerifyAndClearExpectations(api_mock());
201 } 201 }
202 202
203 // Tests that the parser will wrap correctly at the end of the buffer. 203 // Tests that the parser will wrap correctly at the end of the buffer.
204 TEST_F(CommandParserTest, TestWrap) { 204 TEST_F(CommandParserTest, TestWrap) {
205 scoped_ptr<CommandParser> parser(MakeParser(5)); 205 scoped_ptr<CommandParser> parser(MakeParser(5));
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 EXPECT_EQ(put_post_fail, parser->get()); 307 EXPECT_EQ(put_post_fail, parser->get());
308 Mock::VerifyAndClearExpectations(api_mock()); 308 Mock::VerifyAndClearExpectations(api_mock());
309 // make the second one succeed, and check that the parser recovered fine. 309 // make the second one succeed, and check that the parser recovered fine.
310 AddDoCommandExpect(parse_error::kParseNoError, 4, 0, NULL); 310 AddDoCommandExpect(parse_error::kParseNoError, 4, 0, NULL);
311 EXPECT_EQ(parse_error::kParseNoError, parser->ProcessAllCommands()); 311 EXPECT_EQ(parse_error::kParseNoError, parser->ProcessAllCommands());
312 EXPECT_EQ(put, parser->get()); 312 EXPECT_EQ(put, parser->get());
313 Mock::VerifyAndClearExpectations(api_mock()); 313 Mock::VerifyAndClearExpectations(api_mock());
314 } 314 }
315 315
316 } // namespace command_buffer 316 } // namespace command_buffer
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/gles2_demo.cc ('k') | gpu/command_buffer/service/command_buffer_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698