Index: chrome/browser/ui/app_list/speech_recognizer_browsertest.cc |
diff --git a/chrome/browser/ui/app_list/speech_recognizer_browsertest.cc b/chrome/browser/ui/app_list/speech_recognizer_browsertest.cc |
index 079b002618944d8ed87a188df4ba00da2507cb3b..8429e95ebe26e88c400ff592feb4cc4abb0d1cd8 100644 |
--- a/chrome/browser/ui/app_list/speech_recognizer_browsertest.cc |
+++ b/chrome/browser/ui/app_list/speech_recognizer_browsertest.cc |
@@ -11,7 +11,6 @@ |
#include "base/memory/weak_ptr.h" |
#include "base/run_loop.h" |
#include "base/strings/utf_string_conversions.h" |
-#include "base/threading/platform_thread.h" |
#include "chrome/browser/ui/app_list/speech_recognizer_delegate.h" |
#include "chrome/browser/ui/browser.h" |
#include "chrome/common/chrome_switches.h" |
@@ -19,6 +18,7 @@ |
#include "chrome/test/base/testing_profile.h" |
#include "content/public/browser/browser_thread.h" |
#include "content/public/test/fake_speech_recognition_manager.h" |
+#include "content/public/test/test_utils.h" |
#include "testing/gmock/include/gmock/gmock.h" |
#include "testing/gtest/include/gtest/gtest.h" |
@@ -60,16 +60,7 @@ class AppListSpeechRecognizerBrowserTest : public InProcessBrowserTest { |
} |
void TearDownOnMainThread() override { |
- // Poor-person's way of ensuring IO loop is idle. |
- auto* io_loop = content::BrowserThread::UnsafeGetMessageLoopForThread( |
- content::BrowserThread::IO); |
- ASSERT_TRUE(io_loop); |
- while (!io_loop->IsIdleForTesting()) { |
- // Sleep for a little bit, allowing the IO thread to obtain any locks |
- // taken by IsIdleForTesting(). Without this sleep, this loop may livelock |
- // the message loop causing the test to fail. |
- base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(10)); |
- } |
+ content::RunAllPendingInMessageLoop(content::BrowserThread::IO); |
} |
protected: |