| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/base/sdch_manager.h" | 5 #include "net/base/sdch_manager.h" |
| 6 | 6 |
| 7 #include <inttypes.h> | 7 #include <inttypes.h> |
| 8 #include <limits.h> | 8 #include <limits.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 EXPECT_TRUE(AddSdchDictionary(dictionary_text, target_gurl)); | 665 EXPECT_TRUE(AddSdchDictionary(dictionary_text, target_gurl)); |
| 666 EXPECT_EQ(1, observer.dictionary_added_notifications()); | 666 EXPECT_EQ(1, observer.dictionary_added_notifications()); |
| 667 EXPECT_EQ(target_gurl, observer.last_dictionary_url()); | 667 EXPECT_EQ(target_gurl, observer.last_dictionary_url()); |
| 668 EXPECT_EQ(server_hash, observer.last_server_hash()); | 668 EXPECT_EQ(server_hash, observer.last_server_hash()); |
| 669 | 669 |
| 670 base::trace_event::MemoryDumpArgs dump_args = {GetParam()}; | 670 base::trace_event::MemoryDumpArgs dump_args = {GetParam()}; |
| 671 std::unique_ptr<base::trace_event::ProcessMemoryDump> pmd( | 671 std::unique_ptr<base::trace_event::ProcessMemoryDump> pmd( |
| 672 new base::trace_event::ProcessMemoryDump(nullptr, dump_args)); | 672 new base::trace_event::ProcessMemoryDump(nullptr, dump_args)); |
| 673 | 673 |
| 674 base::trace_event::MemoryAllocatorDump* parent = | 674 base::trace_event::MemoryAllocatorDump* parent = |
| 675 pmd->CreateAllocatorDump("net/url_request_context_0x123"); | 675 pmd->CreateAllocatorDump("net/url_request_context/main/0x123"); |
| 676 sdch_manager()->DumpMemoryStats(pmd.get(), parent->absolute_name()); | 676 sdch_manager()->DumpMemoryStats(pmd.get(), parent->absolute_name()); |
| 677 | 677 |
| 678 const base::trace_event::MemoryAllocatorDump* sub_dump = | 678 const base::trace_event::MemoryAllocatorDump* sub_dump = |
| 679 pmd->GetAllocatorDump("net/url_request_context_0x123/sdch_manager"); | 679 pmd->GetAllocatorDump("net/url_request_context/main/0x123/sdch_manager"); |
| 680 ASSERT_NE(nullptr, sub_dump); | 680 ASSERT_NE(nullptr, sub_dump); |
| 681 const base::trace_event::MemoryAllocatorDump* dump = pmd->GetAllocatorDump( | 681 const base::trace_event::MemoryAllocatorDump* dump = pmd->GetAllocatorDump( |
| 682 base::StringPrintf("net/sdch_manager_0x%" PRIxPTR, | 682 base::StringPrintf("net/sdch_manager_0x%" PRIxPTR, |
| 683 reinterpret_cast<uintptr_t>(sdch_manager()))); | 683 reinterpret_cast<uintptr_t>(sdch_manager()))); |
| 684 std::unique_ptr<base::Value> raw_attrs = | 684 std::unique_ptr<base::Value> raw_attrs = |
| 685 dump->attributes_for_testing()->ToBaseValue(); | 685 dump->attributes_for_testing()->ToBaseValue(); |
| 686 base::DictionaryValue* attrs; | 686 base::DictionaryValue* attrs; |
| 687 ASSERT_TRUE(raw_attrs->GetAsDictionary(&attrs)); | 687 ASSERT_TRUE(raw_attrs->GetAsDictionary(&attrs)); |
| 688 base::DictionaryValue* size_attrs; | 688 base::DictionaryValue* size_attrs; |
| 689 ASSERT_TRUE(attrs->GetDictionary( | 689 ASSERT_TRUE(attrs->GetDictionary( |
| (...skipping 10 matching lines...) Expand all Loading... |
| 700 base::trace_event::MemoryAllocatorDump::kNameObjectCount, &count_attrs)); | 700 base::trace_event::MemoryAllocatorDump::kNameObjectCount, &count_attrs)); |
| 701 std::string count; | 701 std::string count; |
| 702 ASSERT_TRUE(count_attrs->GetString("value", &count)); | 702 ASSERT_TRUE(count_attrs->GetString("value", &count)); |
| 703 // One dictionary. | 703 // One dictionary. |
| 704 EXPECT_EQ("1", count); | 704 EXPECT_EQ("1", count); |
| 705 | 705 |
| 706 sdch_manager()->RemoveObserver(&observer); | 706 sdch_manager()->RemoveObserver(&observer); |
| 707 } | 707 } |
| 708 | 708 |
| 709 } // namespace net | 709 } // namespace net |
| OLD | NEW |