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

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

Issue 2724793002: Revert of memory-infra: Finish moving memory_infra from TracingController (Closed)
Patch Set: Created 3 years, 9 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 | « content/browser/browser_main.cc ('k') | content/browser/tracing/trace_message_filter.h » ('j') | 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"
11 #include "base/threading/thread_task_runner_handle.h" 11 #include "base/threading/thread_task_runner_handle.h"
12 #include "base/trace_event/memory_dump_manager.h" 12 #include "base/trace_event/memory_dump_manager.h"
13 #include "base/trace_event/memory_dump_provider.h" 13 #include "base/trace_event/memory_dump_provider.h"
14 #include "base/trace_event/memory_dump_request_args.h" 14 #include "base/trace_event/memory_dump_request_args.h"
15 #include "base/trace_event/trace_config_memory_test_util.h" 15 #include "base/trace_event/trace_config_memory_test_util.h"
16 #include "base/trace_event/trace_log.h" 16 #include "base/trace_event/trace_log.h"
17 #include "content/public/browser/tracing_controller.h" 17 #include "content/public/browser/tracing_controller.h"
18 #include "content/public/common/content_switches.h" 18 #include "content/public/common/content_switches.h"
19 #include "content/public/test/browser_test_utils.h" 19 #include "content/public/test/browser_test_utils.h"
20 #include "content/public/test/content_browser_test.h" 20 #include "content/public/test/content_browser_test.h"
21 #include "content/public/test/content_browser_test_utils.h" 21 #include "content/public/test/content_browser_test_utils.h"
22 #include "content/shell/browser/shell.h" 22 #include "content/shell/browser/shell.h"
23 #include "services/resource_coordinator/memory/coordinator/coordinator_impl.h"
24 #include "testing/gmock/include/gmock/gmock.h" 23 #include "testing/gmock/include/gmock/gmock.h"
25 24
26 using base::trace_event::MemoryDumpArgs; 25 using base::trace_event::MemoryDumpArgs;
27 using base::trace_event::MemoryDumpLevelOfDetail; 26 using base::trace_event::MemoryDumpLevelOfDetail;
28 using base::trace_event::MemoryDumpManager; 27 using base::trace_event::MemoryDumpManager;
29 using base::trace_event::MemoryDumpType; 28 using base::trace_event::MemoryDumpType;
30 using base::trace_event::ProcessMemoryDump; 29 using base::trace_event::ProcessMemoryDump;
31 using testing::_; 30 using testing::_;
32 using testing::Return; 31 using testing::Return;
33 32
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 FAIL() << "Tracing seems to be already enabled. " 115 FAIL() << "Tracing seems to be already enabled. "
117 "Very likely this is because the startup tracing file " 116 "Very likely this is because the startup tracing file "
118 "has been leaked from a previous test."; 117 "has been leaked from a previous test.";
119 } 118 }
120 // Enable tracing without periodic dumps. 119 // Enable tracing without periodic dumps.
121 base::trace_event::TraceConfig trace_config( 120 base::trace_event::TraceConfig trace_config(
122 base::trace_event::TraceConfigMemoryTestUtil:: 121 base::trace_event::TraceConfigMemoryTestUtil::
123 GetTraceConfig_EmptyTriggers()); 122 GetTraceConfig_EmptyTriggers());
124 123
125 base::RunLoop run_loop; 124 base::RunLoop run_loop;
126 // Start the Coordinator service.
127 memory_instrumentation::CoordinatorImpl::GetInstance(
128 base::ThreadTaskRunnerHandle::Get().get());
129 bool success = TracingController::GetInstance()->StartTracing( 125 bool success = TracingController::GetInstance()->StartTracing(
130 trace_config, run_loop.QuitClosure()); 126 trace_config, run_loop.QuitClosure());
131 EXPECT_TRUE(success); 127 EXPECT_TRUE(success);
132 run_loop.Run(); 128 run_loop.Run();
133 } 129 }
134 130
135 void DisableTracing() { 131 void DisableTracing() {
136 bool success = TracingController::GetInstance()->StopTracing(NULL); 132 bool success = TracingController::GetInstance()->StopTracing(NULL);
137 EXPECT_TRUE(success); 133 EXPECT_TRUE(success);
138 base::RunLoop().RunUntilIdle(); 134 base::RunLoop().RunUntilIdle();
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 EXPECT_CALL(*this, OnMemoryDumpDone(_, true /* success */)); 316 EXPECT_CALL(*this, OnMemoryDumpDone(_, true /* success */));
321 317
322 EnableMemoryTracing(); 318 EnableMemoryTracing();
323 RequestGlobalDumpAndWait(false /* from_renderer_thread */, 319 RequestGlobalDumpAndWait(false /* from_renderer_thread */,
324 MemoryDumpType::EXPLICITLY_TRIGGERED, 320 MemoryDumpType::EXPLICITLY_TRIGGERED,
325 MemoryDumpLevelOfDetail::DETAILED); 321 MemoryDumpLevelOfDetail::DETAILED);
326 DisableTracing(); 322 DisableTracing();
327 } 323 }
328 324
329 } // namespace content 325 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_main.cc ('k') | content/browser/tracing/trace_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698