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

Side by Side Diff: content/common/cc_messages_unittest.cc

Issue 11617006: Add some bounds for gfx ipc deserialization. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 11 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "content/common/cc_messages.h" 5 #include "content/common/cc_messages.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "cc/compositor_frame.h" 9 #include "cc/compositor_frame.h"
10 #include "ipc/ipc_message.h" 10 #include "ipc/ipc_message.h"
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 GLbyte arbitrary_mailbox2[64] = { 460 GLbyte arbitrary_mailbox2[64] = {
461 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0, 461 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0,
462 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0, 462 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0,
463 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0, 463 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0,
464 0, 9, 8, 7 464 0, 9, 8, 7
465 }; 465 };
466 466
467 TransferableResource arbitrary_resource1; 467 TransferableResource arbitrary_resource1;
468 arbitrary_resource1.id = 2178312; 468 arbitrary_resource1.id = 2178312;
469 arbitrary_resource1.format = 7; 469 arbitrary_resource1.format = 7;
470 arbitrary_resource1.size = gfx::Size(37189, 123123); 470 arbitrary_resource1.size = gfx::Size(3718, 12312);
471 arbitrary_resource1.mailbox.setName(arbitrary_mailbox1); 471 arbitrary_resource1.mailbox.setName(arbitrary_mailbox1);
472 472
473 TransferableResource arbitrary_resource2; 473 TransferableResource arbitrary_resource2;
474 arbitrary_resource2.id = 789132; 474 arbitrary_resource2.id = 789132;
475 arbitrary_resource2.format = 30; 475 arbitrary_resource2.format = 30;
476 arbitrary_resource2.size = gfx::Size(89123, 23789); 476 arbitrary_resource2.size = gfx::Size(8912, 23789);
477 arbitrary_resource2.mailbox.setName(arbitrary_mailbox2); 477 arbitrary_resource2.mailbox.setName(arbitrary_mailbox2);
478 478
479 DelegatedFrameData frame_in; 479 DelegatedFrameData frame_in;
480 frame_in.size = arbitrary_size; 480 frame_in.size = arbitrary_size;
481 481
482 frame_in.resource_list.sync_point = arbitrary_uint; 482 frame_in.resource_list.sync_point = arbitrary_uint;
483 frame_in.resource_list.resources.push_back(arbitrary_resource1); 483 frame_in.resource_list.resources.push_back(arbitrary_resource1);
484 frame_in.resource_list.resources.push_back(arbitrary_resource2); 484 frame_in.resource_list.resources.push_back(arbitrary_resource2);
485 485
486 IPC::ParamTraits<DelegatedFrameData>::Write(&msg, frame_in); 486 IPC::ParamTraits<DelegatedFrameData>::Write(&msg, frame_in);
487 487
488 DelegatedFrameData frame_out; 488 DelegatedFrameData frame_out;
489 PickleIterator iter(msg); 489 PickleIterator iter(msg);
490 EXPECT_TRUE(IPC::ParamTraits<DelegatedFrameData>::Read(&msg, 490 EXPECT_TRUE(IPC::ParamTraits<DelegatedFrameData>::Read(&msg,
491 &iter, &frame_out)); 491 &iter, &frame_out));
492 492
493 EXPECT_EQ(arbitrary_size.ToString(), frame_out.size.ToString()); 493 EXPECT_EQ(arbitrary_size.ToString(), frame_out.size.ToString());
494 EXPECT_EQ(arbitrary_uint, frame_out.resource_list.sync_point); 494 EXPECT_EQ(arbitrary_uint, frame_out.resource_list.sync_point);
495 495
496 EXPECT_EQ(2u, frame_out.resource_list.resources.size()); 496 EXPECT_EQ(2u, frame_out.resource_list.resources.size());
497 Compare(arbitrary_resource1, frame_out.resource_list.resources[0]); 497 Compare(arbitrary_resource1, frame_out.resource_list.resources[0]);
498 Compare(arbitrary_resource2, frame_out.resource_list.resources[1]); 498 Compare(arbitrary_resource2, frame_out.resource_list.resources[1]);
499 } 499 }
500 500
501 } // namespace 501 } // namespace
502 } // namespace content 502 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/public/common/common_param_traits.cc » ('j') | content/public/common/common_param_traits.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698