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

Side by Side Diff: chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_apitest.cc

Issue 264793017: Implements RTP header dumping. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix leak Created 6 years, 6 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
OLDNEW
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 "base/json/json_writer.h" 5 #include "base/json/json_writer.h"
6 #include "base/strings/string_split.h" 6 #include "base/strings/string_split.h"
7 #include "chrome/browser/browser_process.h" 7 #include "chrome/browser/browser_process.h"
8 #include "chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_pr ivate_api.h" 8 #include "chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_pr ivate_api.h"
9 #include "chrome/browser/extensions/extension_apitest.h" 9 #include "chrome/browser/extensions/extension_apitest.h"
10 #include "chrome/browser/extensions/extension_function_test_utils.h" 10 #include "chrome/browser/extensions/extension_function_test_utils.h"
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 EXPECT_TRUE(multipart_lines[27].empty()); 269 EXPECT_TRUE(multipart_lines[27].empty());
270 EXPECT_TRUE(multipart_lines[28].empty()); // The removed zip part. 270 EXPECT_TRUE(multipart_lines[28].empty()); // The removed zip part.
271 std::string final_delimiter = boundary; 271 std::string final_delimiter = boundary;
272 final_delimiter += "--"; 272 final_delimiter += "--";
273 EXPECT_STREQ(final_delimiter.c_str(), multipart_lines[29].c_str()); 273 EXPECT_STREQ(final_delimiter.c_str(), multipart_lines[29].c_str());
274 EXPECT_TRUE(multipart_lines[30].empty()); 274 EXPECT_TRUE(multipart_lines[30].empty());
275 275
276 g_browser_process->webrtc_log_uploader()->OverrideUploadWithBufferForTesting( 276 g_browser_process->webrtc_log_uploader()->OverrideUploadWithBufferForTesting(
277 NULL); 277 NULL);
278 } 278 }
279
280 IN_PROC_BROWSER_TEST_F(WebrtcLoggingPrivateApiTest, TestStartStopRtpDump) {
281 scoped_refptr<Extension> empty_extension(utils::CreateEmptyExtension());
282
283 // Start RTP dump.
284 scoped_refptr<extensions::WebrtcLoggingPrivateStartRtpDumpFunction>
285 start_function(
286 new extensions::WebrtcLoggingPrivateStartRtpDumpFunction());
287 start_function->set_extension(empty_extension.get());
288 start_function->set_has_callback(true);
289
290 content::WebContents* contents =
291 browser()->tab_strip_model()->GetActiveWebContents();
292 base::ListValue parameters;
293 parameters.AppendInteger(extensions::ExtensionTabUtil::GetTabId(contents));
294 parameters.AppendString(contents->GetURL().GetOrigin().spec());
295 parameters.AppendBoolean(true);
296 parameters.AppendBoolean(true);
297 std::string parameter_string;
298 base::JSONWriter::Write(&parameters, &parameter_string);
299
300 scoped_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult(
301 start_function.get(), parameter_string, browser()));
302 ASSERT_FALSE(result.get());
303
304 // Stop RTP dump.
305 scoped_refptr<extensions::WebrtcLoggingPrivateStopRtpDumpFunction>
306 stop_function(new extensions::WebrtcLoggingPrivateStopRtpDumpFunction());
307 stop_function->set_extension(empty_extension.get());
308 stop_function->set_has_callback(true);
309
310 result.reset(utils::RunFunctionAndReturnSingleResult(
311 stop_function.get(), parameter_string, browser()));
312 ASSERT_FALSE(result.get());
313 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698