| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/common/host_shared_bitmap_manager.h" | 5 #include "content/common/host_shared_bitmap_manager.h" |
| 6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
| 7 | 7 |
| 8 namespace content { | 8 namespace content { |
| 9 namespace { | 9 namespace { |
| 10 | 10 |
| 11 class HostSharedBitmapManagerTest : public testing::Test { | 11 class HostSharedBitmapManagerTest : public testing::Test { |
| 12 protected: | 12 protected: |
| 13 virtual void SetUp() { manager_.reset(new HostSharedBitmapManager()); } | 13 void SetUp() override { manager_.reset(new HostSharedBitmapManager()); } |
| 14 scoped_ptr<HostSharedBitmapManager> manager_; | 14 scoped_ptr<HostSharedBitmapManager> manager_; |
| 15 }; | 15 }; |
| 16 | 16 |
| 17 TEST_F(HostSharedBitmapManagerTest, TestCreate) { | 17 TEST_F(HostSharedBitmapManagerTest, TestCreate) { |
| 18 gfx::Size bitmap_size(1, 1); | 18 gfx::Size bitmap_size(1, 1); |
| 19 size_t size_in_bytes; | 19 size_t size_in_bytes; |
| 20 EXPECT_TRUE(cc::SharedBitmap::SizeInBytes(bitmap_size, &size_in_bytes)); | 20 EXPECT_TRUE(cc::SharedBitmap::SizeInBytes(bitmap_size, &size_in_bytes)); |
| 21 scoped_ptr<base::SharedMemory> bitmap(new base::SharedMemory()); | 21 scoped_ptr<base::SharedMemory> bitmap(new base::SharedMemory()); |
| 22 bitmap->CreateAndMapAnonymous(size_in_bytes); | 22 bitmap->CreateAndMapAnonymous(size_in_bytes); |
| 23 memset(bitmap->memory(), 0xff, size_in_bytes); | 23 memset(bitmap->memory(), 0xff, size_in_bytes); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 | 151 |
| 152 scoped_ptr<cc::SharedBitmap> shared_bitmap; | 152 scoped_ptr<cc::SharedBitmap> shared_bitmap; |
| 153 shared_bitmap = manager_->GetSharedBitmapFromId(bitmap_size, id); | 153 shared_bitmap = manager_->GetSharedBitmapFromId(bitmap_size, id); |
| 154 ASSERT_TRUE(shared_bitmap.get() != NULL); | 154 ASSERT_TRUE(shared_bitmap.get() != NULL); |
| 155 EXPECT_EQ(memcmp(shared_bitmap->pixels(), bitmap->memory(), size_in_bytes), | 155 EXPECT_EQ(memcmp(shared_bitmap->pixels(), bitmap->memory(), size_in_bytes), |
| 156 0); | 156 0); |
| 157 } | 157 } |
| 158 | 158 |
| 159 } // namespace | 159 } // namespace |
| 160 } // namespace content | 160 } // namespace content |
| OLD | NEW |