| 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 "third_party/mojo/src/mojo/edk/embedder/simple_platform_shared_buffer.h
" | 5 #include "mojo/edk/embedder/simple_platform_shared_buffer.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "mojo/public/cpp/system/macros.h" | 11 #include "mojo/public/cpp/system/macros.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 13 |
| 14 namespace mojo { | 14 namespace mojo { |
| 15 namespace embedder { | 15 namespace edk { |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 TEST(SimplePlatformSharedBufferTest, Basic) { | 18 TEST(SimplePlatformSharedBufferTest, Basic) { |
| 19 const size_t kNumInts = 100; | 19 const size_t kNumInts = 100; |
| 20 const size_t kNumBytes = kNumInts * sizeof(int); | 20 const size_t kNumBytes = kNumInts * sizeof(int); |
| 21 // A fudge so that we're not just writing zero bytes 75% of the time. | 21 // A fudge so that we're not just writing zero bytes 75% of the time. |
| 22 const int kFudge = 1234567890; | 22 const int kFudge = 1234567890; |
| 23 | 23 |
| 24 // Make some memory. | 24 // Make some memory. |
| 25 scoped_refptr<SimplePlatformSharedBuffer> buffer( | 25 scoped_refptr<SimplePlatformSharedBuffer> buffer( |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 static_cast<char*>(mapping1->GetBase())[50] = 'x'; | 176 static_cast<char*>(mapping1->GetBase())[50] = 'x'; |
| 177 } | 177 } |
| 178 | 178 |
| 179 EXPECT_EQ('x', static_cast<char*>(mapping2->GetBase())[0]); | 179 EXPECT_EQ('x', static_cast<char*>(mapping2->GetBase())[0]); |
| 180 | 180 |
| 181 static_cast<char*>(mapping2->GetBase())[1] = 'y'; | 181 static_cast<char*>(mapping2->GetBase())[1] = 'y'; |
| 182 EXPECT_EQ('y', static_cast<char*>(mapping1->GetBase())[51]); | 182 EXPECT_EQ('y', static_cast<char*>(mapping1->GetBase())[51]); |
| 183 } | 183 } |
| 184 | 184 |
| 185 } // namespace | 185 } // namespace |
| 186 } // namespace embedder | 186 } // namespace edk |
| 187 } // namespace mojo | 187 } // namespace mojo |
| OLD | NEW |