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

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

Issue 2820163002: Move MediaDeviceIDSalt from ProfileIOData to ProfileImpl. (Closed)
Patch Set: merge Created 3 years, 8 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> 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 ++ix, ++it) { 148 ++ix, ++it) {
149 base::DictionaryValue* dict = NULL; 149 base::DictionaryValue* dict = NULL;
150 sink_list->GetDictionary(ix, &dict); 150 sink_list->GetDictionary(ix, &dict);
151 std::string sink_id; 151 std::string sink_id;
152 dict->GetString("sinkId", &sink_id); 152 dict->GetString("sinkId", &sink_id);
153 153
154 std::string expected_id = 154 std::string expected_id =
155 media::AudioDeviceDescription::IsDefaultDevice(it->unique_id) 155 media::AudioDeviceDescription::IsDefaultDevice(it->unique_id)
156 ? media::AudioDeviceDescription::kDefaultDeviceId 156 ? media::AudioDeviceDescription::kDefaultDeviceId
157 : content::GetHMACForMediaDeviceID( 157 : content::GetHMACForMediaDeviceID(
158 profile()->GetResourceContext()->GetMediaDeviceIDSalt(), 158 profile()->GetMediaDeviceIDSalt(),
159 url::Origin(source_url_.GetOrigin()), it->unique_id); 159 url::Origin(source_url_.GetOrigin()), it->unique_id);
160 160
161 EXPECT_EQ(expected_id, sink_id); 161 EXPECT_EQ(expected_id, sink_id);
162 std::string sink_label; 162 std::string sink_label;
163 dict->GetString("sinkLabel", &sink_label); 163 dict->GetString("sinkLabel", &sink_label);
164 EXPECT_EQ(it->device_name, sink_label); 164 EXPECT_EQ(it->device_name, sink_label);
165 165
166 // TODO(joi): Verify the contents of these once we start actually 166 // TODO(joi): Verify the contents of these once we start actually
167 // filling them in. 167 // filling them in.
168 EXPECT_TRUE(dict->HasKey("isDefault")); 168 EXPECT_TRUE(dict->HasKey("isDefault"));
(...skipping 13 matching lines...) Expand all
182 // Try to get an associated sink for each source. 182 // Try to get an associated sink for each source.
183 for (const auto& device : devices) { 183 for (const auto& device : devices) {
184 scoped_refptr<WebrtcAudioPrivateGetAssociatedSinkFunction> function = 184 scoped_refptr<WebrtcAudioPrivateGetAssociatedSinkFunction> function =
185 new WebrtcAudioPrivateGetAssociatedSinkFunction(); 185 new WebrtcAudioPrivateGetAssociatedSinkFunction();
186 function->set_source_url(source_url_); 186 function->set_source_url(source_url_);
187 187
188 std::string raw_device_id = device.unique_id; 188 std::string raw_device_id = device.unique_id;
189 VLOG(2) << "Trying to find associated sink for device " << raw_device_id; 189 VLOG(2) << "Trying to find associated sink for device " << raw_device_id;
190 GURL origin(GURL("http://www.google.com/").GetOrigin()); 190 GURL origin(GURL("http://www.google.com/").GetOrigin());
191 std::string source_id_in_origin = content::GetHMACForMediaDeviceID( 191 std::string source_id_in_origin = content::GetHMACForMediaDeviceID(
192 profile()->GetResourceContext()->GetMediaDeviceIDSalt(), 192 profile()->GetMediaDeviceIDSalt(), url::Origin(origin), raw_device_id);
193 url::Origin(origin), raw_device_id);
194 193
195 base::ListValue parameters; 194 base::ListValue parameters;
196 parameters.AppendString(origin.spec()); 195 parameters.AppendString(origin.spec());
197 parameters.AppendString(source_id_in_origin); 196 parameters.AppendString(source_id_in_origin);
198 std::string parameter_string; 197 std::string parameter_string;
199 JSONWriter::Write(parameters, &parameter_string); 198 JSONWriter::Write(parameters, &parameter_string);
200 199
201 std::unique_ptr<base::Value> result(RunFunctionAndReturnSingleResult( 200 std::unique_ptr<base::Value> result(RunFunctionAndReturnSingleResult(
202 function.get(), parameter_string, browser())); 201 function.get(), parameter_string, browser()));
203 std::string result_string; 202 std::string result_string;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 title_watcher.AlsoWaitForTitle(base::ASCIIToUTF16("failure")); 265 title_watcher.AlsoWaitForTitle(base::ASCIIToUTF16("failure"));
267 base::string16 result = title_watcher.WaitAndGetTitle(); 266 base::string16 result = title_watcher.WaitAndGetTitle();
268 EXPECT_EQ(base::ASCIIToUTF16("success"), result); 267 EXPECT_EQ(base::ASCIIToUTF16("success"), result);
269 268
270 g_browser_process->webrtc_log_uploader()->OverrideUploadWithBufferForTesting( 269 g_browser_process->webrtc_log_uploader()->OverrideUploadWithBufferForTesting(
271 NULL); 270 NULL);
272 } 271 }
273 #endif // BUILDFLAG(ENABLE_HANGOUT_SERVICES_EXTENSION) 272 #endif // BUILDFLAG(ENABLE_HANGOUT_SERVICES_EXTENSION)
274 273
275 } // namespace extensions 274 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698