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

Side by Side Diff: chrome/browser/metrics/process_memory_metrics_emitter_browsertest.cc

Issue 2891063002: Disable ProcessMemoryMetricsEmitterTest.* on MSan (Closed)
Patch Set: Created 3 years, 7 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 | « no previous file | 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "chrome/browser/metrics/process_memory_metrics_emitter.h" 5 #include "chrome/browser/metrics/process_memory_metrics_emitter.h"
6 6
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/test/histogram_tester.h" 9 #include "base/test/histogram_tester.h"
10 #include "base/test/trace_event_analyzer.h" 10 #include "base/test/trace_event_analyzer.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 117
118 class ProcessMemoryMetricsEmitterTest : public InProcessBrowserTest { 118 class ProcessMemoryMetricsEmitterTest : public InProcessBrowserTest {
119 public: 119 public:
120 ProcessMemoryMetricsEmitterTest() {} 120 ProcessMemoryMetricsEmitterTest() {}
121 ~ProcessMemoryMetricsEmitterTest() override {} 121 ~ProcessMemoryMetricsEmitterTest() override {}
122 122
123 private: 123 private:
124 DISALLOW_COPY_AND_ASSIGN(ProcessMemoryMetricsEmitterTest); 124 DISALLOW_COPY_AND_ASSIGN(ProcessMemoryMetricsEmitterTest);
125 }; 125 };
126 126
127 #if defined(ADDRESS_SANITIZER) 127 #if defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER)
128 #define MAYBE_FetchAndEmitMetrics DISABLED_FetchAndEmitMetrics 128 #define MAYBE_FetchAndEmitMetrics DISABLED_FetchAndEmitMetrics
129 #else 129 #else
130 #define MAYBE_FetchAndEmitMetrics FetchAndEmitMetrics 130 #define MAYBE_FetchAndEmitMetrics FetchAndEmitMetrics
131 #endif 131 #endif
132 IN_PROC_BROWSER_TEST_F(ProcessMemoryMetricsEmitterTest, 132 IN_PROC_BROWSER_TEST_F(ProcessMemoryMetricsEmitterTest,
133 MAYBE_FetchAndEmitMetrics) { 133 MAYBE_FetchAndEmitMetrics) {
134 GURL url1("about:blank"); 134 GURL url1("about:blank");
135 ui_test_utils::NavigateToURLWithDisposition( 135 ui_test_utils::NavigateToURLWithDisposition(
136 browser(), url1, WindowOpenDisposition::NEW_FOREGROUND_TAB, 136 browser(), url1, WindowOpenDisposition::NEW_FOREGROUND_TAB,
137 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); 137 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
138 138
139 base::HistogramTester histogram_tester; 139 base::HistogramTester histogram_tester;
140 base::RunLoop run_loop; 140 base::RunLoop run_loop;
141 141
142 // Intentionally let emitter leave scope to check that it correctly keeps 142 // Intentionally let emitter leave scope to check that it correctly keeps
143 // itself alive. 143 // itself alive.
144 { 144 {
145 scoped_refptr<ProcessMemoryMetricsEmitterFake> emitter( 145 scoped_refptr<ProcessMemoryMetricsEmitterFake> emitter(
146 new ProcessMemoryMetricsEmitterFake(&run_loop)); 146 new ProcessMemoryMetricsEmitterFake(&run_loop));
147 emitter->FetchAndEmitProcessMemoryMetrics(); 147 emitter->FetchAndEmitProcessMemoryMetrics();
148 } 148 }
149 149
150 run_loop.Run(); 150 run_loop.Run();
151 151
152 CheckAllMemoryMetrics(histogram_tester, 1); 152 CheckAllMemoryMetrics(histogram_tester, 1);
153 } 153 }
154 154
155 #if defined(ADDRESS_SANITIZER) 155 #if defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER)
156 #define MAYBE_FetchDuringTrace DISABLED_FetchDuringTrace 156 #define MAYBE_FetchDuringTrace DISABLED_FetchDuringTrace
157 #else 157 #else
158 #define MAYBE_FetchDuringTrace FetchDuringTrace 158 #define MAYBE_FetchDuringTrace FetchDuringTrace
159 #endif 159 #endif
160 IN_PROC_BROWSER_TEST_F(ProcessMemoryMetricsEmitterTest, 160 IN_PROC_BROWSER_TEST_F(ProcessMemoryMetricsEmitterTest,
161 MAYBE_FetchDuringTrace) { 161 MAYBE_FetchDuringTrace) {
162 GURL url1("about:blank"); 162 GURL url1("about:blank");
163 ui_test_utils::NavigateToURLWithDisposition( 163 ui_test_utils::NavigateToURLWithDisposition(
164 browser(), url1, WindowOpenDisposition::NEW_FOREGROUND_TAB, 164 browser(), url1, WindowOpenDisposition::NEW_FOREGROUND_TAB,
165 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); 165 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 &events); 199 &events);
200 200
201 ASSERT_GT(events.size(), 1u); 201 ASSERT_GT(events.size(), 1u);
202 ASSERT_TRUE(trace_analyzer::CountMatches( 202 ASSERT_TRUE(trace_analyzer::CountMatches(
203 events, trace_analyzer::Query::EventNameIs(MemoryDumpTypeToString( 203 events, trace_analyzer::Query::EventNameIs(MemoryDumpTypeToString(
204 MemoryDumpType::EXPLICITLY_TRIGGERED)))); 204 MemoryDumpType::EXPLICITLY_TRIGGERED))));
205 205
206 CheckAllMemoryMetrics(histogram_tester, 1); 206 CheckAllMemoryMetrics(histogram_tester, 1);
207 } 207 }
208 208
209 #if defined(ADDRESS_SANITIZER) 209 #if defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER)
210 #define MAYBE_FetchThreeTimes DISABLED_FetchThreeTimes 210 #define MAYBE_FetchThreeTimes DISABLED_FetchThreeTimes
211 #else 211 #else
212 #define MAYBE_FetchThreeTimes FetchThreeTimes 212 #define MAYBE_FetchThreeTimes FetchThreeTimes
213 #endif 213 #endif
214 IN_PROC_BROWSER_TEST_F(ProcessMemoryMetricsEmitterTest, MAYBE_FetchThreeTimes) { 214 IN_PROC_BROWSER_TEST_F(ProcessMemoryMetricsEmitterTest, MAYBE_FetchThreeTimes) {
215 GURL url1("about:blank"); 215 GURL url1("about:blank");
216 ui_test_utils::NavigateToURLWithDisposition( 216 ui_test_utils::NavigateToURLWithDisposition(
217 browser(), url1, WindowOpenDisposition::NEW_FOREGROUND_TAB, 217 browser(), url1, WindowOpenDisposition::NEW_FOREGROUND_TAB,
218 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); 218 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
219 219
220 base::HistogramTester histogram_tester; 220 base::HistogramTester histogram_tester;
221 base::RunLoop run_loop; 221 base::RunLoop run_loop;
222 222
223 int count = 3; 223 int count = 3;
224 for (int i = 0; i < count; ++i) { 224 for (int i = 0; i < count; ++i) {
225 // Only the last emitter should stop the run loop. 225 // Only the last emitter should stop the run loop.
226 auto emitter = base::MakeRefCounted<ProcessMemoryMetricsEmitterFake>( 226 auto emitter = base::MakeRefCounted<ProcessMemoryMetricsEmitterFake>(
227 (i == count - 1) ? &run_loop : nullptr); 227 (i == count - 1) ? &run_loop : nullptr);
228 emitter->FetchAndEmitProcessMemoryMetrics(); 228 emitter->FetchAndEmitProcessMemoryMetrics();
229 } 229 }
230 230
231 run_loop.Run(); 231 run_loop.Run();
232 232
233 CheckAllMemoryMetrics(histogram_tester, count); 233 CheckAllMemoryMetrics(histogram_tester, count);
234 } 234 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698