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

Side by Side Diff: chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_browsertest.cc

Issue 2058233002: Rewrite simple uses of base::ListValue::Append() taking a raw pointer var. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: less comments more ownership Created 4 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <memory>
8 #include <utility>
9
7 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
8 #include "base/run_loop.h" 11 #include "base/run_loop.h"
9 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
10 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
11 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
12 #include "base/synchronization/waitable_event.h" 15 #include "base/synchronization/waitable_event.h"
13 #include "base/threading/platform_thread.h" 16 #include "base/threading/platform_thread.h"
14 #include "base/time/time.h" 17 #include "base/time/time.h"
15 #include "base/win/windows_version.h" 18 #include "base/win/windows_version.h"
16 #include "build/build_config.h" 19 #include "build/build_config.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 base::WaitableEvent::InitialState::NOT_SIGNALED) {} 86 base::WaitableEvent::InitialState::NOT_SIGNALED) {}
84 87
85 void SetUpOnMainThread() override { 88 void SetUpOnMainThread() override {
86 AudioWaitingExtensionTest::SetUpOnMainThread(); 89 AudioWaitingExtensionTest::SetUpOnMainThread();
87 // Needs to happen after chrome's schemes are added. 90 // Needs to happen after chrome's schemes are added.
88 source_url_ = GURL("chrome-extension://fakeid012345678/fakepage.html"); 91 source_url_ = GURL("chrome-extension://fakeid012345678/fakepage.html");
89 } 92 }
90 93
91 protected: 94 protected:
92 void AppendTabIdToRequestInfo(base::ListValue* params, int tab_id) { 95 void AppendTabIdToRequestInfo(base::ListValue* params, int tab_id) {
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", tab_id); 98 request_info->SetInteger("tabId", tab_id);
95 params->Append(request_info); 99 params->Append(std::move(request_info));
96 } 100 }
97 101
98 std::string InvokeGetActiveSink(int tab_id) { 102 std::string InvokeGetActiveSink(int tab_id) {
99 base::ListValue parameters; 103 base::ListValue parameters;
100 AppendTabIdToRequestInfo(&parameters, tab_id); 104 AppendTabIdToRequestInfo(&parameters, tab_id);
101 std::string parameter_string; 105 std::string parameter_string;
102 JSONWriter::Write(parameters, &parameter_string); 106 JSONWriter::Write(parameters, &parameter_string);
103 107
104 scoped_refptr<WebrtcAudioPrivateGetActiveSinkFunction> function = 108 scoped_refptr<WebrtcAudioPrivateGetActiveSinkFunction> function =
105 new WebrtcAudioPrivateGetActiveSinkFunction(); 109 new WebrtcAudioPrivateGetActiveSinkFunction();
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 title_watcher.AlsoWaitForTitle(base::ASCIIToUTF16("failure")); 431 title_watcher.AlsoWaitForTitle(base::ASCIIToUTF16("failure"));
428 base::string16 result = title_watcher.WaitAndGetTitle(); 432 base::string16 result = title_watcher.WaitAndGetTitle();
429 EXPECT_EQ(base::ASCIIToUTF16("success"), result); 433 EXPECT_EQ(base::ASCIIToUTF16("success"), result);
430 434
431 g_browser_process->webrtc_log_uploader()->OverrideUploadWithBufferForTesting( 435 g_browser_process->webrtc_log_uploader()->OverrideUploadWithBufferForTesting(
432 NULL); 436 NULL);
433 } 437 }
434 #endif // defined(GOOGLE_CHROME_BUILD) || defined(ENABLE_HANGOUT_SERVICES_EXTEN SION) 438 #endif // defined(GOOGLE_CHROME_BUILD) || defined(ENABLE_HANGOUT_SERVICES_EXTEN SION)
435 439
436 } // namespace extensions 440 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698