summaryrefslogtreecommitdiff
path: root/chromium/net/third_party/quiche/overrides/quiche_platform_impl/quiche_test_impl.h
blob: 46e97ba01fd942bc2a73113990b75a654b9e10ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// 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_THIRD_PARTY_QUICHE_OVERRIDES_QUICHE_PLATFORM_IMPL_QUICHE_TEST_IMPL_H_
#define NET_THIRD_PARTY_QUICHE_OVERRIDES_QUICHE_PLATFORM_IMPL_QUICHE_TEST_IMPL_H_

#include <cstdint>

#include "net/quic/platform/impl/quic_test_flags_utils.h"
#include "net/test/test_with_task_environment.h"
#include "net/third_party/quiche/src/quiche/quic/platform/api/quic_flags.h"
#include "testing/gmock/include/gmock/gmock.h"      // IWYU pragma: export
#include "testing/gtest/include/gtest/gtest-spi.h"  // IWYU pragma: export
#include "testing/gtest/include/gtest/gtest.h"      // IWYU pragma: export

namespace quiche {
namespace test {

class QuicheTestImpl : public ::testing::Test {
 private:
  QuicFlagChecker checker_;
  QuicFlagSaverImpl saver_;  // Save/restore all QUIC flag values.
};

template <class T>
class QuicheTestWithParamImpl : public ::testing::TestWithParam<T> {
 private:
  QuicFlagChecker checker_;
  QuicFlagSaverImpl saver_;  // Save/restore all QUIC flag values.
};

class ScopedEnvironmentForThreadsImpl {
 public:
  ScopedEnvironmentForThreadsImpl()
      : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) {}

 public:
  base::test::TaskEnvironment task_environment_;
};

std::string QuicheGetCommonSourcePathImpl();

}  // 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

#define QUICHE_TEST_DISABLED_IN_CHROME_IMPL(name) DISABLED_##name

#define QUICHE_SLOW_TEST_IMPL(name) DISABLED_##name

using QuicheFlagSaverImpl = QuicFlagSaverImpl;
using ScopedEnvironmentForThreadsImpl =
    quiche::test::ScopedEnvironmentForThreadsImpl;

std::string QuicheGetTestMemoryCachePathImpl();

#endif  // NET_THIRD_PARTY_QUICHE_OVERRIDES_QUICHE_PLATFORM_IMPL_QUICHE_TEST_IMPL_H_