summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/base/capturing_net_log.cc8
-rw-r--r--net/base/capturing_net_log.h2
-rw-r--r--net/cert/multi_log_ct_verifier_unittest.cc33
3 files changed, 39 insertions, 4 deletions
diff --git a/net/base/capturing_net_log.cc b/net/base/capturing_net_log.cc
index ea17835..3837fe69 100644
--- a/net/base/capturing_net_log.cc
+++ b/net/base/capturing_net_log.cc
@@ -55,6 +55,14 @@ bool CapturingNetLog::CapturedEntry::GetIntegerValue(
return params->GetInteger(name, value);
}
+bool CapturingNetLog::CapturedEntry::GetListValue(
+ const std::string& name,
+ base::ListValue** value) const {
+ if (!params)
+ return false;
+ return params->GetList(name, value);
+}
+
bool CapturingNetLog::CapturedEntry::GetNetErrorCode(int* value) const {
return GetIntegerValue("net_error", value);
}
diff --git a/net/base/capturing_net_log.h b/net/base/capturing_net_log.h
index 156a61d..06bc976 100644
--- a/net/base/capturing_net_log.h
+++ b/net/base/capturing_net_log.h
@@ -19,6 +19,7 @@
namespace base {
class DictionaryValue;
+class ListValue;
}
namespace net {
@@ -50,6 +51,7 @@ class CapturingNetLog : public NetLog {
// 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.
diff --git a/net/cert/multi_log_ct_verifier_unittest.cc b/net/cert/multi_log_ct_verifier_unittest.cc
index b1d1aa8..1b15d1e 100644
--- a/net/cert/multi_log_ct_verifier_unittest.cc
+++ b/net/cert/multi_log_ct_verifier_unittest.cc
@@ -8,6 +8,7 @@
#include "base/file_util.h"
#include "base/files/file_path.h"
+#include "base/values.h"
#include "net/base/capturing_net_log.h"
#include "net/base/net_errors.h"
#include "net/base/net_log.h"
@@ -64,16 +65,40 @@ class MultiLogCTVerifierTest : public ::testing::Test {
if (entries.size() != 2)
return false;
- const CapturingNetLog::CapturedEntry& received(entries[0]);
+ const CapturingNetLog::CapturedEntry& received = entries[0];
std::string embedded_scts;
if (!received.GetStringValue("embedded_scts", &embedded_scts))
return false;
if (embedded_scts.empty())
return false;
- //XXX(eranm): entries[1] is the NetLog message with the checked SCTs.
- //When CapturedEntry has methods to get a dictionary, rather than just
- //a string, add more checks here.
+ const CapturingNetLog::CapturedEntry& parsed = entries[1];
+ base::ListValue* verified_scts;
+ if (!parsed.GetListValue("verified_scts", &verified_scts) ||
+ verified_scts->GetSize() != 1) {
+ return false;
+ }
+
+ base::DictionaryValue* the_sct;
+ if (!verified_scts->GetDictionary(0, &the_sct))
+ return false;
+
+ std::string origin;
+ if (!the_sct->GetString("origin", &origin))
+ return false;
+ if (origin != "embedded_in_certificate")
+ return false;
+
+ base::ListValue* other_scts;
+ if (!parsed.GetListValue("invalid_scts", &other_scts) ||
+ !other_scts->empty()) {
+ return false;
+ }
+
+ if (!parsed.GetListValue("unknown_logs_scts", &other_scts) ||
+ !other_scts->empty()) {
+ return false;
+ }
return true;
}