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/string16.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 std::string outstr; | 33 std::string outstr; |
34 EXPECT_TRUE(pickle.ReadString(&iter, &outstr)); | 34 EXPECT_TRUE(pickle.ReadString(&iter, &outstr)); |
35 EXPECT_EQ(teststr, outstr); | 35 EXPECT_EQ(teststr, outstr); |
36 | 36 |
37 std::wstring outwstr; | 37 std::wstring outwstr; |
38 EXPECT_TRUE(pickle.ReadWString(&iter, &outwstr)); | 38 EXPECT_TRUE(pickle.ReadWString(&iter, &outwstr)); |
39 EXPECT_EQ(testwstr, outwstr); | 39 EXPECT_EQ(testwstr, outwstr); |
40 | 40 |
41 bool outbool; | 41 bool outbool; |
42 EXPECT_TRUE(pickle.ReadBool(&iter, &outbool)); | 42 EXPECT_TRUE(pickle.ReadBool(&iter, &outbool)); |
43 EXPECT_EQ(testbool1, outbool); | 43 EXPECT_FALSE(outbool); |
44 EXPECT_TRUE(pickle.ReadBool(&iter, &outbool)); | 44 EXPECT_TRUE(pickle.ReadBool(&iter, &outbool)); |
45 EXPECT_EQ(testbool2, outbool); | 45 EXPECT_TRUE(outbool); |
46 | 46 |
47 uint16 outuint16; | 47 uint16 outuint16; |
48 EXPECT_TRUE(pickle.ReadUInt16(&iter, &outuint16)); | 48 EXPECT_TRUE(pickle.ReadUInt16(&iter, &outuint16)); |
49 EXPECT_EQ(testuint16, outuint16); | 49 EXPECT_EQ(testuint16, outuint16); |
50 | 50 |
51 float outfloat; | 51 float outfloat; |
52 EXPECT_TRUE(pickle.ReadFloat(&iter, &outfloat)); | 52 EXPECT_TRUE(pickle.ReadFloat(&iter, &outfloat)); |
53 EXPECT_EQ(testfloat, outfloat); | 53 EXPECT_EQ(testfloat, outfloat); |
54 | 54 |
55 const char* outdata; | 55 const char* outdata; |
(...skipping 277 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 |