| 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 "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/extensions/api/webrtc_audio_private/webrtc_audio_privat
e_api.h" | 12 #include "chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_privat
e_api.h" |
| 14 #include "chrome/browser/extensions/component_loader.h" | 13 #include "chrome/browser/extensions/component_loader.h" |
| 15 #include "chrome/browser/extensions/extension_apitest.h" | 14 #include "chrome/browser/extensions/extension_apitest.h" |
| 16 #include "chrome/browser/extensions/extension_function_test_utils.h" | 15 #include "chrome/browser/extensions/extension_function_test_utils.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 92 |
| 94 // Synchronously (from the calling thread's point of view) runs the | 93 // Synchronously (from the calling thread's point of view) runs the |
| 95 // given enumeration function on the device thread. On return, | 94 // given enumeration function on the device thread. On return, |
| 96 // |device_names| has been filled with the device names resulting | 95 // |device_names| has been filled with the device names resulting |
| 97 // from that call. | 96 // from that call. |
| 98 void GetAudioDeviceNames( | 97 void GetAudioDeviceNames( |
| 99 void (AudioManager::*EnumerationFunc)(AudioDeviceNames*), | 98 void (AudioManager::*EnumerationFunc)(AudioDeviceNames*), |
| 100 AudioDeviceNames* device_names) { | 99 AudioDeviceNames* device_names) { |
| 101 AudioManager* audio_manager = AudioManager::Get(); | 100 AudioManager* audio_manager = AudioManager::Get(); |
| 102 | 101 |
| 103 if (!audio_manager->GetMessageLoop()->BelongsToCurrentThread()) { | 102 if (!audio_manager->GetTaskRunner()->BelongsToCurrentThread()) { |
| 104 audio_manager->GetMessageLoop()->PostTask( | 103 audio_manager->GetTaskRunner()->PostTask( |
| 105 FROM_HERE, | 104 FROM_HERE, |
| 106 base::Bind(&WebrtcAudioPrivateTest::GetAudioDeviceNames, this, | 105 base::Bind(&WebrtcAudioPrivateTest::GetAudioDeviceNames, this, |
| 107 EnumerationFunc, device_names)); | 106 EnumerationFunc, device_names)); |
| 108 enumeration_event_.Wait(); | 107 enumeration_event_.Wait(); |
| 109 } else { | 108 } else { |
| 110 (audio_manager->*EnumerationFunc)(device_names); | 109 (audio_manager->*EnumerationFunc)(device_names); |
| 111 enumeration_event_.Signal(); | 110 enumeration_event_.Signal(); |
| 112 } | 111 } |
| 113 } | 112 } |
| 114 | 113 |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 | 332 |
| 334 ASSERT_TRUE(content::ExecuteScript(tab, "browsertestRunAllTests();")); | 333 ASSERT_TRUE(content::ExecuteScript(tab, "browsertestRunAllTests();")); |
| 335 | 334 |
| 336 content::TitleWatcher title_watcher(tab, ASCIIToUTF16("success")); | 335 content::TitleWatcher title_watcher(tab, ASCIIToUTF16("success")); |
| 337 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("failure")); | 336 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("failure")); |
| 338 string16 result = title_watcher.WaitAndGetTitle(); | 337 string16 result = title_watcher.WaitAndGetTitle(); |
| 339 EXPECT_EQ(ASCIIToUTF16("success"), result); | 338 EXPECT_EQ(ASCIIToUTF16("success"), result); |
| 340 } | 339 } |
| 341 | 340 |
| 342 } // namespace extensions | 341 } // namespace extensions |
| OLD | NEW |