| OLD | NEW |
| 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" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 12 #include "third_party/skia/include/core/SkBitmap.h" |
| 13 #include "SkBitmap.h" | |
| 14 | 13 |
| 15 // Tests that serialize/deserialize correctly understand each other | 14 // Tests that serialize/deserialize correctly understand each other |
| 16 TEST(IPCMessageTest, Serialize) { | 15 TEST(IPCMessageTest, Serialize) { |
| 17 const char* serialize_cases[] = { | 16 const char* serialize_cases[] = { |
| 18 "http://www.google.com/", | 17 "http://www.google.com/", |
| 19 "http://user:pass@host.com:888/foo;bar?baz#nop", | 18 "http://user:pass@host.com:888/foo;bar?baz#nop", |
| 20 "#inva://idurl/", | 19 "#inva://idurl/", |
| 21 }; | 20 }; |
| 22 | 21 |
| 23 for (size_t i = 0; i < arraysize(serialize_cases); i++) { | 22 for (size_t i = 0; i < arraysize(serialize_cases); i++) { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 // Add some bogus pixel data. | 84 // Add some bogus pixel data. |
| 86 const size_t bogus_pixels_size = bitmap.getSize() * 2; | 85 const size_t bogus_pixels_size = bitmap.getSize() * 2; |
| 87 scoped_array<char> bogus_pixels(new char[bogus_pixels_size]); | 86 scoped_array<char> bogus_pixels(new char[bogus_pixels_size]); |
| 88 memset(bogus_pixels.get(), 'B', bogus_pixels_size); | 87 memset(bogus_pixels.get(), 'B', bogus_pixels_size); |
| 89 bad_msg.WriteData(bogus_pixels.get(), bogus_pixels_size); | 88 bad_msg.WriteData(bogus_pixels.get(), bogus_pixels_size); |
| 90 // Make sure we don't read out the bitmap! | 89 // Make sure we don't read out the bitmap! |
| 91 SkBitmap bad_output; | 90 SkBitmap bad_output; |
| 92 iter = NULL; | 91 iter = NULL; |
| 93 EXPECT_FALSE(IPC::ParamTraits<SkBitmap>::Read(&bad_msg, &iter, &bad_output)); | 92 EXPECT_FALSE(IPC::ParamTraits<SkBitmap>::Read(&bad_msg, &iter, &bad_output)); |
| 94 } | 93 } |
| OLD | NEW |