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

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

Issue 143003031: Allow retrieval of media device ID salt even after ResourceContext has gone away. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add TODO about proper fix. Created 6 years, 10 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 | Annotate | Revision Log
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 "base/json/json_writer.h" 5 #include "base/json/json_writer.h"
6 #include "base/strings/string_util.h" 6 #include "base/strings/string_util.h"
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "base/threading/platform_thread.h" 10 #include "base/threading/platform_thread.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 std::string* id_in_origin) { 139 std::string* id_in_origin) {
140 if (!content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)) { 140 if (!content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)) {
141 content::BrowserThread::PostTask( 141 content::BrowserThread::PostTask(
142 content::BrowserThread::IO, FROM_HERE, 142 content::BrowserThread::IO, FROM_HERE,
143 base::Bind(&WebrtcAudioPrivateTest::GetIDInOrigin, 143 base::Bind(&WebrtcAudioPrivateTest::GetIDInOrigin,
144 this, resource_context, origin, raw_device_id, 144 this, resource_context, origin, raw_device_id,
145 id_in_origin)); 145 id_in_origin));
146 enumeration_event_.Wait(); 146 enumeration_event_.Wait();
147 } else { 147 } else {
148 *id_in_origin = content::GetHMACForMediaDeviceID( 148 *id_in_origin = content::GetHMACForMediaDeviceID(
149 resource_context, 149 resource_context->GetMediaDeviceIDSalt(),
150 origin, 150 origin,
151 raw_device_id); 151 raw_device_id);
152 enumeration_event_.Signal(); 152 enumeration_event_.Signal();
153 } 153 }
154 } 154 }
155 155
156 // Event used to signal completion of enumeration. 156 // Event used to signal completion of enumeration.
157 base::WaitableEvent enumeration_event_; 157 base::WaitableEvent enumeration_event_;
158 158
159 GURL source_url_; 159 GURL source_url_;
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 ASSERT_TRUE(content::ExecuteScript(tab, "browsertestRunAllTests();")); 403 ASSERT_TRUE(content::ExecuteScript(tab, "browsertestRunAllTests();"));
404 404
405 content::TitleWatcher title_watcher(tab, base::ASCIIToUTF16("success")); 405 content::TitleWatcher title_watcher(tab, base::ASCIIToUTF16("success"));
406 title_watcher.AlsoWaitForTitle(base::ASCIIToUTF16("failure")); 406 title_watcher.AlsoWaitForTitle(base::ASCIIToUTF16("failure"));
407 base::string16 result = title_watcher.WaitAndGetTitle(); 407 base::string16 result = title_watcher.WaitAndGetTitle();
408 EXPECT_EQ(base::ASCIIToUTF16("success"), result); 408 EXPECT_EQ(base::ASCIIToUTF16("success"), result);
409 } 409 }
410 #endif // defined(GOOGLE_CHROME_BUILD) 410 #endif // defined(GOOGLE_CHROME_BUILD)
411 411
412 } // namespace extensions 412 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698