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

Side by Side Diff: chrome/browser/spellchecker/spellcheck_platform_mac_unittest.cc

Issue 1395103003: Don't use base::MessageLoop::{Quit,QuitClosure} in chrome/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/spellchecker/spellcheck_platform.h" 5 #include "chrome/browser/spellchecker/spellcheck_platform.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 14 matching lines...) Expand all
25 content::RunMessageLoop(); 25 content::RunMessageLoop();
26 } 26 }
27 27
28 std::vector<SpellCheckResult> results_; 28 std::vector<SpellCheckResult> results_;
29 spellcheck_platform::TextCheckCompleteCallback callback_; 29 spellcheck_platform::TextCheckCompleteCallback callback_;
30 bool callback_finished_; 30 bool callback_finished_;
31 31
32 private: 32 private:
33 void QuitMessageLoop() { 33 void QuitMessageLoop() {
34 CHECK(base::MessageLoop::current() == &message_loop_); 34 CHECK(base::MessageLoop::current() == &message_loop_);
35 base::MessageLoop::current()->Quit(); 35 base::MessageLoop::current()->QuitWhenIdle();
36 } 36 }
37 37
38 void CompletionCallback(const std::vector<SpellCheckResult>& results) { 38 void CompletionCallback(const std::vector<SpellCheckResult>& results) {
39 results_ = results; 39 results_ = results;
40 callback_finished_ = true; 40 callback_finished_ = true;
41 message_loop_.PostTask(FROM_HERE, base::Bind( 41 message_loop_.PostTask(FROM_HERE, base::Bind(
42 &SpellcheckPlatformMacTest::QuitMessageLoop, 42 &SpellcheckPlatformMacTest::QuitMessageLoop,
43 base::Unretained(this))); 43 base::Unretained(this)));
44 } 44 }
45 45
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 // RequestTextCheck results. 383 // RequestTextCheck results.
384 TEST_F(SpellcheckPlatformMacTest, SpellCheckIgnoresOrthography) { 384 TEST_F(SpellcheckPlatformMacTest, SpellCheckIgnoresOrthography) {
385 base::string16 test_string(base::ASCIIToUTF16("Icland is awesome.")); 385 base::string16 test_string(base::ASCIIToUTF16("Icland is awesome."));
386 spellcheck_platform::RequestTextCheck(0, test_string, callback_); 386 spellcheck_platform::RequestTextCheck(0, test_string, callback_);
387 WaitForCallback(); 387 WaitForCallback();
388 EXPECT_TRUE(callback_finished_); 388 EXPECT_TRUE(callback_finished_);
389 EXPECT_EQ(1U, results_.size()); 389 EXPECT_EQ(1U, results_.size());
390 } 390 }
391 391
392 } // namespace 392 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698