summaryrefslogtreecommitdiff
path: root/chromium/net/quiche/common
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/net/quiche/common')
-rw-r--r--chromium/net/quiche/common/platform/impl/quiche_map_util_impl.h19
-rw-r--r--chromium/net/quiche/common/platform/impl/quiche_string_piece_impl.h21
-rw-r--r--chromium/net/quiche/common/platform/impl/quiche_test_helpers_impl.h12
-rw-r--r--chromium/net/quiche/common/platform/impl/quiche_test_impl.h9
-rw-r--r--chromium/net/quiche/common/platform/impl/quiche_text_utils_impl.h153
-rw-r--r--chromium/net/quiche/common/platform/impl/quiche_unordered_containers_impl.h23
6 files changed, 21 insertions, 216 deletions
diff --git a/chromium/net/quiche/common/platform/impl/quiche_map_util_impl.h b/chromium/net/quiche/common/platform/impl/quiche_map_util_impl.h
deleted file mode 100644
index 29029d465df..00000000000
--- a/chromium/net/quiche/common/platform/impl/quiche_map_util_impl.h
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright (c) 2019 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 NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_MAP_UTIL_IMPL_H_
-#define NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_MAP_UTIL_IMPL_H_
-
-#include "base/stl_util.h"
-
-namespace quiche {
-
-template <class Collection, class Key>
-bool QuicheContainsKeyImpl(const Collection& collection, const Key& key) {
- return base::Contains(collection, key);
-}
-
-} // namespace quiche
-
-#endif // NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_MAP_UTIL_IMPL_H_
diff --git a/chromium/net/quiche/common/platform/impl/quiche_string_piece_impl.h b/chromium/net/quiche/common/platform/impl/quiche_string_piece_impl.h
deleted file mode 100644
index 5664d34ad5f..00000000000
--- a/chromium/net/quiche/common/platform/impl/quiche_string_piece_impl.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// 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 NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_STRING_PIECE_IMPL_H_
-#define NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_STRING_PIECE_IMPL_H_
-
-#include "third_party/abseil-cpp/absl/hash/hash.h"
-#include "third_party/abseil-cpp/absl/strings/string_view.h"
-
-namespace quiche {
-
-inline size_t QuicheHashStringPairImpl(absl::string_view a,
- absl::string_view b) {
- auto pair = std::make_pair(a, b);
- return absl::Hash<decltype(pair)>()(pair);
-}
-
-} // namespace quiche
-
-#endif // NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_STRING_PIECE_IMPL_H_
diff --git a/chromium/net/quiche/common/platform/impl/quiche_test_helpers_impl.h b/chromium/net/quiche/common/platform/impl/quiche_test_helpers_impl.h
new file mode 100644
index 00000000000..6ba72eb67a8
--- /dev/null
+++ b/chromium/net/quiche/common/platform/impl/quiche_test_helpers_impl.h
@@ -0,0 +1,12 @@
+// Copyright 2021 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 NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_TEST_HELPERS_IMPL_H_
+#define NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_TEST_HELPERS_IMPL_H_
+
+#include "net/test/gtest_util.h"
+
+#define EXPECT_QUICHE_BUG_IMPL EXPECT_DFATAL
+
+#endif // NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_TEST_HELPERS_IMPL_H_
diff --git a/chromium/net/quiche/common/platform/impl/quiche_test_impl.h b/chromium/net/quiche/common/platform/impl/quiche_test_impl.h
index a505bccfe8e..a2db91e274d 100644
--- a/chromium/net/quiche/common/platform/impl/quiche_test_impl.h
+++ b/chromium/net/quiche/common/platform/impl/quiche_test_impl.h
@@ -17,4 +17,13 @@ class QuicheTestWithParamImpl : public ::testing::TestWithParam<T> {};
} // namespace test
} // namespace quiche
+#if GTEST_HAS_DEATH_TEST && !defined(NDEBUG)
+#define EXPECT_QUICHE_DEBUG_DEATH_IMPL(condition, message) \
+ EXPECT_DEBUG_DEATH(condition, message)
+#else
+#define EXPECT_QUICHE_DEBUG_DEATH_IMPL(condition, message) \
+ do { \
+ } while (0)
+#endif
+
#endif // NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_TEST_IMPL_H_
diff --git a/chromium/net/quiche/common/platform/impl/quiche_text_utils_impl.h b/chromium/net/quiche/common/platform/impl/quiche_text_utils_impl.h
deleted file mode 100644
index 6842bdfe5a7..00000000000
--- a/chromium/net/quiche/common/platform/impl/quiche_text_utils_impl.h
+++ /dev/null
@@ -1,153 +0,0 @@
-// 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 NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_TEXT_UTILS_IMPL_H_
-#define NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_TEXT_UTILS_IMPL_H_
-
-#include <algorithm>
-#include <cstdint>
-#include <sstream>
-#include <string>
-#include <vector>
-
-#include "base/strings/abseil_string_conversions.h"
-#include "net/base/hex_utils.h"
-#include "third_party/abseil-cpp/absl/strings/ascii.h"
-#include "third_party/abseil-cpp/absl/strings/escaping.h"
-#include "third_party/abseil-cpp/absl/strings/match.h"
-#include "third_party/abseil-cpp/absl/strings/str_cat.h"
-#include "third_party/abseil-cpp/absl/strings/str_split.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
-
-namespace quiche {
-
-// Chromium implementation of quiche::QuicheTextUtils.
-class QuicheTextUtilsImpl {
- public:
- // Returns true of |data| starts with |prefix|, case sensitively.
- static bool StartsWith(absl::string_view data, absl::string_view prefix) {
- return absl::StartsWith(data, prefix);
- }
-
- // Returns true if |data| end with |suffix|, case sensitively.
- static bool EndsWith(absl::string_view data, absl::string_view suffix) {
- return absl::EndsWith(data, suffix);
- }
-
- // Returns true of |data| ends with |suffix|, case insensitively.
- static bool EndsWithIgnoreCase(absl::string_view data,
- absl::string_view suffix) {
- return absl::EndsWithIgnoreCase(data, suffix);
- }
-
- // Returns a new std::string in which |data| has been converted to lower case.
- static std::string ToLower(absl::string_view data) {
- return absl::AsciiStrToLower(data);
- }
-
- // Remove leading and trailing whitespace from |data|.
- static void RemoveLeadingAndTrailingWhitespace(absl::string_view* data) {
- *data = absl::StripAsciiWhitespace(*data);
- }
-
- // Returns true if |in| represents a valid uint64, and stores that value in
- // |out|.
- static bool StringToUint64(absl::string_view in, uint64_t* out) {
- return absl::SimpleAtoi(in, out);
- }
-
- // Returns true if |in| represents a valid int, and stores that value in
- // |out|.
- static bool StringToInt(absl::string_view in, int* out) {
- return absl::SimpleAtoi(in, out);
- }
-
- // Returns true if |in| represents a valid uint32, and stores that value in
- // |out|.
- static bool StringToUint32(absl::string_view in, uint32_t* out) {
- return absl::SimpleAtoi(in, out);
- }
-
- // Returns true if |in| represents a valid size_t, and stores that value in
- // |out|.
- static bool StringToSizeT(absl::string_view in, size_t* out) {
- return absl::SimpleAtoi(in, out);
- }
-
- // Returns a new std::string representing |in|.
- static std::string Uint64ToString(uint64_t in) { return absl::StrCat(in); }
-
- // This converts |length| bytes of binary to a 2*|length|-character
- // hexadecimal representation.
- // Return value: 2*|length| characters of ASCII std::string.
- static std::string HexEncode(absl::string_view data) {
- return absl::BytesToHexString(data);
- }
-
- static std::string Hex(uint32_t v) { return absl::StrCat(absl::Hex(v)); }
-
- // Converts |data| from a hexadecimal ASCII string to a binary string
- // that is |data.length()/2| bytes long. On failure returns empty string.
- static std::string HexDecode(absl::string_view data) {
- return absl::HexStringToBytes(data);
- }
-
- // Base64 encodes with no padding |data_len| bytes of |data| into |output|.
- static void Base64Encode(const uint8_t* data,
- size_t data_len,
- std::string* output) {
- absl::Base64Escape(
- std::string(reinterpret_cast<const char*>(data), data_len), output);
- // Remove padding.
- size_t len = output->size();
- if (len >= 2) {
- if ((*output)[len - 1] == '=') {
- len--;
- if ((*output)[len - 1] == '=') {
- len--;
- }
- output->resize(len);
- }
- }
- }
-
- // Decodes a base64-encoded |input|. Returns nullopt when the input is
- // invalid.
- static absl::optional<std::string> Base64Decode(absl::string_view input) {
- std::string output;
- if (!absl::Base64Unescape(input, &output)) {
- return absl::optional<std::string>();
- }
- return output;
- }
-
- // Returns a std::string containing hex and ASCII representations of |binary|,
- // side-by-side in the style of hexdump. Non-printable characters will be
- // printed as '.' in the ASCII output.
- // For example, given the input "Hello, QUIC!\01\02\03\04", returns:
- // "0x0000: 4865 6c6c 6f2c 2051 5549 4321 0102 0304 Hello,.QUIC!...."
- static std::string HexDump(absl::string_view binary_input) {
- return net::HexDump(base::StringViewToStringPiece(binary_input));
- }
-
- // Returns true if |data| contains any uppercase characters.
- static bool ContainsUpperCase(absl::string_view data) {
- return std::any_of(data.begin(), data.end(), absl::ascii_isupper);
- }
-
- // Returns true if |data| contains only decimal digits.
- static bool IsAllDigits(absl::string_view data) {
- return std::all_of(data.begin(), data.end(), absl::ascii_isdigit);
- }
-
- // Splits |data| into a vector of pieces delimited by |delim|.
- static std::vector<absl::string_view> Split(absl::string_view data,
- char delim) {
- return absl::StrSplit(data, delim);
- }
-};
-
-} // namespace quiche
-
-#endif // NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_TEXT_UTILS_IMPL_H_
diff --git a/chromium/net/quiche/common/platform/impl/quiche_unordered_containers_impl.h b/chromium/net/quiche/common/platform/impl/quiche_unordered_containers_impl.h
deleted file mode 100644
index d08485fe84a..00000000000
--- a/chromium/net/quiche/common/platform/impl/quiche_unordered_containers_impl.h
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (c) 2019 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 NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_UNORDERED_CONTAINERS_IMPL_H_
-#define NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_UNORDERED_CONTAINERS_IMPL_H_
-
-#include <unordered_map>
-
-#include "third_party/abseil-cpp/absl/container/node_hash_map.h"
-
-namespace quiche {
-
-// The default hasher used by hash tables.
-template <typename Key>
-using QuicheDefaultHasherImpl = absl::Hash<Key>;
-
-template <typename Key, typename Value, typename Hash, typename Eq>
-using QuicheUnorderedMapImpl = absl::node_hash_map<Key, Value, Hash, Eq>;
-
-} // namespace quiche
-
-#endif // NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_UNORDERED_CONTAINERS_IMPL_H_