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

Unified Diff: chrome/browser/ui/app_list/speech_recognizer_browsertest.cc

Issue 2473823002: Remove BrowserThread::UnsafeGetMessageLoopForThread() (Closed)
Patch Set: rebase again? Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
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:

Powered by Google App Engine
This is Rietveld 408576698