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

Side by Side Diff: sandbox/win/src/process_mitigations_test.cc

Issue 2909943003: Removing useless Win7 checks + standardize its use (Closed)
Patch Set: Fix reversed conditionnal Created 3 years, 6 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
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "sandbox/win/src/process_mitigations.h" 5 #include "sandbox/win/src/process_mitigations.h"
6 6
7 #include <d3d9.h> 7 #include <d3d9.h>
8 #include <initguid.h> 8 #include <initguid.h>
9 #include <opmapi.h> 9 #include <opmapi.h>
10 #include <psapi.h> 10 #include <psapi.h>
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 (MEM_EXECUTE_OPTION_DISABLE | MEM_EXECUTE_OPTION_PERMANENT)) { 941 (MEM_EXECUTE_OPTION_DISABLE | MEM_EXECUTE_OPTION_PERMANENT)) {
942 return SBOX_TEST_FOURTH_ERROR; 942 return SBOX_TEST_FOURTH_ERROR;
943 } 943 }
944 } 944 }
945 945
946 return SBOX_TEST_SUCCEEDED; 946 return SBOX_TEST_SUCCEEDED;
947 } 947 }
948 948
949 #if !defined(_WIN64) // DEP is always enabled on 64-bit. 949 #if !defined(_WIN64) // DEP is always enabled on 64-bit.
950 TEST(ProcessMitigationsTest, CheckDep) { 950 TEST(ProcessMitigationsTest, CheckDep) {
951 if (base::win::GetVersion() > base::win::VERSION_WIN7) 951 if (base::win::GetVersion() >= base::win::VERSION_WIN8)
952 return; 952 return;
953 953
954 TestRunner runner; 954 TestRunner runner;
955 sandbox::TargetPolicy* policy = runner.GetPolicy(); 955 sandbox::TargetPolicy* policy = runner.GetPolicy();
956 956
957 EXPECT_EQ(policy->SetProcessMitigations(MITIGATION_DEP | 957 EXPECT_EQ(policy->SetProcessMitigations(MITIGATION_DEP |
958 MITIGATION_DEP_NO_ATL_THUNK | 958 MITIGATION_DEP_NO_ATL_THUNK |
959 MITIGATION_SEHOP), 959 MITIGATION_SEHOP),
960 SBOX_ALL_OK); 960 SBOX_ALL_OK);
961 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"CheckDep")); 961 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"CheckDep"));
(...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after
1805 cmd = cmd.Append(L"calc.exe"); 1805 cmd = cmd.Append(L"calc.exe");
1806 1806
1807 std::wstring test_command(base::StringPrintf(L"TestChildProcess %ls 0x%08X", 1807 std::wstring test_command(base::StringPrintf(L"TestChildProcess %ls 0x%08X",
1808 cmd.value().c_str(), 1808 cmd.value().c_str(),
1809 STATUS_ACCESS_VIOLATION)); 1809 STATUS_ACCESS_VIOLATION));
1810 1810
1811 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(test_command.c_str())); 1811 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(test_command.c_str()));
1812 } 1812 }
1813 1813
1814 } // namespace sandbox 1814 } // namespace sandbox
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698