Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(350)

Side by Side Diff: net/log/test_net_log_entry.h

Issue 2315613002: Extracted NetLog class's inner enum types into their own enum classes and (Closed)
Patch Set: Ran "git cl format" on code. Much formatting ensued. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/log/test_net_log.cc ('k') | net/log/test_net_log_entry.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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" 13 #include "net/log/net_log.h"
14 #include "net/log/net_log_event_type.h"
14 15
15 namespace base { 16 namespace base {
16 class DictionaryValue; 17 class DictionaryValue;
17 class ListValue; 18 class ListValue;
18 } 19 }
19 20
20 namespace net { 21 namespace net {
21 22
22 // TestNetLogEntry is much like NetLog::Entry, except it has its own copy of all 23 // TestNetLogEntry is much like NetLog::Entry, except it has its own copy of all
23 // 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
24 // 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
25 // the net_test_support project. 26 // the net_test_support project.
26 struct TestNetLogEntry { 27 struct TestNetLogEntry {
27 // Ordered set of logged entries. 28 // Ordered set of logged entries.
28 typedef std::vector<TestNetLogEntry> List; 29 typedef std::vector<TestNetLogEntry> List;
29 30
30 TestNetLogEntry(NetLog::EventType type, 31 TestNetLogEntry(NetLogEventType type,
31 const base::TimeTicks& time, 32 const base::TimeTicks& time,
32 NetLog::Source source, 33 NetLog::Source source,
33 NetLog::EventPhase phase, 34 NetLogEventPhase phase,
34 std::unique_ptr<base::DictionaryValue> params); 35 std::unique_ptr<base::DictionaryValue> params);
35 // 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
36 // scoped_ptr. 37 // scoped_ptr.
37 TestNetLogEntry(const TestNetLogEntry& entry); 38 TestNetLogEntry(const TestNetLogEntry& entry);
38 39
39 ~TestNetLogEntry(); 40 ~TestNetLogEntry();
40 41
41 // 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
42 // scoped_ptr. 43 // scoped_ptr.
43 TestNetLogEntry& operator=(const TestNetLogEntry& entry); 44 TestNetLogEntry& operator=(const TestNetLogEntry& entry);
44 45
45 // Attempt to retrieve an value of the specified type with the given name 46 // Attempt to retrieve an value of the specified type with the given name
46 // from |params|. Returns true on success, false on failure. Does not 47 // from |params|. Returns true on success, false on failure. Does not
47 // modify |value| on failure. 48 // modify |value| on failure.
48 bool GetStringValue(const std::string& name, std::string* value) const; 49 bool GetStringValue(const std::string& name, std::string* value) const;
49 bool GetIntegerValue(const std::string& name, int* value) const; 50 bool GetIntegerValue(const std::string& name, int* value) const;
50 bool GetBooleanValue(const std::string& name, bool* value) const; 51 bool GetBooleanValue(const std::string& name, bool* value) const;
51 bool GetListValue(const std::string& name, base::ListValue** value) const; 52 bool GetListValue(const std::string& name, base::ListValue** value) const;
52 53
53 // Same as GetIntegerValue, but returns the error code associated with a 54 // Same as GetIntegerValue, but returns the error code associated with a
54 // log entry. 55 // log entry.
55 bool GetNetErrorCode(int* value) const; 56 bool GetNetErrorCode(int* value) const;
56 57
57 // 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
58 // parameters. 59 // parameters.
59 std::string GetParamsJson() const; 60 std::string GetParamsJson() const;
60 61
61 NetLog::EventType type; 62 NetLogEventType type;
62 base::TimeTicks time; 63 base::TimeTicks time;
63 NetLog::Source source; 64 NetLog::Source source;
64 NetLog::EventPhase phase; 65 NetLogEventPhase phase;
65 std::unique_ptr<base::DictionaryValue> params; 66 std::unique_ptr<base::DictionaryValue> params;
66 }; 67 };
67 68
68 } // namespace net 69 } // namespace net
69 70
70 #endif // NET_LOG_TEST_NET_LOG_ENTRY_H_ 71 #endif // NET_LOG_TEST_NET_LOG_ENTRY_H_
OLDNEW
« no previous file with comments | « net/log/test_net_log.cc ('k') | net/log/test_net_log_entry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698