OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "chrome/browser/spellchecker/spellcheck_custom_dictionary.h" | 9 #include "chrome/browser/spellchecker/spellcheck_custom_dictionary.h" |
10 #include "chrome/browser/spellchecker/spellcheck_factory.h" | 10 #include "chrome/browser/spellchecker/spellcheck_factory.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 profile_(new TestingProfile()) { | 31 profile_(new TestingProfile()) { |
32 } | 32 } |
33 | 33 |
34 virtual void SetUp() OVERRIDE { | 34 virtual void SetUp() OVERRIDE { |
35 // Use SetTestingFactoryAndUse to force creation and initialization. | 35 // Use SetTestingFactoryAndUse to force creation and initialization. |
36 SpellcheckServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 36 SpellcheckServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
37 profile_.get(), &BuildSpellcheckService); | 37 profile_.get(), &BuildSpellcheckService); |
38 } | 38 } |
39 | 39 |
40 virtual void TearDown() OVERRIDE { | 40 virtual void TearDown() OVERRIDE { |
41 MessageLoop::current()->RunUntilIdle(); | 41 base::MessageLoop::current()->RunUntilIdle(); |
42 } | 42 } |
43 | 43 |
44 MessageLoop message_loop_; | 44 base::MessageLoop message_loop_; |
45 content::TestBrowserThread ui_thread_; | 45 content::TestBrowserThread ui_thread_; |
46 content::TestBrowserThread file_thread_; | 46 content::TestBrowserThread file_thread_; |
47 | 47 |
48 scoped_ptr<TestingProfile> profile_; | 48 scoped_ptr<TestingProfile> profile_; |
49 }; | 49 }; |
50 | 50 |
51 TEST_F(SpellcheckServiceTest, GetSpellCheckLanguages1) { | 51 TEST_F(SpellcheckServiceTest, GetSpellCheckLanguages1) { |
52 std::vector<std::string> accept_languages; | 52 std::vector<std::string> accept_languages; |
53 accept_languages.push_back("en"); | 53 accept_languages.push_back("en"); |
54 accept_languages.push_back("en-US"); | 54 accept_languages.push_back("en-US"); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 accept_languages.push_back("fr"); | 115 accept_languages.push_back("fr"); |
116 accept_languages.push_back("aa"); // Will not exist. | 116 accept_languages.push_back("aa"); // Will not exist. |
117 std::vector<std::string> languages; | 117 std::vector<std::string> languages; |
118 | 118 |
119 SpellcheckService::GetSpellCheckLanguagesFromAcceptLanguages( | 119 SpellcheckService::GetSpellCheckLanguagesFromAcceptLanguages( |
120 accept_languages, "fr", &languages); | 120 accept_languages, "fr", &languages); |
121 | 121 |
122 EXPECT_EQ(1U, languages.size()); | 122 EXPECT_EQ(1U, languages.size()); |
123 EXPECT_EQ("fr", languages[0]); | 123 EXPECT_EQ("fr", languages[0]); |
124 } | 124 } |
OLD | NEW |