| 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 <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 parameters->AppendString(web_contents()->GetURL().GetOrigin().spec()); | 93 parameters->AppendString(web_contents()->GetURL().GetOrigin().spec()); |
| 94 } | 94 } |
| 95 | 95 |
| 96 bool RunFunction(UIThreadExtensionFunction* function, | 96 bool RunFunction(UIThreadExtensionFunction* function, |
| 97 const base::ListValue& parameters, | 97 const base::ListValue& parameters, |
| 98 bool expect_results) { | 98 bool expect_results) { |
| 99 std::unique_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult( | 99 std::unique_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult( |
| 100 function, ParamsToString(parameters), browser())); | 100 function, ParamsToString(parameters), browser())); |
| 101 if (expect_results) { | 101 if (expect_results) { |
| 102 EXPECT_TRUE(result.get()); | 102 EXPECT_TRUE(result.get()); |
| 103 return result.get() != nullptr; | 103 return result != nullptr; |
| 104 } | 104 } |
| 105 | 105 |
| 106 EXPECT_FALSE(result.get()); | 106 EXPECT_FALSE(result.get()); |
| 107 return result.get() == nullptr; | 107 return result == nullptr; |
| 108 } | 108 } |
| 109 | 109 |
| 110 template<typename Function> | 110 template<typename Function> |
| 111 bool RunFunction(const base::ListValue& parameters, bool expect_results) { | 111 bool RunFunction(const base::ListValue& parameters, bool expect_results) { |
| 112 scoped_refptr<Function> function(CreateFunction<Function>()); | 112 scoped_refptr<Function> function(CreateFunction<Function>()); |
| 113 return RunFunction(function.get(), parameters, expect_results); | 113 return RunFunction(function.get(), parameters, expect_results); |
| 114 } | 114 } |
| 115 | 115 |
| 116 template<typename Function> | 116 template<typename Function> |
| 117 bool RunNoArgsFunction(bool expect_results) { | 117 bool RunNoArgsFunction(bool expect_results) { |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 ASSERT_TRUE(StartAudioDebugRecordings(0)); | 441 ASSERT_TRUE(StartAudioDebugRecordings(0)); |
| 442 ASSERT_TRUE(StopAudioDebugRecordings()); | 442 ASSERT_TRUE(StopAudioDebugRecordings()); |
| 443 } | 443 } |
| 444 | 444 |
| 445 IN_PROC_BROWSER_TEST_F(WebrtcLoggingPrivateApiTest, | 445 IN_PROC_BROWSER_TEST_F(WebrtcLoggingPrivateApiTest, |
| 446 TestStartTimedAudioDebugRecordings) { | 446 TestStartTimedAudioDebugRecordings) { |
| 447 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 447 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 448 switches::kEnableAudioDebugRecordingsFromExtension); | 448 switches::kEnableAudioDebugRecordingsFromExtension); |
| 449 ASSERT_TRUE(StartAudioDebugRecordings(1)); | 449 ASSERT_TRUE(StartAudioDebugRecordings(1)); |
| 450 } | 450 } |
| OLD | NEW |