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 "mojo/edk/system/memory.h" | 5 #include "mojo/edk/system/memory.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <limits> | 10 #include <limits> |
11 | 11 |
12 #include "mojo/public/c/system/macros.h" | 12 #include "mojo/public/c/system/macros.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 namespace mojo { | 15 namespace mojo { |
16 namespace system { | 16 namespace edk { |
17 namespace { | 17 namespace { |
18 | 18 |
19 TEST(MemoryTest, Valid) { | 19 TEST(MemoryTest, Valid) { |
20 char my_char; | 20 char my_char; |
21 int32_t my_int32; | 21 int32_t my_int32; |
22 int64_t my_int64_array[5] = {}; // Zero initialize. | 22 int64_t my_int64_array[5] = {}; // Zero initialize. |
23 | 23 |
24 UserPointer<char> my_char_ptr(&my_char); | 24 UserPointer<char> my_char_ptr(&my_char); |
25 UserPointer<int32_t> my_int32_ptr(&my_int32); | 25 UserPointer<int32_t> my_int32_ptr(&my_int32); |
26 UserPointer<int64_t> my_int64_array_ptr(my_int64_array); | 26 UserPointer<int64_t> my_int64_array_ptr(my_int64_array); |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 UserPointer<const int32_t> ptr(&x); | 283 UserPointer<const int32_t> ptr(&x); |
284 EXPECT_DEATH_IF_SUPPORTED(ptr.CheckArray(kTooBig), kMemoryCheckFailedRegex); | 284 EXPECT_DEATH_IF_SUPPORTED(ptr.CheckArray(kTooBig), kMemoryCheckFailedRegex); |
285 EXPECT_DEATH_IF_SUPPORTED(ptr.GetArray(&x, kTooBig), | 285 EXPECT_DEATH_IF_SUPPORTED(ptr.GetArray(&x, kTooBig), |
286 kMemoryCheckFailedRegex); | 286 kMemoryCheckFailedRegex); |
287 } | 287 } |
288 | 288 |
289 // TODO(vtl): Tests for |UserPointer{Reader,Writer,ReaderWriter}|. | 289 // TODO(vtl): Tests for |UserPointer{Reader,Writer,ReaderWriter}|. |
290 } | 290 } |
291 | 291 |
292 } // namespace | 292 } // namespace |
293 } // namespace system | 293 } // namespace edk |
294 } // namespace mojo | 294 } // namespace mojo |
OLD | NEW |