OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_LOG_TEST_NET_LOG_ENTRY_H_ | 5 #ifndef NET_LOG_TEST_NET_LOG_ENTRY_H_ |
6 #define NET_LOG_TEST_NET_LOG_ENTRY_H_ | 6 #define NET_LOG_TEST_NET_LOG_ENTRY_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "net/log/net_log.h" | |
14 #include "net/log/net_log_event_type.h" | 13 #include "net/log/net_log_event_type.h" |
| 14 #include "net/log/net_log_source.h" |
15 | 15 |
16 namespace base { | 16 namespace base { |
17 class DictionaryValue; | 17 class DictionaryValue; |
18 class ListValue; | 18 class ListValue; |
19 } | 19 } |
20 | 20 |
21 namespace net { | 21 namespace net { |
22 | 22 |
23 // TestNetLogEntry is much like NetLog::Entry, except it has its own copy of all | 23 // TestNetLogEntry is much like NetLogEntry, except it has its own copy of all |
24 // log data, so a list of entries can be gathered over the course of a test, and | 24 // log data, so a list of entries can be gathered over the course of a test, and |
25 // then inspected at the end. It is intended for testing only, and is part of | 25 // then inspected at the end. It is intended for testing only, and is part of |
26 // the net_test_support project. | 26 // the net_test_support project. |
27 struct TestNetLogEntry { | 27 struct TestNetLogEntry { |
28 // Ordered set of logged entries. | 28 // Ordered set of logged entries. |
29 typedef std::vector<TestNetLogEntry> List; | 29 typedef std::vector<TestNetLogEntry> List; |
30 | 30 |
31 TestNetLogEntry(NetLogEventType type, | 31 TestNetLogEntry(NetLogEventType type, |
32 const base::TimeTicks& time, | 32 const base::TimeTicks& time, |
33 NetLog::Source source, | 33 NetLogSource source, |
34 NetLogEventPhase phase, | 34 NetLogEventPhase phase, |
35 std::unique_ptr<base::DictionaryValue> params); | 35 std::unique_ptr<base::DictionaryValue> params); |
36 // Copy constructor needed to store in a std::vector because of the | 36 // Copy constructor needed to store in a std::vector because of the |
37 // scoped_ptr. | 37 // scoped_ptr. |
38 TestNetLogEntry(const TestNetLogEntry& entry); | 38 TestNetLogEntry(const TestNetLogEntry& entry); |
39 | 39 |
40 ~TestNetLogEntry(); | 40 ~TestNetLogEntry(); |
41 | 41 |
42 // Equality operator needed to store in a std::vector because of the | 42 // Equality operator needed to store in a std::vector because of the |
43 // scoped_ptr. | 43 // scoped_ptr. |
(...skipping 10 matching lines...) Expand all Loading... |
54 // Same as GetIntegerValue, but returns the error code associated with a | 54 // Same as GetIntegerValue, but returns the error code associated with a |
55 // log entry. | 55 // log entry. |
56 bool GetNetErrorCode(int* value) const; | 56 bool GetNetErrorCode(int* value) const; |
57 | 57 |
58 // Returns the parameters as a JSON string, or empty string if there are no | 58 // Returns the parameters as a JSON string, or empty string if there are no |
59 // parameters. | 59 // parameters. |
60 std::string GetParamsJson() const; | 60 std::string GetParamsJson() const; |
61 | 61 |
62 NetLogEventType type; | 62 NetLogEventType type; |
63 base::TimeTicks time; | 63 base::TimeTicks time; |
64 NetLog::Source source; | 64 NetLogSource source; |
65 NetLogEventPhase phase; | 65 NetLogEventPhase phase; |
66 std::unique_ptr<base::DictionaryValue> params; | 66 std::unique_ptr<base::DictionaryValue> params; |
67 }; | 67 }; |
68 | 68 |
69 } // namespace net | 69 } // namespace net |
70 | 70 |
71 #endif // NET_LOG_TEST_NET_LOG_ENTRY_H_ | 71 #endif // NET_LOG_TEST_NET_LOG_ENTRY_H_ |
OLD | NEW |