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

Side by Side Diff: extensions/browser/api/audio/audio_apitest.cc

Issue 2314983002: Remove calls to deprecated MessageLoop methods in extensions. (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/run_loop.h"
9 #include "build/build_config.h" 10 #include "build/build_config.h"
10 #include "extensions/shell/test/shell_apitest.h" 11 #include "extensions/shell/test/shell_apitest.h"
11 #if defined(OS_CHROMEOS) 12 #if defined(OS_CHROMEOS)
12 #include "chromeos/audio/audio_devices_pref_handler_stub.h" 13 #include "chromeos/audio/audio_devices_pref_handler_stub.h"
13 #include "chromeos/audio/cras_audio_handler.h" 14 #include "chromeos/audio/cras_audio_handler.h"
14 #include "chromeos/dbus/dbus_thread_manager.h" 15 #include "chromeos/dbus/dbus_thread_manager.h"
15 #include "chromeos/dbus/fake_cras_audio_client.h" 16 #include "chromeos/dbus/fake_cras_audio_client.h"
16 #endif 17 #endif
17 #include "extensions/test/extension_test_message_listener.h" 18 #include "extensions/test/extension_test_message_listener.h"
18 19
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 void SetUpCrasAudioHandlerWithTestingNodes(const AudioNodeList& audio_nodes) { 100 void SetUpCrasAudioHandlerWithTestingNodes(const AudioNodeList& audio_nodes) {
100 chromeos::DBusThreadManager* dbus_manager = 101 chromeos::DBusThreadManager* dbus_manager =
101 chromeos::DBusThreadManager::Get(); 102 chromeos::DBusThreadManager::Get();
102 DCHECK(dbus_manager); 103 DCHECK(dbus_manager);
103 fake_cras_audio_client_ = static_cast<chromeos::FakeCrasAudioClient*>( 104 fake_cras_audio_client_ = static_cast<chromeos::FakeCrasAudioClient*>(
104 dbus_manager->GetCrasAudioClient()); 105 dbus_manager->GetCrasAudioClient());
105 fake_cras_audio_client_->SetAudioNodesAndNotifyObserversForTesting( 106 fake_cras_audio_client_->SetAudioNodesAndNotifyObserversForTesting(
106 audio_nodes); 107 audio_nodes);
107 cras_audio_handler_ = chromeos::CrasAudioHandler::Get(); 108 cras_audio_handler_ = chromeos::CrasAudioHandler::Get();
108 DCHECK(cras_audio_handler_); 109 DCHECK(cras_audio_handler_);
109 message_loop_.RunUntilIdle(); 110 base::RunLoop().RunUntilIdle();
110 } 111 }
111 112
112 void ChangeAudioNodes(const AudioNodeList& audio_nodes) { 113 void ChangeAudioNodes(const AudioNodeList& audio_nodes) {
113 DCHECK(fake_cras_audio_client_); 114 DCHECK(fake_cras_audio_client_);
114 fake_cras_audio_client_->SetAudioNodesAndNotifyObserversForTesting( 115 fake_cras_audio_client_->SetAudioNodesAndNotifyObserversForTesting(
115 audio_nodes); 116 audio_nodes);
116 message_loop_.RunUntilIdle(); 117 base::RunLoop().RunUntilIdle();
117 } 118 }
118 119
119 protected: 120 protected:
120 base::MessageLoopForUI message_loop_; 121 base::MessageLoopForUI message_loop_;
121 chromeos::CrasAudioHandler* cras_audio_handler_; // Not owned. 122 chromeos::CrasAudioHandler* cras_audio_handler_; // Not owned.
122 chromeos::FakeCrasAudioClient* fake_cras_audio_client_; // Not owned. 123 chromeos::FakeCrasAudioClient* fake_cras_audio_client_; // Not owned.
123 }; 124 };
124 125
125 IN_PROC_BROWSER_TEST_F(AudioApiTest, Audio) { 126 IN_PROC_BROWSER_TEST_F(AudioApiTest, Audio) {
126 // Set up the audio nodes for testing. 127 // Set up the audio nodes for testing.
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 292
292 // Verify the background app got the onNodesChanged event 293 // Verify the background app got the onNodesChanged event
293 // with the last node removed. 294 // with the last node removed.
294 ASSERT_TRUE(result_listener.WaitUntilSatisfied()); 295 ASSERT_TRUE(result_listener.WaitUntilSatisfied());
295 EXPECT_EQ("success", result_listener.message()); 296 EXPECT_EQ("success", result_listener.message());
296 } 297 }
297 298
298 #endif // OS_CHROMEOS 299 #endif // OS_CHROMEOS
299 300
300 } // namespace extensions 301 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698