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

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

Issue 2083363002: Remove calls to deprecated MessageLoop methods in chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/single_thread_task_runner.h"
12 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
13 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
14 #include "chrome/common/spellcheck_result.h" 15 #include "chrome/common/spellcheck_result.h"
15 #include "content/public/test/test_utils.h" 16 #include "content/public/test/test_utils.h"
16 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
17 18
18 namespace { 19 namespace {
19 20
20 class SpellcheckPlatformMacTest: public testing::Test { 21 class SpellcheckPlatformMacTest: public testing::Test {
21 public: 22 public:
(...skipping 12 matching lines...) Expand all
34 35
35 private: 36 private:
36 void QuitMessageLoop() { 37 void QuitMessageLoop() {
37 CHECK(base::MessageLoop::current() == &message_loop_); 38 CHECK(base::MessageLoop::current() == &message_loop_);
38 base::MessageLoop::current()->QuitWhenIdle(); 39 base::MessageLoop::current()->QuitWhenIdle();
39 } 40 }
40 41
41 void CompletionCallback(const std::vector<SpellCheckResult>& results) { 42 void CompletionCallback(const std::vector<SpellCheckResult>& results) {
42 results_ = results; 43 results_ = results;
43 callback_finished_ = true; 44 callback_finished_ = true;
44 message_loop_.PostTask(FROM_HERE, base::Bind( 45 message_loop_.task_runner()->PostTask(
45 &SpellcheckPlatformMacTest::QuitMessageLoop, 46 FROM_HERE, base::Bind(&SpellcheckPlatformMacTest::QuitMessageLoop,
46 base::Unretained(this))); 47 base::Unretained(this)));
47 } 48 }
48 49
49 base::MessageLoopForUI message_loop_; 50 base::MessageLoopForUI message_loop_;
50 spellcheck_platform::ScopedEnglishLanguageForTest scoped_language_; 51 spellcheck_platform::ScopedEnglishLanguageForTest scoped_language_;
51 }; 52 };
52 53
53 // Tests that words are properly ignored. Currently only enabled on OS X as it 54 // Tests that words are properly ignored. Currently only enabled on OS X as it
54 // is the only platform to support ignoring words. Note that in this test, we 55 // is the only platform to support ignoring words. Note that in this test, we
55 // supply a non-zero doc_tag, in order to test that ignored words are matched to 56 // supply a non-zero doc_tag, in order to test that ignored words are matched to
56 // the correct document. 57 // the correct document.
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 // RequestTextCheck results. 387 // RequestTextCheck results.
387 TEST_F(SpellcheckPlatformMacTest, SpellCheckIgnoresOrthography) { 388 TEST_F(SpellcheckPlatformMacTest, SpellCheckIgnoresOrthography) {
388 base::string16 test_string(base::ASCIIToUTF16("Icland is awesome.")); 389 base::string16 test_string(base::ASCIIToUTF16("Icland is awesome."));
389 spellcheck_platform::RequestTextCheck(0, test_string, callback_); 390 spellcheck_platform::RequestTextCheck(0, test_string, callback_);
390 WaitForCallback(); 391 WaitForCallback();
391 EXPECT_TRUE(callback_finished_); 392 EXPECT_TRUE(callback_finished_);
392 EXPECT_EQ(1U, results_.size()); 393 EXPECT_EQ(1U, results_.size());
393 } 394 }
394 395
395 } // namespace 396 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698