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

Side by Side Diff: components/tracing/common/graphics_memory_dump_provider_android_unittest.cc

Issue 2110663002: components: Change auto to not deduce raw pointers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase+one fix Created 4 years, 5 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "base/trace_event/memory_allocator_dump.h" 5 #include "base/trace_event/memory_allocator_dump.h"
6 #include "base/trace_event/process_memory_dump.h" 6 #include "base/trace_event/process_memory_dump.h"
7 #include "base/trace_event/trace_event_argument.h" 7 #include "base/trace_event/trace_event_argument.h"
8 #include "components/tracing/common/graphics_memory_dump_provider_android.h" 8 #include "components/tracing/common/graphics_memory_dump_provider_android.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 namespace tracing { 11 namespace tracing {
12 12
13 TEST(GraphicsMemoryDumpProviderTest, ParseResponse) { 13 TEST(GraphicsMemoryDumpProviderTest, ParseResponse) {
14 const char* kDumpBaseName = GraphicsMemoryDumpProvider::kDumpBaseName; 14 const char* kDumpBaseName = GraphicsMemoryDumpProvider::kDumpBaseName;
15 15
16 base::trace_event::ProcessMemoryDump pmd( 16 base::trace_event::ProcessMemoryDump pmd(
17 nullptr, {base::trace_event::MemoryDumpLevelOfDetail::DETAILED}); 17 nullptr, {base::trace_event::MemoryDumpLevelOfDetail::DETAILED});
18 auto instance = GraphicsMemoryDumpProvider::GetInstance(); 18 auto* instance = GraphicsMemoryDumpProvider::GetInstance();
19 char buf[] = "graphics_total 12\ngraphics_pss 34\ngl_total 56\ngl_pss 78"; 19 char buf[] = "graphics_total 12\ngraphics_pss 34\ngl_total 56\ngl_pss 78";
20 instance->ParseResponseAndAddToDump(buf, strlen(buf), &pmd); 20 instance->ParseResponseAndAddToDump(buf, strlen(buf), &pmd);
21 21
22 // Check the "graphics" row. 22 // Check the "graphics" row.
23 auto mad = pmd.GetAllocatorDump(kDumpBaseName + std::string("graphics")); 23 auto* mad = pmd.GetAllocatorDump(kDumpBaseName + std::string("graphics"));
24 ASSERT_TRUE(mad); 24 ASSERT_TRUE(mad);
25 std::string json; 25 std::string json;
26 mad->attributes_for_testing()->AppendAsTraceFormat(&json); 26 mad->attributes_for_testing()->AppendAsTraceFormat(&json);
27 ASSERT_EQ( 27 ASSERT_EQ(
28 "{\"memtrack_pss\":{\"type\":\"scalar\",\"units\":\"bytes\",\"value\":" 28 "{\"memtrack_pss\":{\"type\":\"scalar\",\"units\":\"bytes\",\"value\":"
29 "\"22\"}," 29 "\"22\"},"
30 "\"memtrack_total\":{\"type\":\"scalar\",\"units\":\"bytes\",\"value\":" 30 "\"memtrack_total\":{\"type\":\"scalar\",\"units\":\"bytes\",\"value\":"
31 "\"c\"}}", 31 "\"c\"}}",
32 json); 32 json);
33 33
(...skipping 10 matching lines...) Expand all
44 json); 44 json);
45 45
46 // Test for truncated input. 46 // Test for truncated input.
47 pmd.Clear(); 47 pmd.Clear();
48 instance->ParseResponseAndAddToDump(buf, strlen(buf) - 14, &pmd); 48 instance->ParseResponseAndAddToDump(buf, strlen(buf) - 14, &pmd);
49 ASSERT_TRUE(pmd.GetAllocatorDump(kDumpBaseName + std::string("graphics"))); 49 ASSERT_TRUE(pmd.GetAllocatorDump(kDumpBaseName + std::string("graphics")));
50 ASSERT_FALSE(pmd.GetAllocatorDump(kDumpBaseName + std::string("gl"))); 50 ASSERT_FALSE(pmd.GetAllocatorDump(kDumpBaseName + std::string("gl")));
51 } 51 }
52 52
53 } // namespace tracing 53 } // namespace tracing
OLDNEW
« no previous file with comments | « components/tracing/child/child_memory_dump_manager_delegate_impl.cc ('k') | components/update_client/action.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698