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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "base/strings/string_split.h" | 8 #include "base/strings/string_split.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 15 matching lines...) Expand all Loading... | |
26 using extensions::WebrtcLoggingPrivateSetMetaDataFunction; | 26 using extensions::WebrtcLoggingPrivateSetMetaDataFunction; |
27 using extensions::WebrtcLoggingPrivateStartFunction; | 27 using extensions::WebrtcLoggingPrivateStartFunction; |
28 using extensions::WebrtcLoggingPrivateStartRtpDumpFunction; | 28 using extensions::WebrtcLoggingPrivateStartRtpDumpFunction; |
29 using extensions::WebrtcLoggingPrivateStopFunction; | 29 using extensions::WebrtcLoggingPrivateStopFunction; |
30 using extensions::WebrtcLoggingPrivateStopRtpDumpFunction; | 30 using extensions::WebrtcLoggingPrivateStopRtpDumpFunction; |
31 using extensions::WebrtcLoggingPrivateStoreFunction; | 31 using extensions::WebrtcLoggingPrivateStoreFunction; |
32 using extensions::WebrtcLoggingPrivateUploadFunction; | 32 using extensions::WebrtcLoggingPrivateUploadFunction; |
33 using extensions::WebrtcLoggingPrivateUploadStoredFunction; | 33 using extensions::WebrtcLoggingPrivateUploadStoredFunction; |
34 using extensions::WebrtcLoggingPrivateStartAudioDebugRecordingsFunction; | 34 using extensions::WebrtcLoggingPrivateStartAudioDebugRecordingsFunction; |
35 using extensions::WebrtcLoggingPrivateStopAudioDebugRecordingsFunction; | 35 using extensions::WebrtcLoggingPrivateStopAudioDebugRecordingsFunction; |
36 using extensions::WebrtcLoggingPrivateStartRtcEventLoggingFunction; | |
37 using extensions::WebrtcLoggingPrivateStopRtcEventLoggingFunction; | |
36 | 38 |
37 namespace utils = extension_function_test_utils; | 39 namespace utils = extension_function_test_utils; |
38 | 40 |
39 namespace { | 41 namespace { |
40 | 42 |
41 static const char kTestLoggingSessionIdKey[] = "app_session_id"; | 43 static const char kTestLoggingSessionIdKey[] = "app_session_id"; |
42 static const char kTestLoggingSessionIdValue[] = "0123456789abcdef"; | 44 static const char kTestLoggingSessionIdValue[] = "0123456789abcdef"; |
43 static const char kTestLoggingUrl[] = "dummy url string"; | 45 static const char kTestLoggingUrl[] = "dummy url string"; |
44 | 46 |
45 std::string ParamsToString(const base::ListValue& parameters) { | 47 std::string ParamsToString(const base::ListValue& parameters) { |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
174 params, true); | 176 params, true); |
175 } | 177 } |
176 | 178 |
177 bool StopAudioDebugRecordings() { | 179 bool StopAudioDebugRecordings() { |
178 base::ListValue params; | 180 base::ListValue params; |
179 AppendTabIdAndUrl(¶ms); | 181 AppendTabIdAndUrl(¶ms); |
180 return RunFunction<WebrtcLoggingPrivateStopAudioDebugRecordingsFunction>( | 182 return RunFunction<WebrtcLoggingPrivateStopAudioDebugRecordingsFunction>( |
181 params, true); | 183 params, true); |
182 } | 184 } |
183 | 185 |
186 bool StartRtcEventLogging(int seconds) { | |
187 base::ListValue params; | |
188 AppendTabIdAndUrl(¶ms); | |
189 params.AppendInteger(seconds); | |
190 return RunFunction<WebrtcLoggingPrivateStartRtcEventLoggingFunction>(params, | |
191 true); | |
192 } | |
193 | |
194 bool StopRtcEventLogging() { | |
195 base::ListValue params; | |
196 AppendTabIdAndUrl(¶ms); | |
197 return RunFunction<WebrtcLoggingPrivateStopRtcEventLoggingFunction>(params, | |
198 true); | |
199 } | |
200 | |
184 private: | 201 private: |
185 scoped_refptr<Extension> extension_; | 202 scoped_refptr<Extension> extension_; |
186 }; | 203 }; |
187 | 204 |
188 // Helper class to temporarily tell the uploader to save the multipart buffer to | 205 // Helper class to temporarily tell the uploader to save the multipart buffer to |
189 // a test string instead of uploading. | 206 // a test string instead of uploading. |
190 class ScopedOverrideUploadBuffer { | 207 class ScopedOverrideUploadBuffer { |
191 public: | 208 public: |
192 ScopedOverrideUploadBuffer() { | 209 ScopedOverrideUploadBuffer() { |
193 g_browser_process->webrtc_log_uploader()-> | 210 g_browser_process->webrtc_log_uploader()-> |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
436 ASSERT_TRUE(StartAudioDebugRecordings(0)); | 453 ASSERT_TRUE(StartAudioDebugRecordings(0)); |
437 ASSERT_TRUE(StopAudioDebugRecordings()); | 454 ASSERT_TRUE(StopAudioDebugRecordings()); |
438 } | 455 } |
439 | 456 |
440 IN_PROC_BROWSER_TEST_F(WebrtcLoggingPrivateApiTest, | 457 IN_PROC_BROWSER_TEST_F(WebrtcLoggingPrivateApiTest, |
441 TestStartTimedAudioDebugRecordings) { | 458 TestStartTimedAudioDebugRecordings) { |
442 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 459 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
443 switches::kEnableAudioDebugRecordingsFromExtension); | 460 switches::kEnableAudioDebugRecordingsFromExtension); |
444 ASSERT_TRUE(StartAudioDebugRecordings(1)); | 461 ASSERT_TRUE(StartAudioDebugRecordings(1)); |
445 } | 462 } |
463 | |
464 IN_PROC_BROWSER_TEST_F(WebrtcLoggingPrivateApiTest, | |
465 TestStartStopRtcEventLogging) { | |
466 // TODO(terelius): These tests are missing verification of the actual RTC | |
467 // event log data. Maybe this could be incorporated into crbug.com/569957, | |
468 // and solved at the same time? | |
Henrik Grunell
2016/02/23 15:29:10
Please add test for content. It will help catch re
terelius-chromium
2016/03/02 10:01:09
Still working on this. Let's discuss offline.
| |
469 base::CommandLine::ForCurrentProcess()->AppendSwitch( | |
470 switches::kEnableRtcEventLoggingFromExtension); | |
471 ASSERT_TRUE(StartRtcEventLogging(0)); | |
472 ASSERT_TRUE(StopRtcEventLogging()); | |
473 } | |
474 | |
475 IN_PROC_BROWSER_TEST_F(WebrtcLoggingPrivateApiTest, | |
476 TestStartTimedRtcEventLogging) { | |
477 base::CommandLine::ForCurrentProcess()->AppendSwitch( | |
478 switches::kEnableRtcEventLoggingFromExtension); | |
479 ASSERT_TRUE(StartRtcEventLogging(1)); | |
480 } | |
OLD | NEW |