OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/child/shared_memory_data_consumer_handle.h" | 5 #include "content/child/shared_memory_data_consumer_handle.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 } | 809 } |
810 | 810 |
811 TEST_P(SharedMemoryDataConsumerHandleTest, FailWhileTwoPhaseReadIsInProgress) { | 811 TEST_P(SharedMemoryDataConsumerHandleTest, FailWhileTwoPhaseReadIsInProgress) { |
812 Result result; | 812 Result result; |
813 const void* pointer = nullptr; | 813 const void* pointer = nullptr; |
814 size_t size = 0; | 814 size_t size = 0; |
815 auto reader = handle_->ObtainReader(nullptr); | 815 auto reader = handle_->ObtainReader(nullptr); |
816 | 816 |
817 writer_->AddData(NewFixedData("Once ")); | 817 writer_->AddData(NewFixedData("Once ")); |
818 result = reader->beginRead(&pointer, kNone, &size); | 818 result = reader->beginRead(&pointer, kNone, &size); |
819 auto buffer = static_cast<const char*>(pointer); | 819 auto* buffer = static_cast<const char*>(pointer); |
820 | 820 |
821 ASSERT_EQ(kOk, result); | 821 ASSERT_EQ(kOk, result); |
822 ASSERT_NE(nullptr, pointer); | 822 ASSERT_NE(nullptr, pointer); |
823 ASSERT_EQ(size, 5u); | 823 ASSERT_EQ(size, 5u); |
824 | 824 |
825 writer_->Fail(); | 825 writer_->Fail(); |
826 | 826 |
827 // We can access the buffer after calling |Fail|. I hope ASAN will detect | 827 // We can access the buffer after calling |Fail|. I hope ASAN will detect |
828 // an error if the region is already freed. | 828 // an error if the region is already freed. |
829 EXPECT_EQ('O', buffer[0]); | 829 EXPECT_EQ('O', buffer[0]); |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1051 logger->log()); | 1051 logger->log()); |
1052 } | 1052 } |
1053 | 1053 |
1054 INSTANTIATE_TEST_CASE_P(SharedMemoryDataConsumerHandleTest, | 1054 INSTANTIATE_TEST_CASE_P(SharedMemoryDataConsumerHandleTest, |
1055 SharedMemoryDataConsumerHandleTest, | 1055 SharedMemoryDataConsumerHandleTest, |
1056 ::testing::Values(kApplyBackpressure, | 1056 ::testing::Values(kApplyBackpressure, |
1057 kDoNotApplyBackpressure)); | 1057 kDoNotApplyBackpressure)); |
1058 } // namespace | 1058 } // namespace |
1059 | 1059 |
1060 } // namespace content | 1060 } // namespace content |
OLD | NEW |