OLD | NEW |
1 // Copyright 2015 The Crashpad Authors. All rights reserved. | 1 // Copyright 2015 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 } | 518 } |
519 | 519 |
520 struct ScopedRegistryKeyCloseTraits { | 520 struct ScopedRegistryKeyCloseTraits { |
521 static HKEY InvalidValue() { | 521 static HKEY InvalidValue() { |
522 return nullptr; | 522 return nullptr; |
523 } | 523 } |
524 static void Free(HKEY key) { | 524 static void Free(HKEY key) { |
525 RegCloseKey(key); | 525 RegCloseKey(key); |
526 } | 526 } |
527 }; | 527 }; |
| 528 |
528 using ScopedRegistryKey = | 529 using ScopedRegistryKey = |
529 base::ScopedGeneric<HKEY, ScopedRegistryKeyCloseTraits>; | 530 base::ScopedGeneric<HKEY, ScopedRegistryKeyCloseTraits>; |
530 | 531 |
531 TEST(ProcessInfo, Handles) { | 532 TEST(ProcessInfo, Handles) { |
532 ScopedTempDir temp_dir; | 533 ScopedTempDir temp_dir; |
533 | 534 |
534 ScopedFileHandle file(LoggingOpenFileForWrite( | 535 ScopedFileHandle file(LoggingOpenFileForWrite( |
535 temp_dir.path().Append(FILE_PATH_LITERAL("test_file")), | 536 temp_dir.path().Append(FILE_PATH_LITERAL("test_file")), |
536 FileWriteMode::kTruncateOrCreate, | 537 FileWriteMode::kTruncateOrCreate, |
537 FilePermissions::kWorldReadable)); | 538 FilePermissions::kWorldReadable)); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 EXPECT_TRUE( | 639 EXPECT_TRUE( |
639 info.LoggingRangeIsFullyReadable(CheckedRange<WinVMAddress, WinVMSize>( | 640 info.LoggingRangeIsFullyReadable(CheckedRange<WinVMAddress, WinVMSize>( |
640 reinterpret_cast<WinVMAddress>(safe_memory.get()), kAllocationSize))); | 641 reinterpret_cast<WinVMAddress>(safe_memory.get()), kAllocationSize))); |
641 EXPECT_FALSE(info.LoggingRangeIsFullyReadable( | 642 EXPECT_FALSE(info.LoggingRangeIsFullyReadable( |
642 CheckedRange<WinVMAddress, WinVMSize>(0, 1024))); | 643 CheckedRange<WinVMAddress, WinVMSize>(0, 1024))); |
643 } | 644 } |
644 | 645 |
645 } // namespace | 646 } // namespace |
646 } // namespace test | 647 } // namespace test |
647 } // namespace crashpad | 648 } // namespace crashpad |
OLD | NEW |