OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/media/webrtc/webrtc_log_uploader.h" | 5 #include "chrome/browser/media/webrtc/webrtc_log_uploader.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 base::ScopedTempDir temp_dir; | 255 base::ScopedTempDir temp_dir; |
256 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 256 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
257 | 257 |
258 std::unique_ptr<WebRtcLogUploader> webrtc_log_uploader( | 258 std::unique_ptr<WebRtcLogUploader> webrtc_log_uploader( |
259 new WebRtcLogUploader()); | 259 new WebRtcLogUploader()); |
260 | 260 |
261 std::string post_data; | 261 std::string post_data; |
262 webrtc_log_uploader->OverrideUploadWithBufferForTesting(&post_data); | 262 webrtc_log_uploader->OverrideUploadWithBufferForTesting(&post_data); |
263 | 263 |
264 // Create the fake dump files. | 264 // Create the fake dump files. |
265 const base::FilePath incoming_dump = temp_dir.path().AppendASCII("recv"); | 265 const base::FilePath incoming_dump = temp_dir.GetPath().AppendASCII("recv"); |
266 const base::FilePath outgoing_dump = temp_dir.path().AppendASCII("send"); | 266 const base::FilePath outgoing_dump = temp_dir.GetPath().AppendASCII("send"); |
267 const std::string incoming_dump_content = "dummy incoming"; | 267 const std::string incoming_dump_content = "dummy incoming"; |
268 const std::string outgoing_dump_content = "dummy outgoing"; | 268 const std::string outgoing_dump_content = "dummy outgoing"; |
269 | 269 |
270 base::WriteFile(incoming_dump, | 270 base::WriteFile(incoming_dump, |
271 &incoming_dump_content[0], | 271 &incoming_dump_content[0], |
272 incoming_dump_content.size()); | 272 incoming_dump_content.size()); |
273 base::WriteFile(outgoing_dump, | 273 base::WriteFile(outgoing_dump, |
274 &outgoing_dump_content[0], | 274 &outgoing_dump_content[0], |
275 outgoing_dump_content.size()); | 275 outgoing_dump_content.size()); |
276 | 276 |
277 WebRtcLogUploadDoneData upload_done_data; | 277 WebRtcLogUploadDoneData upload_done_data; |
278 upload_done_data.log_path = temp_dir.path().AppendASCII("log"); | 278 upload_done_data.log_path = temp_dir.GetPath().AppendASCII("log"); |
279 | 279 |
280 std::unique_ptr<Profile> profile(new TestingProfile()); | 280 std::unique_ptr<Profile> profile(new TestingProfile()); |
281 scoped_refptr<WebRtcLoggingHandlerHost> host(new WebRtcLoggingHandlerHost( | 281 scoped_refptr<WebRtcLoggingHandlerHost> host(new WebRtcLoggingHandlerHost( |
282 -1, profile.get(), webrtc_log_uploader.get())); | 282 -1, profile.get(), webrtc_log_uploader.get())); |
283 | 283 |
284 upload_done_data.incoming_rtp_dump = incoming_dump; | 284 upload_done_data.incoming_rtp_dump = incoming_dump; |
285 upload_done_data.outgoing_rtp_dump = outgoing_dump; | 285 upload_done_data.outgoing_rtp_dump = outgoing_dump; |
286 upload_done_data.host = host.get(); | 286 upload_done_data.host = host.get(); |
287 | 287 |
288 std::unique_ptr<WebRtcLogBuffer> log(new WebRtcLogBuffer()); | 288 std::unique_ptr<WebRtcLogBuffer> log(new WebRtcLogBuffer()); |
289 log->SetComplete(); | 289 log->SetComplete(); |
290 webrtc_log_uploader->LoggingStoppedDoUpload( | 290 webrtc_log_uploader->LoggingStoppedDoUpload( |
291 std::move(log), base::MakeUnique<MetaDataMap>(), upload_done_data); | 291 std::move(log), base::MakeUnique<MetaDataMap>(), upload_done_data); |
292 | 292 |
293 VerifyRtpDumpInMultipart(post_data, "rtpdump_recv", incoming_dump_content); | 293 VerifyRtpDumpInMultipart(post_data, "rtpdump_recv", incoming_dump_content); |
294 VerifyRtpDumpInMultipart(post_data, "rtpdump_send", outgoing_dump_content); | 294 VerifyRtpDumpInMultipart(post_data, "rtpdump_send", outgoing_dump_content); |
295 | 295 |
296 webrtc_log_uploader->StartShutdown(); | 296 webrtc_log_uploader->StartShutdown(); |
297 FlushIOThread(); | 297 FlushIOThread(); |
298 } | 298 } |
OLD | NEW |