Chromium Code Reviews| Index: sandbox/win/src/process_policy_test.cc |
| diff --git a/sandbox/win/src/process_policy_test.cc b/sandbox/win/src/process_policy_test.cc |
| index af64f14f79127c6536744cf5aea1d9119bf8cf01..856db42ab975d1ceb35cb8c196a797475ac9816a 100644 |
| --- a/sandbox/win/src/process_policy_test.cc |
| +++ b/sandbox/win/src/process_policy_test.cc |
| @@ -154,28 +154,19 @@ SBOX_TESTS_COMMAND int Process_RunApp4(int argc, wchar_t **argv) { |
| // TEST 4: Try file name in the app_name and current directory sets correctly. |
| base::string16 system32 = MakeFullPathToSystem32(L""); |
| wchar_t current_directory[MAX_PATH + 1]; |
| - int result4; |
| - bool test_succeeded = false; |
| DWORD ret = ::GetCurrentDirectory(MAX_PATH, current_directory); |
| if (!ret) |
| return SBOX_TEST_FIRST_ERROR; |
| + if (ret >= MAX_PATH) |
| + return SBOX_TEST_FAILED; |
| - if (ret < MAX_PATH) { |
| - current_directory[ret] = L'\\'; |
| - current_directory[ret+1] = L'\0'; |
| - if (::SetCurrentDirectory(system32.c_str())) { |
| - result4 = CreateProcessHelper(argv[0], base::string16()); |
| - if (::SetCurrentDirectory(current_directory)) { |
| - test_succeeded = true; |
| - } |
| - } else { |
| - return SBOX_TEST_SECOND_ERROR; |
| - } |
| - } |
| - if (!test_succeeded) |
| - result4 = SBOX_TEST_FAILED; |
| + current_directory[ret] = L'\\'; |
| + current_directory[ret+1] = L'\0'; |
| + if (!::SetCurrentDirectory(system32.c_str())) |
|
cpu_(ooo_6.6-7.5)
2014/07/10 00:49:34
you are using the nice no brackets style for if()
Peter Kasting
2014/07/10 01:19:31
Good catch, I didn't look hard enough.
|
| + return SBOX_TEST_SECOND_ERROR; |
| - return result4; |
| + const int result4 = CreateProcessHelper(argv[0], base::string16()); |
| + return ::SetCurrentDirectory(current_directory) ? result4 : SBOX_TEST_FAILED; |
| } |
| SBOX_TESTS_COMMAND int Process_RunApp5(int argc, wchar_t **argv) { |