summaryrefslogtreecommitdiffstats
path: root/sandbox/win
diff options
context:
space:
mode:
authorjschuh@chromium.org <jschuh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-22 00:20:44 +0000
committerjschuh@chromium.org <jschuh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-22 00:20:44 +0000
commitc9305a3aa9a1d40e913749e1b976b95c9af519bd (patch)
treed28e52d14e77d9fc3a634d0ab9d5e7dc61a8dcc4 /sandbox/win
parenta5d41a0ce178ad29eba7cfe1f7eef0a03378ed4c (diff)
downloadchromium_src-c9305a3aa9a1d40e913749e1b976b95c9af519bd.zip
chromium_src-c9305a3aa9a1d40e913749e1b976b95c9af519bd.tar.gz
chromium_src-c9305a3aa9a1d40e913749e1b976b95c9af519bd.tar.bz2
Make ProcessMitigationsTest.CheckWin8 work in debug builds
Review URL: https://chromiumcodereview.appspot.com/10956050 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@158132 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sandbox/win')
-rw-r--r--sandbox/win/src/process_mitigations_test.cc26
1 files changed, 15 insertions, 11 deletions
diff --git a/sandbox/win/src/process_mitigations_test.cc b/sandbox/win/src/process_mitigations_test.cc
index 2456391..7ea670b 100644
--- a/sandbox/win/src/process_mitigations_test.cc
+++ b/sandbox/win/src/process_mitigations_test.cc
@@ -96,8 +96,10 @@ SBOX_TESTS_COMMAND int CheckWin8(int argc, wchar_t **argv) {
if (!CheckWin8DepPolicy())
return SBOX_TEST_FIRST_ERROR;
+#if defined(NDEBUG) // ASLR cannot be forced in debug builds.
if (!CheckWin8AslrPolicy())
return SBOX_TEST_SECOND_ERROR;
+#endif
if (!CheckWin8StrictHandlePolicy())
return SBOX_TEST_THIRD_ERROR;
@@ -118,18 +120,20 @@ TEST(ProcessMitigationsTest, CheckWin8) {
TestRunner runner;
sandbox::TargetPolicy* policy = runner.GetPolicy();
- EXPECT_EQ(policy->SetProcessMitigations(
- MITIGATION_DEP |
- MITIGATION_DEP_NO_ATL_THUNK |
- MITIGATION_RELOCATE_IMAGE |
- MITIGATION_RELOCATE_IMAGE_REQUIRED |
- MITIGATION_EXTENSION_DLL_DISABLE),
- SBOX_ALL_OK);
+ sandbox::MitigationFlags mitigations = MITIGATION_DEP |
+ MITIGATION_DEP_NO_ATL_THUNK |
+ MITIGATION_EXTENSION_DLL_DISABLE;
+#if defined(NDEBUG) // ASLR cannot be forced in debug builds.
+ mitigations |= MITIGATION_RELOCATE_IMAGE |
+ MITIGATION_RELOCATE_IMAGE_REQUIRED;
+#endif
- EXPECT_EQ(policy->SetDelayedProcessMitigations(
- MITIGATION_STRICT_HANDLE_CHECKS |
- MITIGATION_WIN32K_DISABLE),
- SBOX_ALL_OK);
+ EXPECT_EQ(policy->SetProcessMitigations(mitigations), SBOX_ALL_OK);
+
+ mitigations |= MITIGATION_STRICT_HANDLE_CHECKS |
+ MITIGATION_WIN32K_DISABLE;
+
+ EXPECT_EQ(policy->SetDelayedProcessMitigations(mitigations), SBOX_ALL_OK);
EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"CheckWin8"));
}