OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "cc/output/buffer_to_texture_target_map.h" |
| 6 |
| 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 #include "ui/gfx/buffer_types.h" |
| 9 |
| 10 namespace cc { |
| 11 namespace { |
| 12 |
| 13 // Ensures that a map populated with various values can be serialized to/from |
| 14 // string successfully. |
| 15 TEST(BufferToTextureTargetMapTest, SerializeRoundTrip) { |
| 16 BufferToTextureTargetMap test_map; |
| 17 uint32_t next_value = 0; |
| 18 for (int usage_idx = 0; usage_idx <= static_cast<int>(gfx::BufferUsage::LAST); |
| 19 ++usage_idx) { |
| 20 gfx::BufferUsage usage = static_cast<gfx::BufferUsage>(usage_idx); |
| 21 for (int format_idx = 0; |
| 22 format_idx <= static_cast<int>(gfx::BufferFormat::LAST); |
| 23 ++format_idx) { |
| 24 gfx::BufferFormat format = static_cast<gfx::BufferFormat>(format_idx); |
| 25 test_map.insert(BufferToTextureTargetMap::value_type( |
| 26 BufferToTextureTargetKey(usage, format), next_value++)); |
| 27 } |
| 28 } |
| 29 |
| 30 std::string serialized_map = BufferToTextureTargetMapToString(test_map); |
| 31 BufferToTextureTargetMap deserialized_map = |
| 32 StringToBufferToTextureTargetMap(serialized_map); |
| 33 EXPECT_EQ(test_map, deserialized_map); |
| 34 } |
| 35 |
| 36 } // namespace |
| 37 } // namespace cc |
OLD | NEW |