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

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

Issue 66183002: Replace MessageLoopProxy with SingleThreadTaskRunner for the rest of media/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win and audio tests Created 6 years, 11 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/message_loop/message_loop.h"
7 #include "base/strings/string_util.h" 6 #include "base/strings/string_util.h"
8 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
9 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
10 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
11 #include "base/threading/platform_thread.h" 10 #include "base/threading/platform_thread.h"
12 #include "base/time/time.h" 11 #include "base/time/time.h"
13 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
14 #include "chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_privat e_api.h" 13 #include "chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_privat e_api.h"
15 #include "chrome/browser/extensions/component_loader.h" 14 #include "chrome/browser/extensions/component_loader.h"
16 #include "chrome/browser/extensions/extension_apitest.h" 15 #include "chrome/browser/extensions/extension_apitest.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 95
97 // Synchronously (from the calling thread's point of view) runs the 96 // Synchronously (from the calling thread's point of view) runs the
98 // given enumeration function on the device thread. On return, 97 // given enumeration function on the device thread. On return,
99 // |device_names| has been filled with the device names resulting 98 // |device_names| has been filled with the device names resulting
100 // from that call. 99 // from that call.
101 void GetAudioDeviceNames( 100 void GetAudioDeviceNames(
102 void (AudioManager::*EnumerationFunc)(AudioDeviceNames*), 101 void (AudioManager::*EnumerationFunc)(AudioDeviceNames*),
103 AudioDeviceNames* device_names) { 102 AudioDeviceNames* device_names) {
104 AudioManager* audio_manager = AudioManager::Get(); 103 AudioManager* audio_manager = AudioManager::Get();
105 104
106 if (!audio_manager->GetMessageLoop()->BelongsToCurrentThread()) { 105 if (!audio_manager->GetTaskRunner()->BelongsToCurrentThread()) {
107 audio_manager->GetMessageLoop()->PostTask( 106 audio_manager->GetTaskRunner()->PostTask(
108 FROM_HERE, 107 FROM_HERE,
109 base::Bind(&WebrtcAudioPrivateTest::GetAudioDeviceNames, this, 108 base::Bind(&WebrtcAudioPrivateTest::GetAudioDeviceNames, this,
110 EnumerationFunc, device_names)); 109 EnumerationFunc, device_names));
111 enumeration_event_.Wait(); 110 enumeration_event_.Wait();
112 } else { 111 } else {
113 (audio_manager->*EnumerationFunc)(device_names); 112 (audio_manager->*EnumerationFunc)(device_names);
114 enumeration_event_.Signal(); 113 enumeration_event_.Signal();
115 } 114 }
116 } 115 }
117 116
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 ASSERT_TRUE(content::ExecuteScript(tab, "browsertestRunAllTests();")); 372 ASSERT_TRUE(content::ExecuteScript(tab, "browsertestRunAllTests();"));
374 373
375 content::TitleWatcher title_watcher(tab, base::ASCIIToUTF16("success")); 374 content::TitleWatcher title_watcher(tab, base::ASCIIToUTF16("success"));
376 title_watcher.AlsoWaitForTitle(base::ASCIIToUTF16("failure")); 375 title_watcher.AlsoWaitForTitle(base::ASCIIToUTF16("failure"));
377 base::string16 result = title_watcher.WaitAndGetTitle(); 376 base::string16 result = title_watcher.WaitAndGetTitle();
378 EXPECT_EQ(base::ASCIIToUTF16("success"), result); 377 EXPECT_EQ(base::ASCIIToUTF16("success"), result);
379 } 378 }
380 #endif // defined(GOOGLE_CHROME_BUILD) 379 #endif // defined(GOOGLE_CHROME_BUILD)
381 380
382 } // namespace extensions 381 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698