| Index: cc/output/buffer_to_texture_target_map_unittest.cc
|
| diff --git a/cc/output/buffer_to_texture_target_map_unittest.cc b/cc/output/buffer_to_texture_target_map_unittest.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..75543d54f4e8a1d711f54772b526ee150f1745bb
|
| --- /dev/null
|
| +++ b/cc/output/buffer_to_texture_target_map_unittest.cc
|
| @@ -0,0 +1,37 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "cc/output/buffer_to_texture_target_map.h"
|
| +
|
| +#include "testing/gtest/include/gtest/gtest.h"
|
| +#include "ui/gfx/buffer_types.h"
|
| +
|
| +namespace cc {
|
| +namespace {
|
| +
|
| +// Ensures that a map populated with various values can be serialized to/from
|
| +// string successfully.
|
| +TEST(BufferToTextureTargetMapTest, SerializeRoundTrip) {
|
| + BufferToTextureTargetMap test_map;
|
| + uint32_t next_value = 0;
|
| + for (size_t usage_idx = 0;
|
| + usage_idx < static_cast<size_t>(gfx::BufferUsage::LAST) + 1;
|
| + ++usage_idx) {
|
| + gfx::BufferUsage usage = static_cast<gfx::BufferUsage>(usage_idx);
|
| + for (size_t format_idx = 0;
|
| + format_idx < static_cast<size_t>(gfx::BufferFormat::LAST) + 1;
|
| + ++format_idx) {
|
| + gfx::BufferFormat format = static_cast<gfx::BufferFormat>(format_idx);
|
| + test_map.emplace(BufferToTextureTargetKey(usage, format), next_value++);
|
| + }
|
| + }
|
| +
|
| + std::string serialized_map = BufferToTextureTargetMapToString(test_map);
|
| + BufferToTextureTargetMap deserialized_map =
|
| + StringToBufferToTextureTargetMap(serialized_map);
|
| + EXPECT_EQ(test_map, deserialized_map);
|
| +}
|
| +
|
| +} // namespace
|
| +} // namespace cc
|
|
|