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

Side by Side Diff: chrome/common/ipc_message_unittest.cc

Issue 92118: Merge r14413. (Closed) Base URL: svn://chrome-svn/chrome/branches/release_154.next/src/
Patch Set: Created 11 years, 8 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 | no next file » | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 <string.h> 5 #include <string.h>
6 6
7 #include "chrome/common/ipc_message.h" 7 #include "chrome/common/ipc_message.h"
8 #include "chrome/common/ipc_message_utils.h" 8 #include "chrome/common/ipc_message_utils.h"
9 #include "base/scoped_ptr.h" 9 #include "base/scoped_ptr.h"
10 #include "googleurl/src/gurl.h" 10 #include "googleurl/src/gurl.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 // Also test the corrupt case. 77 // Also test the corrupt case.
78 IPC::Message bad_msg(1, 2, IPC::Message::PRIORITY_NORMAL); 78 IPC::Message bad_msg(1, 2, IPC::Message::PRIORITY_NORMAL);
79 // Copy the first message block over to |bad_msg|. 79 // Copy the first message block over to |bad_msg|.
80 const char* fixed_data; 80 const char* fixed_data;
81 int fixed_data_size; 81 int fixed_data_size;
82 iter = NULL; 82 iter = NULL;
83 msg.ReadData(&iter, &fixed_data, &fixed_data_size); 83 msg.ReadData(&iter, &fixed_data, &fixed_data_size);
84 bad_msg.WriteData(fixed_data, fixed_data_size); 84 bad_msg.WriteData(fixed_data, fixed_data_size);
85 // Add some bogus pixel data. 85 // Add some bogus pixel data.
86 const size_t bogus_pixels_size = bitmap.getSize() * 2; 86 const size_t bogus_pixels_size = bitmap.getSize() * 2;
87 scoped_ptr<char> bogus_pixels(new char[bogus_pixels_size]); 87 scoped_array<char> bogus_pixels(new char[bogus_pixels_size]);
88 memset(bogus_pixels.get(), 'B', bogus_pixels_size); 88 memset(bogus_pixels.get(), 'B', bogus_pixels_size);
89 bad_msg.WriteData(bogus_pixels.get(), bogus_pixels_size); 89 bad_msg.WriteData(bogus_pixels.get(), bogus_pixels_size);
90 // Make sure we don't read out the bitmap! 90 // Make sure we don't read out the bitmap!
91 SkBitmap bad_output; 91 SkBitmap bad_output;
92 iter = NULL; 92 iter = NULL;
93 EXPECT_FALSE(IPC::ParamTraits<SkBitmap>::Read(&bad_msg, &iter, &bad_output)); 93 EXPECT_FALSE(IPC::ParamTraits<SkBitmap>::Read(&bad_msg, &iter, &bad_output));
94 } 94 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698