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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 std::vector<std::string> lines = GetLinesFromListFile(); | 142 std::vector<std::string> lines = GetLinesFromListFile(); |
143 EXPECT_GT(lines.size(), 0u); | 143 EXPECT_GT(lines.size(), 0u); |
144 if (lines.empty()) | 144 if (lines.empty()) |
145 return std::string(); | 145 return std::string(); |
146 return lines[lines.size() - 1]; | 146 return lines[lines.size() - 1]; |
147 } | 147 } |
148 | 148 |
149 void VerifyRtpDumpInMultipart(const std::string& post_data, | 149 void VerifyRtpDumpInMultipart(const std::string& post_data, |
150 const std::string& dump_name, | 150 const std::string& dump_name, |
151 const std::string& dump_content) { | 151 const std::string& dump_content) { |
152 std::vector<std::string> lines; | 152 std::vector<std::string> lines = base::SplitStringUsingSubstr( |
153 base::SplitStringUsingSubstr(post_data, "\r\n", &lines); | 153 post_data, "\r\n", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
154 | 154 |
155 std::string name_line = "Content-Disposition: form-data; name=\""; | 155 std::string name_line = "Content-Disposition: form-data; name=\""; |
156 name_line.append(dump_name); | 156 name_line.append(dump_name); |
157 name_line.append("\""); | 157 name_line.append("\""); |
158 name_line.append("; filename=\""); | 158 name_line.append("; filename=\""); |
159 name_line.append(dump_name); | 159 name_line.append(dump_name); |
160 name_line.append(".gz\""); | 160 name_line.append(".gz\""); |
161 | 161 |
162 size_t i = 0; | 162 size_t i = 0; |
163 for (; i < lines.size(); ++i) { | 163 for (; i < lines.size(); ++i) { |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |