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/callback.h" | 5 #include "base/callback.h" |
6 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
7 #include "base/thread_task_runner_handle.h" | 7 #include "base/thread_task_runner_handle.h" |
8 #include "base/trace_event/memory_dump_manager.h" | 8 #include "base/trace_event/memory_dump_manager.h" |
9 #include "base/trace_event/memory_dump_provider.h" | 9 #include "base/trace_event/memory_dump_provider.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 // checks that the child actually sends a response to that. | 130 // checks that the child actually sends a response to that. |
131 void RequestProcessMemoryDumpAndCheckResponse(uint64 dump_guid) { | 131 void RequestProcessMemoryDumpAndCheckResponse(uint64 dump_guid) { |
132 SimulateSyntheticMessageFromBrowser(TracingMsg_ProcessMemoryDumpRequest( | 132 SimulateSyntheticMessageFromBrowser(TracingMsg_ProcessMemoryDumpRequest( |
133 {dump_guid, MemoryDumpType::EXPLICITLY_TRIGGERED})); | 133 {dump_guid, MemoryDumpType::EXPLICITLY_TRIGGERED})); |
134 | 134 |
135 // Check that a child -> browser response to the local dump request is sent. | 135 // Check that a child -> browser response to the local dump request is sent. |
136 const IPC::Message* msg = | 136 const IPC::Message* msg = |
137 WaitForIPCMessage(TracingHostMsg_ProcessMemoryDumpResponse::ID); | 137 WaitForIPCMessage(TracingHostMsg_ProcessMemoryDumpResponse::ID); |
138 EXPECT_NE(nullptr, msg); | 138 EXPECT_NE(nullptr, msg); |
139 | 139 |
140 // Check that the |dump_guid| and the |sucess| fields are properly set. | 140 // Check that the |dump_guid| and the |success| fields are properly set. |
141 TracingHostMsg_ProcessMemoryDumpResponse::Param params; | 141 TracingHostMsg_ProcessMemoryDumpResponse::Param params; |
142 TracingHostMsg_ProcessMemoryDumpResponse::Read(msg, ¶ms); | 142 TracingHostMsg_ProcessMemoryDumpResponse::Read(msg, ¶ms); |
143 const uint64 resp_guid = base::get<0>(params); | 143 const uint64 resp_guid = base::get<0>(params); |
144 const bool resp_success = base::get<1>(params); | 144 const bool resp_success = base::get<1>(params); |
145 EXPECT_EQ(dump_guid, resp_guid); | 145 EXPECT_EQ(dump_guid, resp_guid); |
146 EXPECT_TRUE(resp_success); | 146 EXPECT_TRUE(resp_success); |
147 } | 147 } |
148 | 148 |
149 // Retrieves the MemoryDumpRequestArgs of the global memory dump request that | 149 // Retrieves the MemoryDumpRequestArgs of the global memory dump request that |
150 // this child process tried to send to the browser. Fails if either none or | 150 // this child process tried to send to the browser. Fails if either none or |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 TracingMsg_GlobalMemoryDumpResponse(args.dump_guid, success)); | 301 TracingMsg_GlobalMemoryDumpResponse(args.dump_guid, success)); |
302 EXPECT_EQ(i + 1, callback_call_count_); | 302 EXPECT_EQ(i + 1, callback_call_count_); |
303 EXPECT_EQ(args.dump_guid, last_callback_dump_guid_); | 303 EXPECT_EQ(args.dump_guid, last_callback_dump_guid_); |
304 EXPECT_EQ(success, last_callback_status_); | 304 EXPECT_EQ(success, last_callback_status_); |
305 } | 305 } |
306 | 306 |
307 DisableTracing(); | 307 DisableTracing(); |
308 } | 308 } |
309 | 309 |
310 } // namespace tracing | 310 } // namespace tracing |
OLD | NEW |