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

Side by Side Diff: third_party/crashpad/crashpad/util/win/initial_client_data_test.cc

Issue 2478633002: Update Crashpad to b47bf6c250c6b825dee1c5fbad9152c2c962e828 (Closed)
Patch Set: mac comment 2 Created 4 years, 1 month 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
OLDNEW
(Empty)
1 // Copyright 2016 The Crashpad Authors. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (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
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 #include "util/win/initial_client_data.h"
16
17 #include "gtest/gtest.h"
18
19 namespace crashpad {
20 namespace test {
21 namespace {
22
23 TEST(InitialClientData, Validity) {
24 InitialClientData icd1;
25 EXPECT_FALSE(icd1.IsValid());
26
27 InitialClientData icd2(
28 reinterpret_cast<HANDLE>(0x123),
29 reinterpret_cast<HANDLE>(0x456),
30 reinterpret_cast<HANDLE>(0x789),
31 reinterpret_cast<HANDLE>(0xabc),
32 reinterpret_cast<HANDLE>(0xdef),
33 0x7fff000012345678ull,
34 0x100000ull,
35 0xccccddddeeeeffffull);
36 EXPECT_TRUE(icd2.IsValid());
37 }
38
39 TEST(InitialClientData, RoundTrip) {
40 InitialClientData first(
41 reinterpret_cast<HANDLE>(0x123),
42 reinterpret_cast<HANDLE>(0x456),
43 reinterpret_cast<HANDLE>(0x789),
44 reinterpret_cast<HANDLE>(0xabc),
45 reinterpret_cast<HANDLE>(0xdef),
46 0x7fff000012345678ull,
47 0x100000ull,
48 0xccccddddeeeeffffull);
49
50 std::string as_string = first.StringRepresentation();
51 EXPECT_EQ(
52 "0x123,0x456,0x789,0xabc,0xdef,"
53 "0x7fff000012345678,0x100000,0xccccddddeeeeffff",
54 as_string);
55
56 InitialClientData second;
57 ASSERT_TRUE(second.InitializeFromString(as_string));
58 EXPECT_EQ(first.request_crash_dump(), second.request_crash_dump());
59 EXPECT_EQ(first.request_non_crash_dump(), second.request_non_crash_dump());
60 EXPECT_EQ(first.non_crash_dump_completed(),
61 second.non_crash_dump_completed());
62 EXPECT_EQ(first.first_pipe_instance(), second.first_pipe_instance());
63 EXPECT_EQ(first.client_process(), second.client_process());
64 EXPECT_EQ(first.crash_exception_information(),
65 second.crash_exception_information());
66 EXPECT_EQ(first.non_crash_exception_information(),
67 second.non_crash_exception_information());
68 EXPECT_EQ(first.debug_critical_section_address(),
69 second.debug_critical_section_address());
70 }
71
72 } // namespace
73 } // namespace test
74 } // namespace crashpad
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698