| OLD | NEW |
| 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "base/thread_task_runner_handle.h" | 8 #include "base/thread_task_runner_handle.h" |
| 9 #include "base/trace_event/memory_dump_manager.h" | 9 #include "base/trace_event/memory_dump_manager.h" |
| 10 #include "base/trace_event/memory_dump_provider.h" | 10 #include "base/trace_event/memory_dump_provider.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 80 |
| 81 void TearDown() override { | 81 void TearDown() override { |
| 82 MemoryDumpManager::GetInstance()->UnregisterDumpProvider( | 82 MemoryDumpManager::GetInstance()->UnregisterDumpProvider( |
| 83 mock_dump_provider_.get()); | 83 mock_dump_provider_.get()); |
| 84 mock_dump_provider_.reset(); | 84 mock_dump_provider_.reset(); |
| 85 ContentBrowserTest::TearDown(); | 85 ContentBrowserTest::TearDown(); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void EnableMemoryTracing() { | 88 void EnableMemoryTracing() { |
| 89 base::RunLoop run_loop; | 89 base::RunLoop run_loop; |
| 90 std::string category_filter = MemoryDumpManager::kTraceCategoryForTesting; | 90 std::string category_filter = MemoryDumpManager::kTraceCategory; |
| 91 base::trace_event::TraceConfig trace_config(category_filter, ""); | 91 base::trace_event::TraceConfig trace_config(category_filter, ""); |
| 92 bool success = TracingController::GetInstance()->EnableRecording( | 92 bool success = TracingController::GetInstance()->EnableRecording( |
| 93 trace_config, run_loop.QuitClosure()); | 93 trace_config, run_loop.QuitClosure()); |
| 94 EXPECT_TRUE(success); | 94 EXPECT_TRUE(success); |
| 95 run_loop.Run(); | 95 run_loop.Run(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void DisableTracing() { | 98 void DisableTracing() { |
| 99 bool success = TracingController::GetInstance()->DisableRecording(NULL); | 99 bool success = TracingController::GetInstance()->DisableRecording(NULL); |
| 100 EXPECT_TRUE(success); | 100 EXPECT_TRUE(success); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 | 212 |
| 213 EnableMemoryTracing(); | 213 EnableMemoryTracing(); |
| 214 RequestGlobalDumpAndWait(false /* from_renderer_thread */); | 214 RequestGlobalDumpAndWait(false /* from_renderer_thread */); |
| 215 EXPECT_EQ(1u, callback_call_count_); | 215 EXPECT_EQ(1u, callback_call_count_); |
| 216 EXPECT_NE(0u, last_callback_dump_guid_); | 216 EXPECT_NE(0u, last_callback_dump_guid_); |
| 217 EXPECT_TRUE(last_callback_success_); | 217 EXPECT_TRUE(last_callback_success_); |
| 218 DisableTracing(); | 218 DisableTracing(); |
| 219 } | 219 } |
| 220 | 220 |
| 221 } // namespace content | 221 } // namespace content |
| OLD | NEW |