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> | 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/memory/scoped_ptr.h" |
9 #include "base/pickle.h" | 9 #include "base/pickle.h" |
10 #include "base/string16.h" | 10 #include "base/strings/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; |
20 const bool testbool1 = false; | 20 const bool testbool1 = false; |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 EXPECT_TRUE(pickle.WriteBytes(&data, sizeof(data))); | 333 EXPECT_TRUE(pickle.WriteBytes(&data, sizeof(data))); |
334 | 334 |
335 PickleIterator iter(pickle); | 335 PickleIterator iter(pickle); |
336 const char* outdata_char = NULL; | 336 const char* outdata_char = NULL; |
337 EXPECT_TRUE(pickle.ReadBytes(&iter, &outdata_char, sizeof(data))); | 337 EXPECT_TRUE(pickle.ReadBytes(&iter, &outdata_char, sizeof(data))); |
338 | 338 |
339 int outdata; | 339 int outdata; |
340 memcpy(&outdata, outdata_char, sizeof(outdata)); | 340 memcpy(&outdata, outdata_char, sizeof(outdata)); |
341 EXPECT_EQ(data, outdata); | 341 EXPECT_EQ(data, outdata); |
342 } | 342 } |
OLD | NEW |