| 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> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/pickle.h" | 9 #include "base/pickle.h" |
| 9 #include "base/scoped_ptr.h" | |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 const int testint = 2093847192; | 15 const int testint = 2093847192; |
| 16 const std::string teststr("Hello world"); // note non-aligned string length | 16 const std::string teststr("Hello world"); // note non-aligned string length |
| 17 const std::wstring testwstr(L"Hello, world"); | 17 const std::wstring testwstr(L"Hello, world"); |
| 18 const char testdata[] = "AAA\0BBB\0"; | 18 const char testdata[] = "AAA\0BBB\0"; |
| 19 const int testdatalen = arraysize(testdata) - 1; | 19 const int testdatalen = arraysize(testdata) - 1; |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 EXPECT_TRUE(pickle.WriteBytes(&data, sizeof(data))); | 316 EXPECT_TRUE(pickle.WriteBytes(&data, sizeof(data))); |
| 317 | 317 |
| 318 void* iter = NULL; | 318 void* iter = NULL; |
| 319 const char* outdata_char; | 319 const char* outdata_char; |
| 320 EXPECT_TRUE(pickle.ReadBytes(&iter, &outdata_char, sizeof(data))); | 320 EXPECT_TRUE(pickle.ReadBytes(&iter, &outdata_char, sizeof(data))); |
| 321 | 321 |
| 322 int outdata; | 322 int outdata; |
| 323 memcpy(&outdata, outdata_char, sizeof(outdata)); | 323 memcpy(&outdata, outdata_char, sizeof(outdata)); |
| 324 EXPECT_EQ(data, outdata); | 324 EXPECT_EQ(data, outdata); |
| 325 } | 325 } |
| OLD | NEW |