OLD | NEW |
1 // Copyright 2015 The Crashpad Authors. All rights reserved. | 1 // Copyright 2015 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 EXPECT_TRUE(process_info.IsWow64()); | 45 EXPECT_TRUE(process_info.IsWow64()); |
46 #endif | 46 #endif |
47 | 47 |
48 std::wstring command_line; | 48 std::wstring command_line; |
49 EXPECT_TRUE(process_info.CommandLine(&command_line)); | 49 EXPECT_TRUE(process_info.CommandLine(&command_line)); |
50 EXPECT_EQ(std::wstring(GetCommandLine()), command_line); | 50 EXPECT_EQ(std::wstring(GetCommandLine()), command_line); |
51 | 51 |
52 std::vector<std::wstring> modules; | 52 std::vector<std::wstring> modules; |
53 EXPECT_TRUE(process_info.Modules(&modules)); | 53 EXPECT_TRUE(process_info.Modules(&modules)); |
54 ASSERT_GE(modules.size(), 2u); | 54 ASSERT_GE(modules.size(), 2u); |
55 const wchar_t kSelfName[] = L"\\util_test.exe"; | 55 const wchar_t kSelfName[] = L"\\crashpad_util_test.exe"; |
56 ASSERT_GE(modules[0].size(), wcslen(kSelfName)); | 56 ASSERT_GE(modules[0].size(), wcslen(kSelfName)); |
57 EXPECT_EQ(kSelfName, | 57 EXPECT_EQ(kSelfName, |
58 modules[0].substr(modules[0].size() - wcslen(kSelfName))); | 58 modules[0].substr(modules[0].size() - wcslen(kSelfName))); |
59 ASSERT_GE(modules[1].size(), wcslen(kNtdllName)); | 59 ASSERT_GE(modules[1].size(), wcslen(kNtdllName)); |
60 EXPECT_EQ(kNtdllName, | 60 EXPECT_EQ(kNtdllName, |
61 modules[1].substr(modules[1].size() - wcslen(kNtdllName))); | 61 modules[1].substr(modules[1].size() - wcslen(kNtdllName))); |
62 } | 62 } |
63 | 63 |
64 TEST(ProcessInfo, SomeOtherProcess) { | 64 TEST(ProcessInfo, SomeOtherProcess) { |
65 ProcessInfo process_info; | 65 ProcessInfo process_info; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 ASSERT_EQ(WaitForSingleObject(started.get(), INFINITE), WAIT_OBJECT_0); | 106 ASSERT_EQ(WaitForSingleObject(started.get(), INFINITE), WAIT_OBJECT_0); |
107 | 107 |
108 ASSERT_TRUE(process_info.Initialize(process_information.hProcess)); | 108 ASSERT_TRUE(process_info.Initialize(process_information.hProcess)); |
109 | 109 |
110 // Tell the test it's OK to shut down now that we've read our data. | 110 // Tell the test it's OK to shut down now that we've read our data. |
111 SetEvent(done.get()); | 111 SetEvent(done.get()); |
112 | 112 |
113 std::vector<std::wstring> modules; | 113 std::vector<std::wstring> modules; |
114 EXPECT_TRUE(process_info.Modules(&modules)); | 114 EXPECT_TRUE(process_info.Modules(&modules)); |
115 ASSERT_GE(modules.size(), 3u); | 115 ASSERT_GE(modules.size(), 3u); |
116 const wchar_t kChildName[] = L"\\util_test_process_info_test_child.exe"; | 116 const wchar_t kChildName[] = |
| 117 L"\\crashpad_util_test_process_info_test_child.exe"; |
117 ASSERT_GE(modules[0].size(), wcslen(kChildName)); | 118 ASSERT_GE(modules[0].size(), wcslen(kChildName)); |
118 EXPECT_EQ(kChildName, | 119 EXPECT_EQ(kChildName, |
119 modules[0].substr(modules[0].size() - wcslen(kChildName))); | 120 modules[0].substr(modules[0].size() - wcslen(kChildName))); |
120 ASSERT_GE(modules[1].size(), wcslen(kNtdllName)); | 121 ASSERT_GE(modules[1].size(), wcslen(kNtdllName)); |
121 EXPECT_EQ(kNtdllName, | 122 EXPECT_EQ(kNtdllName, |
122 modules[1].substr(modules[1].size() - wcslen(kNtdllName))); | 123 modules[1].substr(modules[1].size() - wcslen(kNtdllName))); |
123 // lz32.dll is an uncommonly-used-but-always-available module that the test | 124 // lz32.dll is an uncommonly-used-but-always-available module that the test |
124 // binary manually loads. | 125 // binary manually loads. |
125 const wchar_t kLz32dllName[] = L"\\lz32.dll"; | 126 const wchar_t kLz32dllName[] = L"\\lz32.dll"; |
126 ASSERT_GE(modules.back().size(), wcslen(kLz32dllName)); | 127 ASSERT_GE(modules.back().size(), wcslen(kLz32dllName)); |
127 EXPECT_EQ( | 128 EXPECT_EQ( |
128 kLz32dllName, | 129 kLz32dllName, |
129 modules.back().substr(modules.back().size() - wcslen(kLz32dllName))); | 130 modules.back().substr(modules.back().size() - wcslen(kLz32dllName))); |
130 } | 131 } |
131 | 132 |
132 } // namespace | 133 } // namespace |
133 } // namespace test | 134 } // namespace test |
134 } // namespace crashpad | 135 } // namespace crashpad |
OLD | NEW |