OLD | NEW |
1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 // right, so treat it as documented. | 438 // right, so treat it as documented. |
439 base::mac::ScopedMachSendRight object_owner(object); | 439 base::mac::ScopedMachSendRight object_owner(object); |
440 | 440 |
441 return address >= region_address && address <= region_address + region_size; | 441 return address >= region_address && address <= region_address + region_size; |
442 } | 442 } |
443 | 443 |
444 if (kr == KERN_INVALID_ADDRESS) { | 444 if (kr == KERN_INVALID_ADDRESS) { |
445 return false; | 445 return false; |
446 } | 446 } |
447 | 447 |
448 ADD_FAILURE() << MachErrorMessage(kr, "vm_region_64");; | 448 ADD_FAILURE() << MachErrorMessage(kr, "vm_region_64"); |
449 return false; | 449 return false; |
450 } | 450 } |
451 | 451 |
452 TEST(TaskMemory, MappedMemoryDeallocates) { | 452 TEST(TaskMemory, MappedMemoryDeallocates) { |
453 // This tests that once a TaskMemory::MappedMemory object is destroyed, it | 453 // This tests that once a TaskMemory::MappedMemory object is destroyed, it |
454 // releases the mapped memory that it owned. Technically, this test is not | 454 // releases the mapped memory that it owned. Technically, this test is not |
455 // valid because after the mapping is released, something else (on another | 455 // valid because after the mapping is released, something else (on another |
456 // thread) might wind up mapped in the same address. In the test environment, | 456 // thread) might wind up mapped in the same address. In the test environment, |
457 // hopefully there are either no other threads or they’re all quiescent, so | 457 // hopefully there are either no other threads or they’re all quiescent, so |
458 // nothing else should wind up mapped in the address. | 458 // nothing else should wind up mapped in the address. |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 EXPECT_EQ("", string); | 546 EXPECT_EQ("", string); |
547 | 547 |
548 // These are still out of range. | 548 // These are still out of range. |
549 EXPECT_FALSE(mapped->ReadCString(11, &string)); | 549 EXPECT_FALSE(mapped->ReadCString(11, &string)); |
550 EXPECT_FALSE(mapped->ReadCString(12, &string)); | 550 EXPECT_FALSE(mapped->ReadCString(12, &string)); |
551 } | 551 } |
552 | 552 |
553 } // namespace | 553 } // namespace |
554 } // namespace test | 554 } // namespace test |
555 } // namespace crashpad | 555 } // namespace crashpad |
OLD | NEW |