• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2019 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef NET_THIRD_PARTY_QUICHE_OVERRIDES_QUICHE_PLATFORM_IMPL_QUICHE_TEST_IMPL_H_
6 #define NET_THIRD_PARTY_QUICHE_OVERRIDES_QUICHE_PLATFORM_IMPL_QUICHE_TEST_IMPL_H_
7 
8 #include <cstdint>
9 
10 #include "net/quic/platform/impl/quic_test_flags_utils.h"
11 #include "net/test/test_with_task_environment.h"
12 #include "net/third_party/quiche/src/quiche/quic/platform/api/quic_flags.h"
13 #include "testing/gmock/include/gmock/gmock.h"      // IWYU pragma: export
14 #include "testing/gtest/include/gtest/gtest-spi.h"  // IWYU pragma: export
15 #include "testing/gtest/include/gtest/gtest.h"      // IWYU pragma: export
16 
17 namespace quiche::test {
18 
19 class QuicheTestImpl : public ::testing::Test {
20  private:
21   QuicFlagChecker checker_;
22   QuicFlagSaverImpl saver_;  // Save/restore all QUIC flag values.
23 };
24 
25 template <class T>
26 class QuicheTestWithParamImpl : public ::testing::TestWithParam<T> {
27  private:
28   QuicFlagChecker checker_;
29   QuicFlagSaverImpl saver_;  // Save/restore all QUIC flag values.
30 };
31 
32 class ScopedEnvironmentForThreadsImpl {
33  public:
ScopedEnvironmentForThreadsImpl()34   ScopedEnvironmentForThreadsImpl()
35       : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) {}
36 
37  public:
38   base::test::TaskEnvironment task_environment_;
39 };
40 
41 std::string QuicheGetCommonSourcePathImpl();
42 
43 }  // namespace quiche::test
44 
45 #if GTEST_HAS_DEATH_TEST && !defined(NDEBUG)
46 #define EXPECT_QUICHE_DEBUG_DEATH_IMPL(condition, message) \
47   EXPECT_DEBUG_DEATH(condition, message)
48 #else
49 #define EXPECT_QUICHE_DEBUG_DEATH_IMPL(condition, message) \
50   do {                                                     \
51   } while (0)
52 #endif
53 
54 #define QUICHE_TEST_DISABLED_IN_CHROME_IMPL(name) DISABLED_##name
55 
56 #define QUICHE_SLOW_TEST_IMPL(name) DISABLED_##name
57 
58 using QuicheFlagSaverImpl = QuicFlagSaverImpl;
59 using ScopedEnvironmentForThreadsImpl =
60     quiche::test::ScopedEnvironmentForThreadsImpl;
61 
62 std::string QuicheGetTestMemoryCachePathImpl();
63 
64 #endif  // NET_THIRD_PARTY_QUICHE_OVERRIDES_QUICHE_PLATFORM_IMPL_QUICHE_TEST_IMPL_H_
65