| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "net/url_request/url_request_context.h" | 5 #include "net/url_request/url_request_context.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/trace_event/process_memory_dump.h" | 9 #include "base/trace_event/process_memory_dump.h" |
| 10 #include "net/proxy/proxy_config_service_fixed.h" | 10 #include "net/proxy/proxy_config_service_fixed.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 URLRequestContextBuilder builder; | 22 URLRequestContextBuilder builder; |
| 23 #if defined(OS_LINUX) || defined(OS_ANDROID) | 23 #if defined(OS_LINUX) || defined(OS_ANDROID) |
| 24 builder.set_proxy_config_service( | 24 builder.set_proxy_config_service( |
| 25 base::MakeUnique<ProxyConfigServiceFixed>(ProxyConfig::CreateDirect())); | 25 base::MakeUnique<ProxyConfigServiceFixed>(ProxyConfig::CreateDirect())); |
| 26 #endif // defined(OS_LINUX) || defined(OS_ANDROID) | 26 #endif // defined(OS_LINUX) || defined(OS_ANDROID) |
| 27 std::unique_ptr<URLRequestContext> context(builder.Build()); | 27 std::unique_ptr<URLRequestContext> context(builder.Build()); |
| 28 context->OnMemoryDump(dump_args, process_memory_dump.get()); | 28 context->OnMemoryDump(dump_args, process_memory_dump.get()); |
| 29 const base::trace_event::ProcessMemoryDump::AllocatorDumpsMap& | 29 const base::trace_event::ProcessMemoryDump::AllocatorDumpsMap& |
| 30 allocator_dumps = process_memory_dump->allocator_dumps(); | 30 allocator_dumps = process_memory_dump->allocator_dumps(); |
| 31 | 31 |
| 32 bool did_dump_http_network_session = false; |
| 33 bool did_dump_ssl_client_session_cache = false; |
| 32 bool did_dump_url_request_context = false; | 34 bool did_dump_url_request_context = false; |
| 33 // bool did_dump_space_stats = false; | |
| 34 // bool did_dump_objects_stats = false; | |
| 35 for (const auto& it : allocator_dumps) { | 35 for (const auto& it : allocator_dumps) { |
| 36 const std::string& dump_name = it.first; | 36 const std::string& dump_name = it.first; |
| 37 if (dump_name.find("net/http_network_session") != std::string::npos) |
| 38 did_dump_http_network_session = true; |
| 39 if (dump_name.find("net/ssl_session_cache") != std::string::npos) |
| 40 did_dump_ssl_client_session_cache = true; |
| 37 if (dump_name.find("net/url_request_context") != std::string::npos) | 41 if (dump_name.find("net/url_request_context") != std::string::npos) |
| 38 did_dump_url_request_context = true; | 42 did_dump_url_request_context = true; |
| 39 } | 43 } |
| 40 | 44 ASSERT_TRUE(did_dump_http_network_session); |
| 45 ASSERT_TRUE(did_dump_ssl_client_session_cache); |
| 41 ASSERT_TRUE(did_dump_url_request_context); | 46 ASSERT_TRUE(did_dump_url_request_context); |
| 42 } | 47 } |
| 43 | 48 |
| 49 // TODO(xunjieli): Add more granular tests on the MemoryDumpProvider. |
| 44 } // namespace net | 50 } // namespace net |
| OLD | NEW |