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

Side by Side Diff: components/metrics/public/cpp/call_stack_profile_struct_traits_unittest.cc

Issue 2532243002: Stack sampling profiler: fix module read validation failures (Closed)
Patch Set: Created 4 years 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 | « components/metrics/public/cpp/call_stack_profile_struct_traits.h ('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 <utility> 5 #include <utility>
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "components/metrics/public/interfaces/call_stack_profile_collector_test .mojom.h" 10 #include "components/metrics/public/interfaces/call_stack_profile_collector_test .mojom.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 { 123 {
124 Module(1ULL << (sizeof(uintptr_t) * 8) * 3 / 4, "abcd", 124 Module(1ULL << (sizeof(uintptr_t) * 8) * 3 / 4, "abcd",
125 base::FilePath(base::FilePath::kCurrentDirectory)), 125 base::FilePath(base::FilePath::kCurrentDirectory)),
126 true 126 true
127 }, 127 },
128 // Empty module id. 128 // Empty module id.
129 { 129 {
130 Module(0x10, "", base::FilePath(base::FilePath::kCurrentDirectory)), 130 Module(0x10, "", base::FilePath(base::FilePath::kCurrentDirectory)),
131 true 131 true
132 }, 132 },
133 // Module id at the length limit.
134 {
135 Module(0x10, std::string(40, ' '),
136 base::FilePath(base::FilePath::kCurrentDirectory)),
137 true
138 },
139 // Module id beyond the length limit.
140 {
141 Module(0x10, std::string(41, ' '),
142 base::FilePath(base::FilePath::kCurrentDirectory)),
143 false
144 },
145 }; 133 };
146 134
147 for (const SerializeCase& input : serialize_cases) { 135 for (const SerializeCase& input : serialize_cases) {
148 Module output; 136 Module output;
149 EXPECT_EQ(input.expect_success, 137 EXPECT_EQ(input.expect_success,
150 proxy_->BounceModule(input.module, &output)); 138 proxy_->BounceModule(input.module, &output));
151 139
152 if (!input.expect_success) 140 if (!input.expect_success)
153 continue; 141 continue;
154 142
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 CallStackProfileParams::PRESERVE_ORDER), 381 CallStackProfileParams::PRESERVE_ORDER),
394 &out)); 382 &out));
395 383
396 EXPECT_EQ(CallStackProfileParams::BROWSER_PROCESS, out.process); 384 EXPECT_EQ(CallStackProfileParams::BROWSER_PROCESS, out.process);
397 EXPECT_EQ(CallStackProfileParams::UI_THREAD, out.thread); 385 EXPECT_EQ(CallStackProfileParams::UI_THREAD, out.thread);
398 EXPECT_EQ(CallStackProfileParams::PROCESS_STARTUP, out.trigger); 386 EXPECT_EQ(CallStackProfileParams::PROCESS_STARTUP, out.trigger);
399 EXPECT_EQ(CallStackProfileParams::PRESERVE_ORDER, out.ordering_spec); 387 EXPECT_EQ(CallStackProfileParams::PRESERVE_ORDER, out.ordering_spec);
400 } 388 }
401 389
402 } // namespace metrics 390 } // namespace metrics
OLDNEW
« no previous file with comments | « components/metrics/public/cpp/call_stack_profile_struct_traits.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698