Project import generated by Copybara.
PiperOrigin-RevId: 224614037
Change-Id: I14e53449d4aeccb328f86828c76b5f09dea0d4b8
diff --git a/http2/platform/api/http2_arraysize.h b/http2/platform/api/http2_arraysize.h
new file mode 100644
index 0000000..417e53b
--- /dev/null
+++ b/http2/platform/api/http2_arraysize.h
@@ -0,0 +1,12 @@
+// Copyright 2018 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.
+
+#ifndef QUICHE_HTTP2_PLATFORM_API_HTTP2_ARRAYSIZE_H_
+#define QUICHE_HTTP2_PLATFORM_API_HTTP2_ARRAYSIZE_H_
+
+#include "net/http2/platform/impl/http2_arraysize_impl.h"
+
+#define HTTP2_ARRAYSIZE(x) HTTP2_ARRAYSIZE_IMPL(x)
+
+#endif // QUICHE_HTTP2_PLATFORM_API_HTTP2_ARRAYSIZE_H_
diff --git a/http2/platform/api/http2_bug_tracker.h b/http2/platform/api/http2_bug_tracker.h
new file mode 100644
index 0000000..93ad677
--- /dev/null
+++ b/http2/platform/api/http2_bug_tracker.h
@@ -0,0 +1,15 @@
+// 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.
+
+#ifndef QUICHE_HTTP2_PLATFORM_API_HTTP2_BUG_TRACKER_H_
+#define QUICHE_HTTP2_PLATFORM_API_HTTP2_BUG_TRACKER_H_
+
+#include "net/http2/platform/impl/http2_bug_tracker_impl.h"
+
+#define HTTP2_BUG HTTP2_BUG_IMPL
+#define HTTP2_BUG_IF HTTP2_BUG_IF_IMPL
+#define FLAGS_http2_always_log_bugs_for_tests \
+ FLAGS_http2_always_log_bugs_for_tests_IMPL
+
+#endif // QUICHE_HTTP2_PLATFORM_API_HTTP2_BUG_TRACKER_H_
diff --git a/http2/platform/api/http2_containers.h b/http2/platform/api/http2_containers.h
new file mode 100644
index 0000000..e748e7b
--- /dev/null
+++ b/http2/platform/api/http2_containers.h
@@ -0,0 +1,17 @@
+#ifndef QUICHE_HTTP2_PLATFORM_API_HTTP2_CONTAINERS_H_
+#define QUICHE_HTTP2_PLATFORM_API_HTTP2_CONTAINERS_H_
+
+#include "net/http2/platform/impl/http2_containers_impl.h"
+
+namespace http2 {
+
+// Represents a double-ended queue which may be backed by a list or a flat
+// circular buffer.
+//
+// DOES NOT GUARANTEE POINTER OR ITERATOR STABILITY!
+template <typename T>
+using Http2Deque = Http2DequeImpl<T>;
+
+} // namespace http2
+
+#endif // QUICHE_HTTP2_PLATFORM_API_HTTP2_CONTAINERS_H_
diff --git a/http2/platform/api/http2_estimate_memory_usage.h b/http2/platform/api/http2_estimate_memory_usage.h
new file mode 100644
index 0000000..fd405fa
--- /dev/null
+++ b/http2/platform/api/http2_estimate_memory_usage.h
@@ -0,0 +1,21 @@
+// Copyright 2017 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.
+
+#ifndef QUICHE_HTTP2_PLATFORM_API_HTTP2_ESTIMATE_MEMORY_USAGE_H_
+#define QUICHE_HTTP2_PLATFORM_API_HTTP2_ESTIMATE_MEMORY_USAGE_H_
+
+#include <cstddef>
+
+#include "net/http2/platform/impl/http2_estimate_memory_usage_impl.h"
+
+namespace http2 {
+
+template <class T>
+size_t Http2EstimateMemoryUsage(const T& object) {
+ return Http2EstimateMemoryUsageImpl(object);
+}
+
+} // namespace http2
+
+#endif // QUICHE_HTTP2_PLATFORM_API_HTTP2_ESTIMATE_MEMORY_USAGE_H_
diff --git a/http2/platform/api/http2_export.h b/http2/platform/api/http2_export.h
new file mode 100644
index 0000000..e262f74
--- /dev/null
+++ b/http2/platform/api/http2_export.h
@@ -0,0 +1,10 @@
+// Copyright 2017 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.
+
+#ifndef QUICHE_HTTP2_PLATFORM_API_HTTP2_EXPORT_H_
+#define QUICHE_HTTP2_PLATFORM_API_HTTP2_EXPORT_H_
+
+#include "net/http2/platform/impl/http2_export_impl.h"
+
+#endif // QUICHE_HTTP2_PLATFORM_API_HTTP2_EXPORT_H_
diff --git a/http2/platform/api/http2_flag_utils.h b/http2/platform/api/http2_flag_utils.h
new file mode 100644
index 0000000..4303c43
--- /dev/null
+++ b/http2/platform/api/http2_flag_utils.h
@@ -0,0 +1,12 @@
+// Copyright 2018 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.
+
+#ifndef QUICHE_HTTP2_PLATFORM_API_HTTP2_FLAG_UTILS_H_
+#define QUICHE_HTTP2_PLATFORM_API_HTTP2_FLAG_UTILS_H_
+
+#include "net/http2/platform/impl/http2_flag_utils_impl.h"
+
+#define HTTP2_RELOADABLE_FLAG_COUNT HTTP2_RELOADABLE_FLAG_COUNT_IMPL
+
+#endif // QUICHE_HTTP2_PLATFORM_API_HTTP2_FLAG_UTILS_H_
diff --git a/http2/platform/api/http2_flags.h b/http2/platform/api/http2_flags.h
new file mode 100644
index 0000000..08f95da
--- /dev/null
+++ b/http2/platform/api/http2_flags.h
@@ -0,0 +1,14 @@
+// Copyright 2018 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.
+
+#ifndef QUICHE_HTTP2_PLATFORM_API_HTTP2_FLAGS_H_
+#define QUICHE_HTTP2_PLATFORM_API_HTTP2_FLAGS_H_
+
+#include "net/http2/platform/impl/http2_flags_impl.h"
+
+#define GetHttp2ReloadableFlag(flag) GetHttp2ReloadableFlagImpl(flag)
+#define SetHttp2ReloadableFlag(flag, value) \
+ SetHttp2ReloadableFlagImpl(flag, value)
+
+#endif // QUICHE_HTTP2_PLATFORM_API_HTTP2_FLAGS_H_
diff --git a/http2/platform/api/http2_macros.h b/http2/platform/api/http2_macros.h
new file mode 100644
index 0000000..0be5e89
--- /dev/null
+++ b/http2/platform/api/http2_macros.h
@@ -0,0 +1,10 @@
+#ifndef QUICHE_HTTP2_PLATFORM_API_HTTP2_MACROS_H_
+#define QUICHE_HTTP2_PLATFORM_API_HTTP2_MACROS_H_
+
+#include "net/http2/platform/impl/http2_macros_impl.h"
+
+#define HTTP2_FALLTHROUGH HTTP2_FALLTHROUGH_IMPL
+#define HTTP2_UNREACHABLE() HTTP2_UNREACHABLE_IMPL()
+#define HTTP2_DIE_IF_NULL(ptr) HTTP2_DIE_IF_NULL_IMPL(ptr)
+
+#endif // QUICHE_HTTP2_PLATFORM_API_HTTP2_MACROS_H_
diff --git a/http2/platform/api/http2_mock_log.h b/http2/platform/api/http2_mock_log.h
new file mode 100644
index 0000000..3d16837
--- /dev/null
+++ b/http2/platform/api/http2_mock_log.h
@@ -0,0 +1,18 @@
+// Copyright 2018 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.
+
+#ifndef QUICHE_HTTP2_PLATFORM_API_HTTP2_MOCK_LOG_H_
+#define QUICHE_HTTP2_PLATFORM_API_HTTP2_MOCK_LOG_H_
+
+#include "net/http2/platform/impl/http2_mock_log_impl.h"
+
+using Http2MockLog = Http2MockLogImpl;
+#define CREATE_HTTP2_MOCK_LOG(log) CREATE_HTTP2_MOCK_LOG_IMPL(log)
+
+#define EXPECT_HTTP2_LOG_CALL(log) EXPECT_HTTP2_LOG_CALL_IMPL(log)
+
+#define EXPECT_HTTP2_LOG_CALL_CONTAINS(log, level, content) \
+ EXPECT_HTTP2_LOG_CALL_CONTAINS_IMPL(log, level, content)
+
+#endif // QUICHE_HTTP2_PLATFORM_API_HTTP2_MOCK_LOG_H_
diff --git a/http2/platform/api/http2_optional.h b/http2/platform/api/http2_optional.h
new file mode 100644
index 0000000..64ce5f5
--- /dev/null
+++ b/http2/platform/api/http2_optional.h
@@ -0,0 +1,19 @@
+// Copyright 2018 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.
+
+#ifndef QUICHE_HTTP2_PLATFORM_API_HTTP2_OPTIONAL_H_
+#define QUICHE_HTTP2_PLATFORM_API_HTTP2_OPTIONAL_H_
+
+#include <utility>
+
+#include "net/http2/platform/impl/http2_optional_impl.h"
+
+namespace http2 {
+
+template <typename T>
+using Http2Optional = Http2OptionalImpl<T>;
+
+} // namespace http2
+
+#endif // QUICHE_HTTP2_PLATFORM_API_HTTP2_OPTIONAL_H_
diff --git a/http2/platform/api/http2_ptr_util.h b/http2/platform/api/http2_ptr_util.h
new file mode 100644
index 0000000..2530e7c
--- /dev/null
+++ b/http2/platform/api/http2_ptr_util.h
@@ -0,0 +1,22 @@
+// Copyright 2018 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.
+
+#ifndef QUICHE_HTTP2_PLATFORM_API_HTTP2_PTR_UTIL_H_
+#define QUICHE_HTTP2_PLATFORM_API_HTTP2_PTR_UTIL_H_
+
+#include <memory>
+#include <utility>
+
+#include "net/http2/platform/impl/http2_ptr_util_impl.h"
+
+namespace http2 {
+
+template <typename T, typename... Args>
+std::unique_ptr<T> Http2MakeUnique(Args&&... args) {
+ return Http2MakeUniqueImpl<T>(std::forward<Args>(args)...);
+}
+
+} // namespace http2
+
+#endif // QUICHE_HTTP2_PLATFORM_API_HTTP2_PTR_UTIL_H_
diff --git a/http2/platform/api/http2_reconstruct_object.h b/http2/platform/api/http2_reconstruct_object.h
new file mode 100644
index 0000000..ddcb312
--- /dev/null
+++ b/http2/platform/api/http2_reconstruct_object.h
@@ -0,0 +1,34 @@
+// Copyright 2017 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.
+
+#ifndef QUICHE_HTTP2_PLATFORM_API_HTTP2_RECONSTRUCT_OBJECT_H_
+#define QUICHE_HTTP2_PLATFORM_API_HTTP2_RECONSTRUCT_OBJECT_H_
+
+#include <utility>
+
+#include "net/http2/platform/impl/http2_reconstruct_object_impl.h"
+
+namespace http2 {
+namespace test {
+
+class Http2Random;
+
+// Reconstruct an object so that it is initialized as when it was first
+// constructed. Runs the destructor to handle objects that might own resources,
+// and runs the constructor with the provided arguments, if any.
+template <class T, class... Args>
+void Http2ReconstructObject(T* ptr, Http2Random* rng, Args&&... args) {
+ Http2ReconstructObjectImpl(ptr, rng, std::forward<Args>(args)...);
+}
+
+// This version applies default-initialization to the object.
+template <class T>
+void Http2DefaultReconstructObject(T* ptr, Http2Random* rng) {
+ Http2DefaultReconstructObjectImpl(ptr, rng);
+}
+
+} // namespace test
+} // namespace http2
+
+#endif // QUICHE_HTTP2_PLATFORM_API_HTTP2_RECONSTRUCT_OBJECT_H_
diff --git a/http2/platform/api/http2_string.h b/http2/platform/api/http2_string.h
new file mode 100644
index 0000000..25f9e59
--- /dev/null
+++ b/http2/platform/api/http2_string.h
@@ -0,0 +1,16 @@
+// Copyright (c) 2017 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.
+
+#ifndef QUICHE_HTTP2_PLATFORM_API_HTTP2_STRING_H_
+#define QUICHE_HTTP2_PLATFORM_API_HTTP2_STRING_H_
+
+#include "net/http2/platform/impl/http2_string_impl.h"
+
+namespace http2 {
+
+using Http2String = Http2StringImpl;
+
+} // namespace http2
+
+#endif // QUICHE_HTTP2_PLATFORM_API_HTTP2_STRING_H_
diff --git a/http2/platform/api/http2_string_piece.h b/http2/platform/api/http2_string_piece.h
new file mode 100644
index 0000000..92fb3ef
--- /dev/null
+++ b/http2/platform/api/http2_string_piece.h
@@ -0,0 +1,16 @@
+// Copyright (c) 2017 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.
+
+#ifndef QUICHE_HTTP2_PLATFORM_API_HTTP2_STRING_PIECE_H_
+#define QUICHE_HTTP2_PLATFORM_API_HTTP2_STRING_PIECE_H_
+
+#include "net/http2/platform/impl/http2_string_piece_impl.h"
+
+namespace http2 {
+
+using Http2StringPiece = Http2StringPieceImpl;
+
+} // namespace http2
+
+#endif // QUICHE_HTTP2_PLATFORM_API_HTTP2_STRING_PIECE_H_
diff --git a/http2/platform/api/http2_string_utils.h b/http2/platform/api/http2_string_utils.h
new file mode 100644
index 0000000..ba40560
--- /dev/null
+++ b/http2/platform/api/http2_string_utils.h
@@ -0,0 +1,56 @@
+// Copyright 2017 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.
+
+#ifndef QUICHE_HTTP2_PLATFORM_API_HTTP2_STRING_UTILS_H_
+#define QUICHE_HTTP2_PLATFORM_API_HTTP2_STRING_UTILS_H_
+
+#include <type_traits>
+#include <utility>
+
+#include "net/third_party/quiche/src/http2/platform/api/http2_string.h"
+#include "net/third_party/quiche/src/http2/platform/api/http2_string_piece.h"
+#include "net/http2/platform/impl/http2_string_utils_impl.h"
+
+namespace http2 {
+
+template <typename... Args>
+inline Http2String Http2StrCat(const Args&... args) {
+ return Http2StrCatImpl(std::forward<const Args&>(args)...);
+}
+
+template <typename... Args>
+inline void Http2StrAppend(Http2String* output, const Args&... args) {
+ Http2StrAppendImpl(output, std::forward<const Args&>(args)...);
+}
+
+template <typename... Args>
+inline Http2String Http2StringPrintf(const Args&... args) {
+ return Http2StringPrintfImpl(std::forward<const Args&>(args)...);
+}
+
+inline Http2String Http2HexEncode(const void* bytes, size_t size) {
+ return Http2HexEncodeImpl(bytes, size);
+}
+
+inline Http2String Http2HexDecode(Http2StringPiece data) {
+ return Http2HexDecodeImpl(data);
+}
+
+inline Http2String Http2HexDump(Http2StringPiece data) {
+ return Http2HexDumpImpl(data);
+}
+
+inline Http2String Http2HexEscape(Http2StringPiece data) {
+ return Http2HexEscapeImpl(data);
+}
+
+template <typename Number>
+inline Http2String Http2Hex(Number number) {
+ static_assert(std::is_integral<Number>::value, "Number has to be an int");
+ return Http2HexImpl(number);
+}
+
+} // namespace http2
+
+#endif // QUICHE_HTTP2_PLATFORM_API_HTTP2_STRING_UTILS_H_
diff --git a/http2/platform/api/http2_string_utils_test.cc b/http2/platform/api/http2_string_utils_test.cc
new file mode 100644
index 0000000..254f9d7
--- /dev/null
+++ b/http2/platform/api/http2_string_utils_test.cc
@@ -0,0 +1,178 @@
+// Copyright 2017 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 "net/third_party/quiche/src/http2/platform/api/http2_string_utils.h"
+
+#include <cstdint>
+
+#include "testing/gtest/include/gtest/gtest.h"
+#include "net/third_party/quiche/src/http2/platform/api/http2_string_piece.h"
+
+namespace http2 {
+namespace test {
+namespace {
+
+TEST(Http2StringUtilsTest, Http2StrCat) {
+ // No arguments.
+ EXPECT_EQ("", Http2StrCat());
+
+ // Single string-like argument.
+ const char kFoo[] = "foo";
+ const Http2String string_foo(kFoo);
+ const Http2StringPiece stringpiece_foo(string_foo);
+ EXPECT_EQ("foo", Http2StrCat(kFoo));
+ EXPECT_EQ("foo", Http2StrCat(string_foo));
+ EXPECT_EQ("foo", Http2StrCat(stringpiece_foo));
+
+ // Two string-like arguments.
+ const char kBar[] = "bar";
+ const Http2StringPiece stringpiece_bar(kBar);
+ const Http2String string_bar(kBar);
+ EXPECT_EQ("foobar", Http2StrCat(kFoo, kBar));
+ EXPECT_EQ("foobar", Http2StrCat(kFoo, string_bar));
+ EXPECT_EQ("foobar", Http2StrCat(kFoo, stringpiece_bar));
+ EXPECT_EQ("foobar", Http2StrCat(string_foo, kBar));
+ EXPECT_EQ("foobar", Http2StrCat(string_foo, string_bar));
+ EXPECT_EQ("foobar", Http2StrCat(string_foo, stringpiece_bar));
+ EXPECT_EQ("foobar", Http2StrCat(stringpiece_foo, kBar));
+ EXPECT_EQ("foobar", Http2StrCat(stringpiece_foo, string_bar));
+ EXPECT_EQ("foobar", Http2StrCat(stringpiece_foo, stringpiece_bar));
+
+ // Many-many arguments.
+ EXPECT_EQ(
+ "foobarbazquxquuxquuzcorgegraultgarplywaldofredplughxyzzythud",
+ Http2StrCat("foo", "bar", "baz", "qux", "quux", "quuz", "corge", "grault",
+ "garply", "waldo", "fred", "plugh", "xyzzy", "thud"));
+
+ // Numerical arguments.
+ const int16_t i = 1;
+ const uint64_t u = 8;
+ const double d = 3.1415;
+
+ EXPECT_EQ("1 8", Http2StrCat(i, " ", u));
+ EXPECT_EQ("3.14151181", Http2StrCat(d, i, i, u, i));
+ EXPECT_EQ("i: 1, u: 8, d: 3.1415",
+ Http2StrCat("i: ", i, ", u: ", u, ", d: ", d));
+
+ // Boolean arguments.
+ const bool t = true;
+ const bool f = false;
+
+ EXPECT_EQ("1", Http2StrCat(t));
+ EXPECT_EQ("0", Http2StrCat(f));
+ EXPECT_EQ("0110", Http2StrCat(f, t, t, f));
+
+ // Mixed string-like, numerical, and Boolean arguments.
+ EXPECT_EQ("foo1foo081bar3.14151",
+ Http2StrCat(kFoo, i, string_foo, f, u, t, stringpiece_bar, d, t));
+ EXPECT_EQ("3.141511bar18bar13.14150",
+ Http2StrCat(d, t, t, string_bar, i, u, kBar, t, d, f));
+}
+
+TEST(Http2StringUtilsTest, Http2StrAppend) {
+ // No arguments on empty string.
+ Http2String output;
+ Http2StrAppend(&output);
+ EXPECT_TRUE(output.empty());
+
+ // Single string-like argument.
+ const char kFoo[] = "foo";
+ const Http2String string_foo(kFoo);
+ const Http2StringPiece stringpiece_foo(string_foo);
+ Http2StrAppend(&output, kFoo);
+ EXPECT_EQ("foo", output);
+ Http2StrAppend(&output, string_foo);
+ EXPECT_EQ("foofoo", output);
+ Http2StrAppend(&output, stringpiece_foo);
+ EXPECT_EQ("foofoofoo", output);
+
+ // No arguments on non-empty string.
+ Http2StrAppend(&output);
+ EXPECT_EQ("foofoofoo", output);
+
+ output.clear();
+
+ // Two string-like arguments.
+ const char kBar[] = "bar";
+ const Http2StringPiece stringpiece_bar(kBar);
+ const Http2String string_bar(kBar);
+ Http2StrAppend(&output, kFoo, kBar);
+ EXPECT_EQ("foobar", output);
+ Http2StrAppend(&output, kFoo, string_bar);
+ EXPECT_EQ("foobarfoobar", output);
+ Http2StrAppend(&output, kFoo, stringpiece_bar);
+ EXPECT_EQ("foobarfoobarfoobar", output);
+ Http2StrAppend(&output, string_foo, kBar);
+ EXPECT_EQ("foobarfoobarfoobarfoobar", output);
+
+ output.clear();
+
+ Http2StrAppend(&output, string_foo, string_bar);
+ EXPECT_EQ("foobar", output);
+ Http2StrAppend(&output, string_foo, stringpiece_bar);
+ EXPECT_EQ("foobarfoobar", output);
+ Http2StrAppend(&output, stringpiece_foo, kBar);
+ EXPECT_EQ("foobarfoobarfoobar", output);
+ Http2StrAppend(&output, stringpiece_foo, string_bar);
+ EXPECT_EQ("foobarfoobarfoobarfoobar", output);
+
+ output.clear();
+
+ Http2StrAppend(&output, stringpiece_foo, stringpiece_bar);
+ EXPECT_EQ("foobar", output);
+
+ // Many-many arguments.
+ Http2StrAppend(&output, "foo", "bar", "baz", "qux", "quux", "quuz", "corge",
+ "grault", "garply", "waldo", "fred", "plugh", "xyzzy", "thud");
+ EXPECT_EQ(
+ "foobarfoobarbazquxquuxquuzcorgegraultgarplywaldofredplughxyzzythud",
+ output);
+
+ output.clear();
+
+ // Numerical arguments.
+ const int16_t i = 1;
+ const uint64_t u = 8;
+ const double d = 3.1415;
+
+ Http2StrAppend(&output, i, " ", u);
+ EXPECT_EQ("1 8", output);
+ Http2StrAppend(&output, d, i, i, u, i);
+ EXPECT_EQ("1 83.14151181", output);
+ Http2StrAppend(&output, "i: ", i, ", u: ", u, ", d: ", d);
+ EXPECT_EQ("1 83.14151181i: 1, u: 8, d: 3.1415", output);
+
+ output.clear();
+
+ // Boolean arguments.
+ const bool t = true;
+ const bool f = false;
+
+ Http2StrAppend(&output, t);
+ EXPECT_EQ("1", output);
+ Http2StrAppend(&output, f);
+ EXPECT_EQ("10", output);
+ Http2StrAppend(&output, f, t, t, f);
+ EXPECT_EQ("100110", output);
+
+ output.clear();
+
+ // Mixed string-like, numerical, and Boolean arguments.
+ Http2StrAppend(&output, kFoo, i, string_foo, f, u, t, stringpiece_bar, d, t);
+ EXPECT_EQ("foo1foo081bar3.14151", output);
+ Http2StrAppend(&output, d, t, t, string_bar, i, u, kBar, t, d, f);
+ EXPECT_EQ("foo1foo081bar3.141513.141511bar18bar13.14150", output);
+}
+
+TEST(Http2StringUtilsTest, Http2StringPrintf) {
+ EXPECT_EQ("", Http2StringPrintf("%s", ""));
+ EXPECT_EQ("foobar", Http2StringPrintf("%sbar", "foo"));
+ EXPECT_EQ("foobar", Http2StringPrintf("%s%s", "foo", "bar"));
+ EXPECT_EQ("foo: 1, bar: 2.0",
+ Http2StringPrintf("foo: %d, bar: %.1f", 1, 2.0));
+}
+
+} // namespace
+} // namespace test
+} // namespace http2
diff --git a/http2/platform/api/http2_test_helpers.h b/http2/platform/api/http2_test_helpers.h
new file mode 100644
index 0000000..a54f4ab
--- /dev/null
+++ b/http2/platform/api/http2_test_helpers.h
@@ -0,0 +1,16 @@
+#ifndef QUICHE_HTTP2_PLATFORM_API_HTTP2_TEST_HELPERS_H_
+#define QUICHE_HTTP2_PLATFORM_API_HTTP2_TEST_HELPERS_H_
+
+// Provides VERIFY_* macros, similar to EXPECT_* and ASSERT_*, but they return
+// an AssertionResult if the condition is not satisfied.
+#include "net/http2/platform/impl/http2_test_helpers_impl.h"
+
+#include "testing/gtest/include/gtest/gtest.h" // For AssertionSuccess
+
+#define VERIFY_AND_RETURN_SUCCESS(expression) \
+ { \
+ VERIFY_SUCCESS(expression); \
+ return ::testing::AssertionSuccess(); \
+ }
+
+#endif // QUICHE_HTTP2_PLATFORM_API_HTTP2_TEST_HELPERS_H_