load_timing_info_test_util.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Copyright (c) 2013 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef NET_BASE_LOAD_TIMING_INFO_TEST_UTIL_H_
  5. #define NET_BASE_LOAD_TIMING_INFO_TEST_UTIL_H_
  6. #include "net/base/load_timing_info.h"
  7. namespace net {
  8. // Flags indicating which times in a LoadTimingInfo::ConnectTiming struct should
  9. // be non-null.
  10. enum ConnectTimeFlags {
  11. CONNECT_TIMING_HAS_CONNECT_TIMES_ONLY = 0,
  12. CONNECT_TIMING_HAS_DNS_TIMES = 1 << 0,
  13. CONNECT_TIMING_HAS_SSL_TIMES = 1 << 1,
  14. };
  15. // Checks that all times in |connect_timing| are null.
  16. void ExpectConnectTimingHasNoTimes(
  17. const LoadTimingInfo::ConnectTiming& connect_timing);
  18. // Checks that |connect_timing|'s times are in the correct order.
  19. // |connect_start| and |connect_end| must be non-null. Checks null state and
  20. // order of DNS times and SSL times based on |flags|, which must be a
  21. // combination of ConnectTimeFlags.
  22. void ExpectConnectTimingHasTimes(
  23. const LoadTimingInfo::ConnectTiming& connect_timing,
  24. int connect_timing_flags);
  25. // Tests that all non-connection establishment times in |load_timing_info| are
  26. // null. Its |connect_timing| field is ignored.
  27. void ExpectLoadTimingHasOnlyConnectionTimes(
  28. const LoadTimingInfo& load_timing_info);
  29. } // namespace net
  30. #endif // NET_BASE_LOAD_TIMING_INFO_TEST_UTIL_H_