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

Side by Side Diff: util/win/process_info_test.cc

Issue 1339813002: win: Fix ProcessInfo test when running on x86 host OS (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@fix-pipe-connection-leak
Patch Set: Created 5 years, 3 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and 12 // See the License for the specific language governing permissions and
13 // limitations under the License. 13 // limitations under the License.
14 14
15 #include "util/win/process_info.h" 15 #include "util/win/process_info.h"
16 16
17 #include <imagehlp.h> 17 #include <imagehlp.h>
18 #include <rpc.h> 18 #include <rpc.h>
19 #include <stdlib.h>
19 #include <wchar.h> 20 #include <wchar.h>
20 21
21 #include "base/files/file_path.h" 22 #include "base/files/file_path.h"
22 #include "build/build_config.h" 23 #include "build/build_config.h"
23 #include "gtest/gtest.h" 24 #include "gtest/gtest.h"
24 #include "test/paths.h" 25 #include "test/paths.h"
25 #include "util/file/file_io.h" 26 #include "util/file/file_io.h"
26 #include "util/misc/uuid.h" 27 #include "util/misc/uuid.h"
27 #include "util/win/scoped_handle.h" 28 #include "util/win/scoped_handle.h"
28 29
(...skipping 16 matching lines...) Expand all
45 ProcessInfo process_info; 46 ProcessInfo process_info;
46 ASSERT_TRUE(process_info.Initialize(GetCurrentProcess())); 47 ASSERT_TRUE(process_info.Initialize(GetCurrentProcess()));
47 EXPECT_EQ(GetCurrentProcessId(), process_info.ProcessID()); 48 EXPECT_EQ(GetCurrentProcessId(), process_info.ProcessID());
48 EXPECT_GT(process_info.ParentProcessID(), 0u); 49 EXPECT_GT(process_info.ParentProcessID(), 0u);
49 50
50 #if defined(ARCH_CPU_64_BITS) 51 #if defined(ARCH_CPU_64_BITS)
51 EXPECT_TRUE(process_info.Is64Bit()); 52 EXPECT_TRUE(process_info.Is64Bit());
52 EXPECT_FALSE(process_info.IsWow64()); 53 EXPECT_FALSE(process_info.IsWow64());
53 #else 54 #else
54 EXPECT_FALSE(process_info.Is64Bit()); 55 EXPECT_FALSE(process_info.Is64Bit());
55 // Assume we won't be running these tests on a 32 bit host OS. 56 char* processor_architew6432 = getenv("PROCESSOR_ARCHITEW6432");
Mark Mentovai 2015/09/11 22:38:56 I think that using environment variables like this
scottmg 2015/09/11 23:39:55 Yeah, that's I tried to verify with "some other" s
56 EXPECT_TRUE(process_info.IsWow64()); 57 if (processor_architew6432 && std::string(processor_architew6432) == "AMD64")
Mark Mentovai 2015/09/11 22:38:56 Just strcmp() instead of creating a std::string?
58 EXPECT_TRUE(process_info.IsWow64());
59 else
60 EXPECT_FALSE(process_info.IsWow64());
57 #endif 61 #endif
58 62
59 std::wstring command_line; 63 std::wstring command_line;
60 EXPECT_TRUE(process_info.CommandLine(&command_line)); 64 EXPECT_TRUE(process_info.CommandLine(&command_line));
61 EXPECT_EQ(std::wstring(GetCommandLine()), command_line); 65 EXPECT_EQ(std::wstring(GetCommandLine()), command_line);
62 66
63 std::vector<ProcessInfo::Module> modules; 67 std::vector<ProcessInfo::Module> modules;
64 EXPECT_TRUE(process_info.Modules(&modules)); 68 EXPECT_TRUE(process_info.Modules(&modules));
65 ASSERT_GE(modules.size(), 2u); 69 ASSERT_GE(modules.size(), 2u);
66 const wchar_t kSelfName[] = L"\\crashpad_util_test.exe"; 70 const wchar_t kSelfName[] = L"\\crashpad_util_test.exe";
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 TestOtherProcess(L"x64"); 165 TestOtherProcess(L"x64");
162 } 166 }
163 167
164 TEST(ProcessInfo, OtherProcessX86) { 168 TEST(ProcessInfo, OtherProcessX86) {
165 TestOtherProcess(L"x86"); 169 TestOtherProcess(L"x86");
166 } 170 }
167 171
168 } // namespace 172 } // namespace
169 } // namespace test 173 } // namespace test
170 } // namespace crashpad 174 } // namespace crashpad
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698