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

Side by Side Diff: net/url_request/url_request_context_unittest.cc

Issue 2699163002: Whitelist net/ MemoryDumpProvider (Closed)
Patch Set: fix test on windows Created 3 years, 9 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/url_request/url_request_context.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/trace_event/memory_dump_request_args.h"
10 #include "base/trace_event/process_memory_dump.h" 11 #include "base/trace_event/process_memory_dump.h"
11 #include "net/proxy/proxy_config_service_fixed.h" 12 #include "net/proxy/proxy_config_service_fixed.h"
12 #include "net/url_request/url_request_context_builder.h" 13 #include "net/url_request/url_request_context_builder.h"
13 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
14 15
15 namespace net { 16 namespace net {
16 17
18 class URLRequestContextMemoryDumpTest
19 : public testing::TestWithParam<
20 base::trace_event::MemoryDumpLevelOfDetail> {};
21
22 INSTANTIATE_TEST_CASE_P(
23 /* no prefix */,
24 URLRequestContextMemoryDumpTest,
25 ::testing::Values(base::trace_event::MemoryDumpLevelOfDetail::DETAILED,
26 base::trace_event::MemoryDumpLevelOfDetail::BACKGROUND));
27
17 // Checks if the dump provider runs without crashing and dumps root objects. 28 // Checks if the dump provider runs without crashing and dumps root objects.
18 TEST(URLRequestContextTest, MemoryDumpProvider) { 29 TEST_P(URLRequestContextMemoryDumpTest, MemoryDumpProvider) {
19 base::trace_event::MemoryDumpArgs dump_args = { 30 base::trace_event::MemoryDumpArgs dump_args = {GetParam()};
20 base::trace_event::MemoryDumpLevelOfDetail::DETAILED};
21 std::unique_ptr<base::trace_event::ProcessMemoryDump> process_memory_dump( 31 std::unique_ptr<base::trace_event::ProcessMemoryDump> process_memory_dump(
22 new base::trace_event::ProcessMemoryDump(nullptr, dump_args)); 32 new base::trace_event::ProcessMemoryDump(nullptr, dump_args));
23 URLRequestContextBuilder builder; 33 URLRequestContextBuilder builder;
24 #if defined(OS_LINUX) || defined(OS_ANDROID) 34 #if defined(OS_LINUX) || defined(OS_ANDROID)
25 builder.set_proxy_config_service( 35 builder.set_proxy_config_service(
26 base::MakeUnique<ProxyConfigServiceFixed>(ProxyConfig::CreateDirect())); 36 base::MakeUnique<ProxyConfigServiceFixed>(ProxyConfig::CreateDirect()));
27 #endif // defined(OS_LINUX) || defined(OS_ANDROID) 37 #endif // defined(OS_LINUX) || defined(OS_ANDROID)
28 std::unique_ptr<URLRequestContext> context(builder.Build()); 38 std::unique_ptr<URLRequestContext> context(builder.Build());
29 context->OnMemoryDump(dump_args, process_memory_dump.get()); 39 context->OnMemoryDump(dump_args, process_memory_dump.get());
30 const base::trace_event::ProcessMemoryDump::AllocatorDumpsMap& 40 const base::trace_event::ProcessMemoryDump::AllocatorDumpsMap&
(...skipping 19 matching lines...) Expand all
50 } 60 }
51 } 61 }
52 ASSERT_TRUE(did_dump_http_network_session); 62 ASSERT_TRUE(did_dump_http_network_session);
53 ASSERT_TRUE(did_dump_ssl_client_session_cache); 63 ASSERT_TRUE(did_dump_ssl_client_session_cache);
54 ASSERT_TRUE(did_dump_url_request_context); 64 ASSERT_TRUE(did_dump_url_request_context);
55 ASSERT_TRUE(did_dump_url_request_context_http_network_session); 65 ASSERT_TRUE(did_dump_url_request_context_http_network_session);
56 } 66 }
57 67
58 // TODO(xunjieli): Add more granular tests on the MemoryDumpProvider. 68 // TODO(xunjieli): Add more granular tests on the MemoryDumpProvider.
59 } // namespace net 69 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_context.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698