Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(259)

Side by Side Diff: minidump/minidump_string_writer_test.cc

Issue 1419623003: Write MINIDUMP_HANDLE_DATA_STREAM to minidump (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: . Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « minidump/minidump_string_writer.h ('k') | minidump/minidump_test.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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");
Mark Mentovai 2015/10/21 16:53:51 This was inspired by all of the different kinds of
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
56 const struct { 73 const struct {
57 size_t input_length; 74 size_t input_length;
58 const char* input_string; 75 const char* input_string;
59 size_t output_length; 76 size_t output_length;
60 base::char16 output_string[10]; 77 base::char16 output_string[10];
61 } kTestData[] = { 78 } kTestData[] = {
62 {0, "", 0, {}}, 79 {0, "", 0, {}},
63 {1, "a", 1, {'a'}}, 80 {1, "a", 1, {'a'}},
64 {2, "\0b", 2, {0, 'b'}}, 81 {2, "\0b", 2, {0, 'b'}},
65 {3, "cde", 3, {'c', 'd', 'e'}}, 82 {3, "cde", 3, {'c', 'd', 'e'}},
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 MinidumpStringListTest<MinidumpUTF16StringListWriterTraits>(); 276 MinidumpStringListTest<MinidumpUTF16StringListWriterTraits>();
260 } 277 }
261 278
262 TEST(MinidumpStringWriter, MinidumpUTF8StringList) { 279 TEST(MinidumpStringWriter, MinidumpUTF8StringList) {
263 MinidumpStringListTest<MinidumpUTF8StringListWriterTraits>(); 280 MinidumpStringListTest<MinidumpUTF8StringListWriterTraits>();
264 } 281 }
265 282
266 } // namespace 283 } // namespace
267 } // namespace test 284 } // namespace test
268 } // namespace crashpad 285 } // namespace crashpad
OLDNEW
« no previous file with comments | « minidump/minidump_string_writer.h ('k') | minidump/minidump_test.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698