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

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

Issue 2317123003: misc files R-U: Change ScopedTempDir::path() to GetPath() (Closed)
Patch Set: Fix exec_process_unittest.cc Created 4 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
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 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 472
473 void TestWin10ImageLoadLowLabel(bool is_success_test) { 473 void TestWin10ImageLoadLowLabel(bool is_success_test) {
474 // Setup a mandatory low executable for this test (calc.exe). 474 // Setup a mandatory low executable for this test (calc.exe).
475 // If anything fails during setup, ASSERT to end test. 475 // If anything fails during setup, ASSERT to end test.
476 base::FilePath orig_path; 476 base::FilePath orig_path;
477 ASSERT_TRUE(base::PathService::Get(base::DIR_SYSTEM, &orig_path)); 477 ASSERT_TRUE(base::PathService::Get(base::DIR_SYSTEM, &orig_path));
478 orig_path = orig_path.Append(L"calc.exe"); 478 orig_path = orig_path.Append(L"calc.exe");
479 479
480 base::ScopedTempDir temp_dir; 480 base::ScopedTempDir temp_dir;
481 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 481 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
482 base::FilePath new_path = temp_dir.path(); 482 base::FilePath new_path = temp_dir.GetPath();
483 new_path = new_path.Append(L"lowIL_calc.exe"); 483 new_path = new_path.Append(L"lowIL_calc.exe");
484 484
485 // Test file will be cleaned up by the ScopedTempDir. 485 // Test file will be cleaned up by the ScopedTempDir.
486 ASSERT_TRUE(base::CopyFileW(orig_path, new_path)); 486 ASSERT_TRUE(base::CopyFileW(orig_path, new_path));
487 487
488 std::wstring cmd_line = L"icacls \""; 488 std::wstring cmd_line = L"icacls \"";
489 cmd_line += new_path.value().c_str(); 489 cmd_line += new_path.value().c_str();
490 cmd_line += L"\" /setintegritylevel Low"; 490 cmd_line += L"\" /setintegritylevel Low";
491 491
492 base::LaunchOptions options = base::LaunchOptionsForTest(); 492 base::LaunchOptions options = base::LaunchOptionsForTest();
(...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after
1799 cmd = cmd.Append(L"calc.exe"); 1799 cmd = cmd.Append(L"calc.exe");
1800 1800
1801 std::wstring test_command(base::StringPrintf(L"TestChildProcess %ls 0x%08X", 1801 std::wstring test_command(base::StringPrintf(L"TestChildProcess %ls 0x%08X",
1802 cmd.value().c_str(), 1802 cmd.value().c_str(),
1803 STATUS_ACCESS_VIOLATION)); 1803 STATUS_ACCESS_VIOLATION));
1804 1804
1805 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(test_command.c_str())); 1805 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(test_command.c_str()));
1806 } 1806 }
1807 1807
1808 } // namespace sandbox 1808 } // namespace sandbox
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698