| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <memory> | 5 #include <memory> |
| 6 #include <utility> | 6 #include <utility> |
| 7 | 7 |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 WebrtcLoggingPrivateStartWebRtcEventLoggingFunction>()); | 135 WebrtcLoggingPrivateStartWebRtcEventLoggingFunction>()); |
| 136 std::unique_ptr<base::Value> start_result( | 136 std::unique_ptr<base::Value> start_result( |
| 137 utils::RunFunctionAndReturnSingleResult( | 137 utils::RunFunctionAndReturnSingleResult( |
| 138 start_function.get(), ParamsToString(start_params), browser())); | 138 start_function.get(), ParamsToString(start_params), browser())); |
| 139 ASSERT_TRUE(start_result.get()); | 139 ASSERT_TRUE(start_result.get()); |
| 140 | 140 |
| 141 // Get the file name. | 141 // Get the file name. |
| 142 std::unique_ptr<extensions::api::webrtc_logging_private::RecordingInfo> | 142 std::unique_ptr<extensions::api::webrtc_logging_private::RecordingInfo> |
| 143 recordings_info_start( | 143 recordings_info_start( |
| 144 extensions::api::webrtc_logging_private::RecordingInfo::FromValue( | 144 extensions::api::webrtc_logging_private::RecordingInfo::FromValue( |
| 145 *start_result.get())); | 145 *start_result)); |
| 146 ASSERT_TRUE(recordings_info_start.get()); | 146 ASSERT_TRUE(recordings_info_start.get()); |
| 147 base::FilePath file_name_start( | 147 base::FilePath file_name_start( |
| 148 base::FilePath::FromUTF8Unsafe(recordings_info_start->prefix_path)); | 148 base::FilePath::FromUTF8Unsafe(recordings_info_start->prefix_path)); |
| 149 | 149 |
| 150 #if !defined(OS_MACOSX) | 150 #if !defined(OS_MACOSX) |
| 151 // Video is choppy on Mac OS X. http://crbug.com/443542. | 151 // Video is choppy on Mac OS X. http://crbug.com/443542. |
| 152 WaitForVideoToPlay(left_tab); | 152 WaitForVideoToPlay(left_tab); |
| 153 WaitForVideoToPlay(right_tab); | 153 WaitForVideoToPlay(right_tab); |
| 154 #endif | 154 #endif |
| 155 | 155 |
| 156 // Stop the event log. | 156 // Stop the event log. |
| 157 base::ListValue stop_params; | 157 base::ListValue stop_params; |
| 158 AppendTabIdAndUrl(&stop_params, left_tab); | 158 AppendTabIdAndUrl(&stop_params, left_tab); |
| 159 scoped_refptr<WebrtcLoggingPrivateStopWebRtcEventLoggingFunction> | 159 scoped_refptr<WebrtcLoggingPrivateStopWebRtcEventLoggingFunction> |
| 160 stop_function(CreateExtensionFunction< | 160 stop_function(CreateExtensionFunction< |
| 161 WebrtcLoggingPrivateStopWebRtcEventLoggingFunction>()); | 161 WebrtcLoggingPrivateStopWebRtcEventLoggingFunction>()); |
| 162 std::unique_ptr<base::Value> stop_result( | 162 std::unique_ptr<base::Value> stop_result( |
| 163 utils::RunFunctionAndReturnSingleResult( | 163 utils::RunFunctionAndReturnSingleResult( |
| 164 stop_function.get(), ParamsToString(stop_params), browser())); | 164 stop_function.get(), ParamsToString(stop_params), browser())); |
| 165 | 165 |
| 166 // Get the file name. | 166 // Get the file name. |
| 167 std::unique_ptr<extensions::api::webrtc_logging_private::RecordingInfo> | 167 std::unique_ptr<extensions::api::webrtc_logging_private::RecordingInfo> |
| 168 recordings_info_stop( | 168 recordings_info_stop( |
| 169 extensions::api::webrtc_logging_private::RecordingInfo::FromValue( | 169 extensions::api::webrtc_logging_private::RecordingInfo::FromValue( |
| 170 *stop_result.get())); | 170 *stop_result)); |
| 171 ASSERT_TRUE(recordings_info_stop.get()); | 171 ASSERT_TRUE(recordings_info_stop.get()); |
| 172 base::FilePath file_name_stop( | 172 base::FilePath file_name_stop( |
| 173 base::FilePath::FromUTF8Unsafe(recordings_info_stop->prefix_path)); | 173 base::FilePath::FromUTF8Unsafe(recordings_info_stop->prefix_path)); |
| 174 | 174 |
| 175 HangUp(left_tab); | 175 HangUp(left_tab); |
| 176 HangUp(right_tab); | 176 HangUp(right_tab); |
| 177 | 177 |
| 178 EXPECT_EQ(file_name_start, file_name_stop); | 178 EXPECT_EQ(file_name_start, file_name_stop); |
| 179 | 179 |
| 180 // Check that the file exists and is non-empty. | 180 // Check that the file exists and is non-empty. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 WebrtcLoggingPrivateStartWebRtcEventLoggingFunction>()); | 229 WebrtcLoggingPrivateStartWebRtcEventLoggingFunction>()); |
| 230 std::unique_ptr<base::Value> start_result( | 230 std::unique_ptr<base::Value> start_result( |
| 231 utils::RunFunctionAndReturnSingleResult( | 231 utils::RunFunctionAndReturnSingleResult( |
| 232 start_function.get(), ParamsToString(start_params), browser())); | 232 start_function.get(), ParamsToString(start_params), browser())); |
| 233 ASSERT_TRUE(start_result.get()); | 233 ASSERT_TRUE(start_result.get()); |
| 234 | 234 |
| 235 // Get the file name. | 235 // Get the file name. |
| 236 std::unique_ptr<extensions::api::webrtc_logging_private::RecordingInfo> | 236 std::unique_ptr<extensions::api::webrtc_logging_private::RecordingInfo> |
| 237 recordings_info_start( | 237 recordings_info_start( |
| 238 extensions::api::webrtc_logging_private::RecordingInfo::FromValue( | 238 extensions::api::webrtc_logging_private::RecordingInfo::FromValue( |
| 239 *start_result.get())); | 239 *start_result)); |
| 240 ASSERT_TRUE(recordings_info_start.get()); | 240 ASSERT_TRUE(recordings_info_start.get()); |
| 241 base::FilePath file_name_start( | 241 base::FilePath file_name_start( |
| 242 base::FilePath::FromUTF8Unsafe(recordings_info_start->prefix_path)); | 242 base::FilePath::FromUTF8Unsafe(recordings_info_start->prefix_path)); |
| 243 | 243 |
| 244 #if !defined(OS_MACOSX) | 244 #if !defined(OS_MACOSX) |
| 245 // Video is choppy on Mac OS X. http://crbug.com/443542. | 245 // Video is choppy on Mac OS X. http://crbug.com/443542. |
| 246 WaitForVideoToPlay(left_tab); | 246 WaitForVideoToPlay(left_tab); |
| 247 WaitForVideoToPlay(right_tab); | 247 WaitForVideoToPlay(right_tab); |
| 248 #endif | 248 #endif |
| 249 | 249 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 266 VLOG(1) << "Waiting for logfile to become available..."; | 266 VLOG(1) << "Waiting for logfile to become available..."; |
| 267 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(100)); | 267 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(100)); |
| 268 } | 268 } |
| 269 ASSERT_TRUE(base::PathExists(full_file_name)); | 269 ASSERT_TRUE(base::PathExists(full_file_name)); |
| 270 EXPECT_TRUE(base::GetFileSize(full_file_name, &file_size)); | 270 EXPECT_TRUE(base::GetFileSize(full_file_name, &file_size)); |
| 271 EXPECT_GT(file_size, 0); | 271 EXPECT_GT(file_size, 0); |
| 272 | 272 |
| 273 // Clean up. | 273 // Clean up. |
| 274 base::DeleteFile(full_file_name, false); | 274 base::DeleteFile(full_file_name, false); |
| 275 } | 275 } |
| OLD | NEW |