| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome_elf/create_file/chrome_create_file.h" | 5 #include "chrome_elf/create_file/chrome_create_file.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 | 8 |
| 9 #include <bitset> | 9 #include <bitset> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 RunChecks(FILE_FLAG_OPEN_REPARSE_POINT, true); | 336 RunChecks(FILE_FLAG_OPEN_REPARSE_POINT, true); |
| 337 ResetNtCreateFileCalls(); | 337 ResetNtCreateFileCalls(); |
| 338 } | 338 } |
| 339 | 339 |
| 340 TEST_F(ChromeCreateFileTest, CheckParams_FILE_FLAG_OPEN_NO_RECALL) { | 340 TEST_F(ChromeCreateFileTest, CheckParams_FILE_FLAG_OPEN_NO_RECALL) { |
| 341 RedirectNtCreateFileCalls(); | 341 RedirectNtCreateFileCalls(); |
| 342 RunChecks(FILE_FLAG_OPEN_NO_RECALL, true); | 342 RunChecks(FILE_FLAG_OPEN_NO_RECALL, true); |
| 343 ResetNtCreateFileCalls(); | 343 ResetNtCreateFileCalls(); |
| 344 } | 344 } |
| 345 | 345 |
| 346 TEST_F(ChromeCreateFileTest, CanaryTest) { | |
| 347 EXPECT_TRUE(IsCanary(L"C:\\Users\\user\\AppData\\Local\\Google\\Chrome SxS")); | |
| 348 EXPECT_FALSE(IsCanary(L"C:\\Users\\user\\AppData\\Local\\Google\\Chrome")); | |
| 349 EXPECT_FALSE(IsCanary(L"C:\\Users\\user\\AppData\\Local\\Chromium")); | |
| 350 } | |
| 351 | |
| 352 TEST_F(ChromeCreateFileTest, BypassTest) { | 346 TEST_F(ChromeCreateFileTest, BypassTest) { |
| 353 std::wstring UNC_filepath_file(L"\\\\.\\some_file.txt"); | 347 std::wstring UNC_filepath_file(L"\\\\.\\some_file.txt"); |
| 354 | 348 |
| 355 base::FilePath local_path; | 349 base::FilePath local_path; |
| 356 PathService::Get(base::DIR_LOCAL_APP_DATA, &local_path); | 350 PathService::Get(base::DIR_LOCAL_APP_DATA, &local_path); |
| 357 | 351 |
| 358 base::FilePath local_prefs_path = local_path.Append(kAppDataDirName).Append( | 352 base::FilePath local_prefs_path = local_path.Append(kAppDataDirName).Append( |
| 359 kUserDataDirName).Append(L"default\\Preferences"); | 353 kUserDataDirName).Append(L"default\\Preferences"); |
| 360 base::FilePath local_state_path = local_path.Append(kAppDataDirName).Append( | 354 base::FilePath local_state_path = local_path.Append(kAppDataDirName).Append( |
| 361 kUserDataDirName).Append(L"ninja\\Local State"); | 355 kUserDataDirName).Append(L"ninja\\Local State"); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 388 g_ntdll_lookup["NtCreateFile"]); | 382 g_ntdll_lookup["NtCreateFile"]); |
| 389 } | 383 } |
| 390 | 384 |
| 391 TEST_F(ChromeCreateFileTest, ReadWriteFromNtDll) { | 385 TEST_F(ChromeCreateFileTest, ReadWriteFromNtDll) { |
| 392 base::FilePath file_name = temp_dir_.path().Append(L"some_file.txt"); | 386 base::FilePath file_name = temp_dir_.path().Append(L"some_file.txt"); |
| 393 DoWriteCheck(file_name, FILE_ATTRIBUTE_NORMAL, false); | 387 DoWriteCheck(file_name, FILE_ATTRIBUTE_NORMAL, false); |
| 394 DoReadCheck(file_name, FILE_ATTRIBUTE_NORMAL, false); | 388 DoReadCheck(file_name, FILE_ATTRIBUTE_NORMAL, false); |
| 395 } | 389 } |
| 396 | 390 |
| 397 } // namespace | 391 } // namespace |
| OLD | NEW |