Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2905)

Unified Diff: cc/output/buffer_to_texture_target_map_unittest.cc

Issue 2120713002: Fix use_image_texture_target inconsistencies (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix content browsertests Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/output/buffer_to_texture_target_map.cc ('k') | cc/output/renderer_settings.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..79e624035b54354a44d83f80a536050fab5c4f9c
--- /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 (int usage_idx = 0; usage_idx <= static_cast<int>(gfx::BufferUsage::LAST);
+ ++usage_idx) {
+ gfx::BufferUsage usage = static_cast<gfx::BufferUsage>(usage_idx);
+ for (int format_idx = 0;
+ format_idx <= static_cast<int>(gfx::BufferFormat::LAST);
+ ++format_idx) {
+ gfx::BufferFormat format = static_cast<gfx::BufferFormat>(format_idx);
+ test_map.insert(BufferToTextureTargetMap::value_type(
+ 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
« no previous file with comments | « cc/output/buffer_to_texture_target_map.cc ('k') | cc/output/renderer_settings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698