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

Unified Diff: chrome/browser/spellchecker/spellcheck_message_filter_platform_mac_browsertest.cc

Issue 2354333002: Remove calls to MessageLoop(ForUI|ForIO)::Run/RunUntilIdle. (Closed)
Patch Set: fix build error 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/spellchecker/spellcheck_message_filter_platform_mac_browsertest.cc
diff --git a/chrome/browser/spellchecker/spellcheck_message_filter_platform_mac_browsertest.cc b/chrome/browser/spellchecker/spellcheck_message_filter_platform_mac_browsertest.cc
index 4fea85865c2f4fb3fe4db131e91bd880eb3fb75d..eeff5e0b2e590eeac17ce53ea79e97b705584f89 100644
--- a/chrome/browser/spellchecker/spellcheck_message_filter_platform_mac_browsertest.cc
+++ b/chrome/browser/spellchecker/spellcheck_message_filter_platform_mac_browsertest.cc
@@ -8,10 +8,11 @@
#include "base/command_line.h"
#include "base/memory/scoped_vector.h"
-#include "base/message_loop/message_loop.h"
+#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
#include "base/stl_util.h"
#include "base/strings/utf_string_conversions.h"
+#include "base/threading/thread_task_runner_handle.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "components/spellcheck/common/spellcheck_messages.h"
#include "components/spellcheck/common/spellcheck_result.h"
@@ -21,19 +22,19 @@
// allows verification by the test case.
class TestingSpellCheckMessageFilter : public SpellCheckMessageFilterPlatform {
public:
- explicit TestingSpellCheckMessageFilter(base::MessageLoopForUI* loop)
- : SpellCheckMessageFilterPlatform(0),
- loop_(loop) { }
+ explicit TestingSpellCheckMessageFilter(const base::Closure& quit_closure)
+ : SpellCheckMessageFilterPlatform(0), quit_closure_(quit_closure) {}
bool Send(IPC::Message* message) override {
sent_messages_.push_back(message);
- loop_->task_runner()->PostTask(FROM_HERE,
- base::MessageLoop::QuitWhenIdleClosure());
+ main_thread_task_runner_->PostTask(FROM_HERE, quit_closure_);
return true;
}
ScopedVector<IPC::Message> sent_messages_;
- base::MessageLoopForUI* loop_;
+ const scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_ =
+ base::ThreadTaskRunnerHandle::Get();
+ const base::Closure quit_closure_;
private:
~TestingSpellCheckMessageFilter() override {}
@@ -44,14 +45,15 @@ typedef InProcessBrowserTest SpellCheckMessageFilterPlatformMacBrowserTest;
// Uses browsertest to setup chrome threads.
IN_PROC_BROWSER_TEST_F(SpellCheckMessageFilterPlatformMacBrowserTest,
SpellCheckReturnMessage) {
+ base::RunLoop run_loop;
scoped_refptr<TestingSpellCheckMessageFilter> target(
- new TestingSpellCheckMessageFilter(base::MessageLoopForUI::current()));
+ new TestingSpellCheckMessageFilter(run_loop.QuitWhenIdleClosure()));
SpellCheckHostMsg_RequestTextCheck to_be_received(
123, 456, base::UTF8ToUTF16("zz."), std::vector<SpellCheckMarker>());
target->OnMessageReceived(to_be_received);
- base::MessageLoopForUI::current()->Run();
+ run_loop.Run();
EXPECT_EQ(1U, target->sent_messages_.size());
SpellCheckMsg_RespondTextCheck::Param params;

Powered by Google App Engine
This is Rietveld 408576698