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

Unified Diff: net/base/captured_net_log_entry.h

Issue 754433003: Update from https://crrev.com/305340 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/android/java/src/org/chromium/net/X509Util.java ('k') | net/base/captured_net_log_entry.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/captured_net_log_entry.h
diff --git a/net/base/captured_net_log_entry.h b/net/base/captured_net_log_entry.h
new file mode 100644
index 0000000000000000000000000000000000000000..97245e398af4f493e28a0f02d3dad5fa3cdbba9b
--- /dev/null
+++ b/net/base/captured_net_log_entry.h
@@ -0,0 +1,69 @@
+// Copyright 2014 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.
+
+#ifndef NET_BASE_CAPTURED_NET_LOG_ENTRY_H_
+#define NET_BASE_CAPTURED_NET_LOG_ENTRY_H_
+
+#include <string>
+#include <vector>
+
+#include "base/memory/scoped_ptr.h"
+#include "base/time/time.h"
+#include "net/base/net_log.h"
+
+namespace base {
+class DictionaryValue;
+class ListValue;
+}
+
+namespace net {
+
+// CapturedNetLogEntry is much like NetLog::Entry, except it has its own copy of
+// all log data, so a list of entries can be gathered over the course of a test,
+// and then inspected at the end. It is intended for testing only, and is part
+// of the net_test_support project.
+struct CapturedNetLogEntry {
+ // Ordered set of logged entries.
+ typedef std::vector<CapturedNetLogEntry> List;
+
+ CapturedNetLogEntry(NetLog::EventType type,
+ const base::TimeTicks& time,
+ NetLog::Source source,
+ NetLog::EventPhase phase,
+ scoped_ptr<base::DictionaryValue> params);
+ // Copy constructor needed to store in a std::vector because of the
+ // scoped_ptr.
+ CapturedNetLogEntry(const CapturedNetLogEntry& entry);
+
+ ~CapturedNetLogEntry();
+
+ // Equality operator needed to store in a std::vector because of the
+ // scoped_ptr.
+ CapturedNetLogEntry& operator=(const CapturedNetLogEntry& entry);
+
+ // Attempt to retrieve an value of the specified type with the given name
+ // from |params|. Returns true on success, false on failure. Does not
+ // modify |value| on failure.
+ bool GetStringValue(const std::string& name, std::string* value) const;
+ bool GetIntegerValue(const std::string& name, int* value) const;
+ bool GetListValue(const std::string& name, base::ListValue** value) const;
+
+ // Same as GetIntegerValue, but returns the error code associated with a
+ // log entry.
+ bool GetNetErrorCode(int* value) const;
+
+ // Returns the parameters as a JSON string, or empty string if there are no
+ // parameters.
+ std::string GetParamsJson() const;
+
+ NetLog::EventType type;
+ base::TimeTicks time;
+ NetLog::Source source;
+ NetLog::EventPhase phase;
+ scoped_ptr<base::DictionaryValue> params;
+};
+
+} // namespace net
+
+#endif // NET_BASE_CAPTURED_NET_LOG_ENTRY_H_
« no previous file with comments | « net/android/java/src/org/chromium/net/X509Util.java ('k') | net/base/captured_net_log_entry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698