| Index: installer/src/installer-lib/test/process_test.cpp |
| =================================================================== |
| --- a/installer/src/installer-lib/test/process_test.cpp |
| +++ b/installer/src/installer-lib/test/process_test.cpp |
| @@ -12,6 +12,8 @@ |
| const wchar_t exact_exe_name[] = L"installer-ca-tests.exe" ; |
| const wchar_t mixedcase_exe_name[] = L"Installer-CA-Tests.exe" ; |
| const wchar_t * multiple_exe_names[] = { mixedcase_exe_name, L"non-matching-name" } ; |
| +const wchar_t * multiple_module_names[] = { L"kernel32.dll", L"non-matching-name" } ; |
| +const wchar_t * non_existent_module_names[] = { L"non-matching-name" } ; |
| /** |
| * Compare to our own process name, case-sensitive, no length limit |
| @@ -67,7 +69,11 @@ |
| PROCESSENTRY32 process_absent = process_with_name( L"no_such_name" ) ; |
| exe_name_set multiple_name_set( multiple_exe_names, 2 ) ; |
| +exe_name_set multiple_name_set_modules( multiple_module_names, 2 ) ; |
| +exe_name_set non_existent_name_set_modules( non_existent_module_names, 1 ) ; |
| process_by_any_exe_name_CI find_in_set( multiple_name_set ) ; |
| +process_by_any_exe_name_CI_w_ABP find_in_set_w_kernel32( multiple_name_set, multiple_name_set_modules ) ; |
| +process_by_any_exe_name_CI_w_ABP find_in_set_w_non_existent( multiple_name_set, non_existent_name_set_modules ) ; |
| TEST( exe_name_set, validate_setup ) |
| { |
| @@ -238,3 +244,20 @@ |
| EXPECT_EQ( size, 1u ); |
| ASSERT_GE( size, 1u ); |
| } |
| + |
| +TEST( pid_set, find_our_process_in_set_w_kernel32 ) |
| +{ |
| + std::set< DWORD > s ; |
| + initialize_process_set( s, find_in_set_w_kernel32, copy_PID() ) ; |
| + size_t size( s.size() ) ; |
| + EXPECT_EQ( size, 1u ); |
| + ASSERT_GE( size, 1u ); |
| +} |
| +TEST( pid_set, find_our_process_in_set_w_non_existant ) |
| +{ |
| + std::set< DWORD > s ; |
| + initialize_process_set( s, find_in_set_w_non_existent, copy_PID() ) ; |
| + size_t size( s.size() ) ; |
| + EXPECT_EQ( size, 0u ); |
| + ASSERT_GE( size, 0u ); |
| +} |