| OLD | NEW |
| 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 <string.h> | 5 #include <string.h> |
| 6 #include <utility> | 6 #include <utility> |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "content/public/common/common_param_traits.h" | 10 #include "content/public/common/common_param_traits.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 bitmap.allocN32Pixels(10, 5); | 88 bitmap.allocN32Pixels(10, 5); |
| 89 memset(bitmap.getPixels(), 'A', bitmap.getSize()); | 89 memset(bitmap.getPixels(), 'A', bitmap.getSize()); |
| 90 | 90 |
| 91 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); | 91 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); |
| 92 IPC::ParamTraits<SkBitmap>::Write(&msg, bitmap); | 92 IPC::ParamTraits<SkBitmap>::Write(&msg, bitmap); |
| 93 | 93 |
| 94 SkBitmap output; | 94 SkBitmap output; |
| 95 PickleIterator iter(msg); | 95 PickleIterator iter(msg); |
| 96 EXPECT_TRUE(IPC::ParamTraits<SkBitmap>::Read(&msg, &iter, &output)); | 96 EXPECT_TRUE(IPC::ParamTraits<SkBitmap>::Read(&msg, &iter, &output)); |
| 97 | 97 |
| 98 EXPECT_EQ(bitmap.config(), output.config()); | 98 EXPECT_EQ(bitmap.colorType(), output.colorType()); |
| 99 EXPECT_EQ(bitmap.width(), output.width()); | 99 EXPECT_EQ(bitmap.width(), output.width()); |
| 100 EXPECT_EQ(bitmap.height(), output.height()); | 100 EXPECT_EQ(bitmap.height(), output.height()); |
| 101 EXPECT_EQ(bitmap.rowBytes(), output.rowBytes()); | 101 EXPECT_EQ(bitmap.rowBytes(), output.rowBytes()); |
| 102 EXPECT_EQ(bitmap.getSize(), output.getSize()); | 102 EXPECT_EQ(bitmap.getSize(), output.getSize()); |
| 103 EXPECT_EQ(memcmp(bitmap.getPixels(), output.getPixels(), bitmap.getSize()), | 103 EXPECT_EQ(memcmp(bitmap.getPixels(), output.getPixels(), bitmap.getSize()), |
| 104 0); | 104 0); |
| 105 | 105 |
| 106 // Also test the corrupt case. | 106 // Also test the corrupt case. |
| 107 IPC::Message bad_msg(1, 2, IPC::Message::PRIORITY_NORMAL); | 107 IPC::Message bad_msg(1, 2, IPC::Message::PRIORITY_NORMAL); |
| 108 // Copy the first message block over to |bad_msg|. | 108 // Copy the first message block over to |bad_msg|. |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 | 184 |
| 185 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); | 185 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); |
| 186 IPC::ParamTraits<net::HostPortPair>::Write(&msg, input); | 186 IPC::ParamTraits<net::HostPortPair>::Write(&msg, input); |
| 187 | 187 |
| 188 net::HostPortPair output; | 188 net::HostPortPair output; |
| 189 PickleIterator iter(msg); | 189 PickleIterator iter(msg); |
| 190 EXPECT_TRUE(IPC::ParamTraits<net::HostPortPair>::Read(&msg, &iter, &output)); | 190 EXPECT_TRUE(IPC::ParamTraits<net::HostPortPair>::Read(&msg, &iter, &output)); |
| 191 EXPECT_EQ(input.host(), output.host()); | 191 EXPECT_EQ(input.host(), output.host()); |
| 192 EXPECT_EQ(input.port(), output.port()); | 192 EXPECT_EQ(input.port(), output.port()); |
| 193 } | 193 } |
| OLD | NEW |