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> |
| 6 #include <utility> |
| 7 |
5 #include "base/command_line.h" | 8 #include "base/command_line.h" |
6 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
7 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
8 #include "base/threading/platform_thread.h" | 11 #include "base/threading/platform_thread.h" |
9 #include "base/time/time.h" | 12 #include "base/time/time.h" |
10 #include "build/build_config.h" | 13 #include "build/build_config.h" |
11 #include "chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_pr
ivate_api.h" | 14 #include "chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_pr
ivate_api.h" |
12 #include "chrome/browser/extensions/extension_function_test_utils.h" | 15 #include "chrome/browser/extensions/extension_function_test_utils.h" |
13 #include "chrome/browser/extensions/extension_tab_util.h" | 16 #include "chrome/browser/extensions/extension_tab_util.h" |
14 #include "chrome/browser/media/webrtc_browsertest_base.h" | 17 #include "chrome/browser/media/webrtc_browsertest_base.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 template <typename T> | 86 template <typename T> |
84 scoped_refptr<T> CreateExtensionFunction() { | 87 scoped_refptr<T> CreateExtensionFunction() { |
85 scoped_refptr<T> function(new T()); | 88 scoped_refptr<T> function(new T()); |
86 function->set_extension(extension_.get()); | 89 function->set_extension(extension_.get()); |
87 function->set_has_callback(true); | 90 function->set_has_callback(true); |
88 return function; | 91 return function; |
89 } | 92 } |
90 | 93 |
91 void AppendTabIdAndUrl(base::ListValue* parameters, | 94 void AppendTabIdAndUrl(base::ListValue* parameters, |
92 content::WebContents* tab) { | 95 content::WebContents* tab) { |
93 base::DictionaryValue* request_info = new base::DictionaryValue(); | 96 std::unique_ptr<base::DictionaryValue> request_info( |
| 97 new base::DictionaryValue()); |
94 request_info->SetInteger("tabId", | 98 request_info->SetInteger("tabId", |
95 extensions::ExtensionTabUtil::GetTabId(tab)); | 99 extensions::ExtensionTabUtil::GetTabId(tab)); |
96 parameters->Append(request_info); | 100 parameters->Append(std::move(request_info)); |
97 parameters->AppendString(tab->GetURL().GetOrigin().spec()); | 101 parameters->AppendString(tab->GetURL().GetOrigin().spec()); |
98 } | 102 } |
99 | 103 |
100 private: | 104 private: |
101 scoped_refptr<extensions::Extension> extension_; | 105 scoped_refptr<extensions::Extension> extension_; |
102 }; | 106 }; |
103 | 107 |
104 } // namespace | 108 } // namespace |
105 | 109 |
106 IN_PROC_BROWSER_TEST_F(WebrtcEventLogApiTest, TestStartStopWebRtcEventLogging) { | 110 IN_PROC_BROWSER_TEST_F(WebrtcEventLogApiTest, TestStartStopWebRtcEventLogging) { |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 VLOG(1) << "Waiting for logfile to become available..."; | 263 VLOG(1) << "Waiting for logfile to become available..."; |
260 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(100)); | 264 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(100)); |
261 } | 265 } |
262 ASSERT_TRUE(base::PathExists(full_file_name)); | 266 ASSERT_TRUE(base::PathExists(full_file_name)); |
263 EXPECT_TRUE(base::GetFileSize(full_file_name, &file_size)); | 267 EXPECT_TRUE(base::GetFileSize(full_file_name, &file_size)); |
264 EXPECT_GT(file_size, 0); | 268 EXPECT_GT(file_size, 0); |
265 | 269 |
266 // Clean up. | 270 // Clean up. |
267 base::DeleteFile(full_file_name, false); | 271 base::DeleteFile(full_file_name, false); |
268 } | 272 } |
OLD | NEW |