OLD | NEW |
1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 EXPECT_TRUE(string_writer.WriteEverything(&string_file)); | 46 EXPECT_TRUE(string_writer.WriteEverything(&string_file)); |
47 ASSERT_EQ(6u, string_file.string().size()); | 47 ASSERT_EQ(6u, string_file.string().size()); |
48 | 48 |
49 const MINIDUMP_STRING* minidump_string = | 49 const MINIDUMP_STRING* minidump_string = |
50 MinidumpStringAtRVA(string_file.string(), 0); | 50 MinidumpStringAtRVA(string_file.string(), 0); |
51 EXPECT_TRUE(minidump_string); | 51 EXPECT_TRUE(minidump_string); |
52 EXPECT_EQ(base::string16(), | 52 EXPECT_EQ(base::string16(), |
53 MinidumpStringAtRVAAsString(string_file.string(), 0)); | 53 MinidumpStringAtRVAAsString(string_file.string(), 0)); |
54 } | 54 } |
55 | 55 |
56 { | |
57 SCOPED_TRACE("no conversion"); | |
58 string_file.Reset(); | |
59 crashpad::internal::MinidumpUTF16StringWriter string_writer; | |
60 const base::string16 kString(L"oóöőo"); | |
61 string_writer.SetUTF16(kString); | |
62 EXPECT_TRUE(string_writer.WriteEverything(&string_file)); | |
63 ASSERT_EQ( | |
64 sizeof(MINIDUMP_STRING) + (kString.size() + 1) * sizeof(kString[0]), | |
65 string_file.string().size()); | |
66 | |
67 const MINIDUMP_STRING* minidump_string = | |
68 MinidumpStringAtRVA(string_file.string(), 0); | |
69 EXPECT_TRUE(minidump_string); | |
70 EXPECT_EQ(kString, MinidumpStringAtRVAAsString(string_file.string(), 0)); | |
71 } | |
72 | |
73 const struct { | 56 const struct { |
74 size_t input_length; | 57 size_t input_length; |
75 const char* input_string; | 58 const char* input_string; |
76 size_t output_length; | 59 size_t output_length; |
77 base::char16 output_string[10]; | 60 base::char16 output_string[10]; |
78 } kTestData[] = { | 61 } kTestData[] = { |
79 {0, "", 0, {}}, | 62 {0, "", 0, {}}, |
80 {1, "a", 1, {'a'}}, | 63 {1, "a", 1, {'a'}}, |
81 {2, "\0b", 2, {0, 'b'}}, | 64 {2, "\0b", 2, {0, 'b'}}, |
82 {3, "cde", 3, {'c', 'd', 'e'}}, | 65 {3, "cde", 3, {'c', 'd', 'e'}}, |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 MinidumpStringListTest<MinidumpUTF16StringListWriterTraits>(); | 259 MinidumpStringListTest<MinidumpUTF16StringListWriterTraits>(); |
277 } | 260 } |
278 | 261 |
279 TEST(MinidumpStringWriter, MinidumpUTF8StringList) { | 262 TEST(MinidumpStringWriter, MinidumpUTF8StringList) { |
280 MinidumpStringListTest<MinidumpUTF8StringListWriterTraits>(); | 263 MinidumpStringListTest<MinidumpUTF8StringListWriterTraits>(); |
281 } | 264 } |
282 | 265 |
283 } // namespace | 266 } // namespace |
284 } // namespace test | 267 } // namespace test |
285 } // namespace crashpad | 268 } // namespace crashpad |
OLD | NEW |