| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/http/http_cache.h" | 5 #include "net/http/http_cache.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 8368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8379 | 8379 |
| 8380 EXPECT_FALSE(response_info.was_cached); | 8380 EXPECT_FALSE(response_info.was_cached); |
| 8381 EXPECT_TRUE(response_info.network_accessed); | 8381 EXPECT_TRUE(response_info.network_accessed); |
| 8382 EXPECT_EQ(CacheEntryStatus::ENTRY_CANT_CONDITIONALIZE, | 8382 EXPECT_EQ(CacheEntryStatus::ENTRY_CANT_CONDITIONALIZE, |
| 8383 response_info.cache_entry_status); | 8383 response_info.cache_entry_status); |
| 8384 | 8384 |
| 8385 base::trace_event::MemoryDumpArgs dump_args = {GetParam()}; | 8385 base::trace_event::MemoryDumpArgs dump_args = {GetParam()}; |
| 8386 std::unique_ptr<base::trace_event::ProcessMemoryDump> process_memory_dump( | 8386 std::unique_ptr<base::trace_event::ProcessMemoryDump> process_memory_dump( |
| 8387 new base::trace_event::ProcessMemoryDump(nullptr, dump_args)); | 8387 new base::trace_event::ProcessMemoryDump(nullptr, dump_args)); |
| 8388 base::trace_event::MemoryAllocatorDump* parent_dump = | 8388 base::trace_event::MemoryAllocatorDump* parent_dump = |
| 8389 process_memory_dump->CreateAllocatorDump("net/url_request_context_0x123"); | 8389 process_memory_dump->CreateAllocatorDump( |
| 8390 "net/url_request_context/main/0x123"); |
| 8390 cache.http_cache()->DumpMemoryStats(process_memory_dump.get(), | 8391 cache.http_cache()->DumpMemoryStats(process_memory_dump.get(), |
| 8391 parent_dump->absolute_name()); | 8392 parent_dump->absolute_name()); |
| 8392 | 8393 |
| 8393 const base::trace_event::MemoryAllocatorDump* dump = | 8394 const base::trace_event::MemoryAllocatorDump* dump = |
| 8394 process_memory_dump->GetAllocatorDump( | 8395 process_memory_dump->GetAllocatorDump( |
| 8395 "net/url_request_context_0x123/http_cache"); | 8396 "net/url_request_context/main/0x123/http_cache"); |
| 8396 ASSERT_NE(nullptr, dump); | 8397 ASSERT_NE(nullptr, dump); |
| 8397 std::unique_ptr<base::Value> raw_attrs = | 8398 std::unique_ptr<base::Value> raw_attrs = |
| 8398 dump->attributes_for_testing()->ToBaseValue(); | 8399 dump->attributes_for_testing()->ToBaseValue(); |
| 8399 base::DictionaryValue* attrs; | 8400 base::DictionaryValue* attrs; |
| 8400 ASSERT_TRUE(raw_attrs->GetAsDictionary(&attrs)); | 8401 ASSERT_TRUE(raw_attrs->GetAsDictionary(&attrs)); |
| 8401 base::DictionaryValue* size_attrs; | 8402 base::DictionaryValue* size_attrs; |
| 8402 ASSERT_TRUE(attrs->GetDictionary( | 8403 ASSERT_TRUE(attrs->GetDictionary( |
| 8403 base::trace_event::MemoryAllocatorDump::kNameSize, &size_attrs)); | 8404 base::trace_event::MemoryAllocatorDump::kNameSize, &size_attrs)); |
| 8404 std::string size; | 8405 std::string size; |
| 8405 ASSERT_TRUE(size_attrs->GetString("value", &size)); | 8406 ASSERT_TRUE(size_attrs->GetString("value", &size)); |
| 8406 int actual_size = 0; | 8407 int actual_size = 0; |
| 8407 ASSERT_TRUE(base::HexStringToInt(size, &actual_size)); | 8408 ASSERT_TRUE(base::HexStringToInt(size, &actual_size)); |
| 8408 ASSERT_LT(0, actual_size); | 8409 ASSERT_LT(0, actual_size); |
| 8409 } | 8410 } |
| 8410 | 8411 |
| 8411 } // namespace net | 8412 } // namespace net |
| OLD | NEW |