blob: a34a5832400b76fe3f6af2cc8989d323895d5f72 (
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
|
// Copyright (c) 2013 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/base/load_timing_info_test_util.h"
#include "net/base/load_timing_info.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace net {
void ExpectConnectTimingHasNoTimes(
const LoadTimingInfo::ConnectTiming& connect_timing) {
EXPECT_TRUE(connect_timing.dns_start.is_null());
EXPECT_TRUE(connect_timing.dns_end.is_null());
EXPECT_TRUE(connect_timing.connect_start.is_null());
EXPECT_TRUE(connect_timing.connect_end.is_null());
EXPECT_TRUE(connect_timing.ssl_start.is_null());
EXPECT_TRUE(connect_timing.ssl_end.is_null());
}
void ExpectConnectTimingHasTimes(
const LoadTimingInfo::ConnectTiming& connect_timing,
int connect_timing_flags) {
EXPECT_FALSE(connect_timing.connect_start.is_null());
EXPECT_LE(connect_timing.connect_start, connect_timing.connect_end);
if (!(connect_timing_flags & CONNECT_TIMING_HAS_DNS_TIMES)) {
EXPECT_TRUE(connect_timing.dns_start.is_null());
EXPECT_TRUE(connect_timing.dns_end.is_null());
} else {
EXPECT_FALSE(connect_timing.dns_start.is_null());
EXPECT_LE(connect_timing.dns_start, connect_timing.dns_end);
EXPECT_LE(connect_timing.dns_end, connect_timing.connect_start);
}
if (!(connect_timing_flags & CONNECT_TIMING_HAS_SSL_TIMES)) {
EXPECT_TRUE(connect_timing.ssl_start.is_null());
EXPECT_TRUE(connect_timing.ssl_start.is_null());
} else {
EXPECT_FALSE(connect_timing.ssl_start.is_null());
EXPECT_LE(connect_timing.connect_start, connect_timing.ssl_start);
EXPECT_LE(connect_timing.ssl_start, connect_timing.ssl_end);
EXPECT_LE(connect_timing.ssl_end, connect_timing.connect_end);
}
}
void ExpectLoadTimingHasOnlyConnectionTimes(
const LoadTimingInfo& load_timing_info) {
EXPECT_TRUE(load_timing_info.request_start_time.is_null());
EXPECT_TRUE(load_timing_info.request_start.is_null());
EXPECT_TRUE(load_timing_info.proxy_resolve_start.is_null());
EXPECT_TRUE(load_timing_info.proxy_resolve_end.is_null());
EXPECT_TRUE(load_timing_info.send_start.is_null());
EXPECT_TRUE(load_timing_info.send_end.is_null());
EXPECT_TRUE(load_timing_info.receive_headers_end.is_null());
}
} // namespace net
|