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

Unified Diff: net/ssl/ssl_client_session_cache_unittest.cc

Issue 2574513002: Do not create sub MemoryAllocatorDumps in SSLClientSessionCache (Closed)
Patch Set: Created 4 years 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/ssl/ssl_client_session_cache.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/ssl/ssl_client_session_cache_unittest.cc
diff --git a/net/ssl/ssl_client_session_cache_unittest.cc b/net/ssl/ssl_client_session_cache_unittest.cc
index 2f14ae86597a4c1dad691651a7345ccdd797fbb5..501aad89aea9ecb7af168db9e5e4163e32eafde7 100644
--- a/net/ssl/ssl_client_session_cache_unittest.cc
+++ b/net/ssl/ssl_client_session_cache_unittest.cc
@@ -11,6 +11,7 @@
#include "base/time/time.h"
#include "base/trace_event/memory_allocator_dump.h"
#include "base/trace_event/process_memory_dump.h"
+#include "base/trace_event/trace_event_argument.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/boringssl/src/include/openssl/ssl.h"
@@ -328,13 +329,22 @@ TEST(SSLClientSessionCacheTest, TestDumpMemoryStats) {
const base::trace_event::ProcessMemoryDump::AllocatorDumpsMap&
allocator_dumps = process_memory_dump->allocator_dumps();
ssid 2016/12/12 20:25:24 You do not need to iterate through the list of dum
xunjieli 2016/12/12 20:49:03 Done.
- size_t num_entry_dump = 0;
+ bool did_dump = false;
for (const auto& pair : allocator_dumps) {
const std::string& dump_name = pair.first;
- if (dump_name.find("net/ssl_session_cache/entry") != std::string::npos)
- num_entry_dump++;
+ if (dump_name.find("net/ssl_session_cache") != std::string::npos) {
+ std::unique_ptr<base::Value> raw_attrs =
+ pair.second->attributes_for_testing()->ToBaseValue();
+ base::DictionaryValue* attrs;
+ ASSERT_TRUE(raw_attrs->GetAsDictionary(&attrs));
+ ASSERT_TRUE(attrs->HasKey("cert_count"));
+ ASSERT_TRUE(attrs->HasKey("serialized_cert_size"));
+ ASSERT_TRUE(
+ attrs->HasKey(base::trace_event::MemoryAllocatorDump::kNameSize));
+ did_dump = true;
+ }
}
- ASSERT_EQ(3u, num_entry_dump);
+ ASSERT_TRUE(did_dump);
}
} // namespace net
« no previous file with comments | « net/ssl/ssl_client_session_cache.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698