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

Side by Side Diff: content/browser/tracing/memory_tracing_browsertest.cc

Issue 2479593002: Tracing: Bail out early in tracing tests when tracing is already enabled. (Closed)
Patch Set: wording Created 4 years, 1 month 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/tracing/child/child_trace_message_filter_browsertest.cc ('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 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_forward.h" 8 #include "base/callback_forward.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 } 103 }
104 104
105 void TearDown() override { 105 void TearDown() override {
106 MemoryDumpManager::GetInstance()->UnregisterDumpProvider( 106 MemoryDumpManager::GetInstance()->UnregisterDumpProvider(
107 mock_dump_provider_.get()); 107 mock_dump_provider_.get());
108 mock_dump_provider_.reset(); 108 mock_dump_provider_.reset();
109 ContentBrowserTest::TearDown(); 109 ContentBrowserTest::TearDown();
110 } 110 }
111 111
112 void EnableMemoryTracing() { 112 void EnableMemoryTracing() {
113 CHECK(!base::trace_event::TraceLog::GetInstance()->IsEnabled()) 113 // Re-enabling tracing could crash these tests https://crbug.com/657628 .
114 << "Tracing seems to be already enabled. Very likely this is because " 114 if (base::trace_event::TraceLog::GetInstance()->IsEnabled()) {
115 "the startup tracing file has been leaked from a previous test."; 115 FAIL() << "Tracing seems to be already enabled. "
116 "Very likely this is because the startup tracing file "
117 "has been leaked from a previous test.";
118 }
116 // Enable tracing without periodic dumps. 119 // Enable tracing without periodic dumps.
117 base::trace_event::TraceConfig trace_config( 120 base::trace_event::TraceConfig trace_config(
118 base::trace_event::TraceConfigMemoryTestUtil:: 121 base::trace_event::TraceConfigMemoryTestUtil::
119 GetTraceConfig_EmptyTriggers()); 122 GetTraceConfig_EmptyTriggers());
120 123
121 base::RunLoop run_loop; 124 base::RunLoop run_loop;
122 bool success = TracingController::GetInstance()->StartTracing( 125 bool success = TracingController::GetInstance()->StartTracing(
123 trace_config, run_loop.QuitClosure()); 126 trace_config, run_loop.QuitClosure());
124 EXPECT_TRUE(success); 127 EXPECT_TRUE(success);
125 run_loop.Run(); 128 run_loop.Run();
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 EXPECT_CALL(*this, OnMemoryDumpDone(_, true /* success */)); 316 EXPECT_CALL(*this, OnMemoryDumpDone(_, true /* success */));
314 317
315 EnableMemoryTracing(); 318 EnableMemoryTracing();
316 RequestGlobalDumpAndWait(false /* from_renderer_thread */, 319 RequestGlobalDumpAndWait(false /* from_renderer_thread */,
317 MemoryDumpType::EXPLICITLY_TRIGGERED, 320 MemoryDumpType::EXPLICITLY_TRIGGERED,
318 MemoryDumpLevelOfDetail::DETAILED); 321 MemoryDumpLevelOfDetail::DETAILED);
319 DisableTracing(); 322 DisableTracing();
320 } 323 }
321 324
322 } // namespace content 325 } // namespace content
OLDNEW
« no previous file with comments | « components/tracing/child/child_trace_message_filter_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698