| 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 19 matching lines...) Expand all Loading... |
| 30 profile_(new TestingProfile()) { | 30 profile_(new TestingProfile()) { |
| 31 } | 31 } |
| 32 | 32 |
| 33 virtual void SetUp() OVERRIDE { | 33 virtual void SetUp() OVERRIDE { |
| 34 // Use SetTestingFactoryAndUse to force creation and initialization. | 34 // Use SetTestingFactoryAndUse to force creation and initialization. |
| 35 SpellcheckServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 35 SpellcheckServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
| 36 profile_.get(), &BuildSpellcheckService); | 36 profile_.get(), &BuildSpellcheckService); |
| 37 } | 37 } |
| 38 | 38 |
| 39 virtual void TearDown() OVERRIDE { | 39 virtual void TearDown() OVERRIDE { |
| 40 MessageLoop::current()->RunUntilIdle(); | 40 base::MessageLoop::current()->RunUntilIdle(); |
| 41 } | 41 } |
| 42 | 42 |
| 43 MessageLoop message_loop_; | 43 base::MessageLoop message_loop_; |
| 44 content::TestBrowserThread ui_thread_; | 44 content::TestBrowserThread ui_thread_; |
| 45 content::TestBrowserThread file_thread_; | 45 content::TestBrowserThread file_thread_; |
| 46 | 46 |
| 47 scoped_ptr<TestingProfile> profile_; | 47 scoped_ptr<TestingProfile> profile_; |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 TEST_F(SpellcheckServiceTest, GetSpellCheckLanguages1) { | 50 TEST_F(SpellcheckServiceTest, GetSpellCheckLanguages1) { |
| 51 std::vector<std::string> accept_languages; | 51 std::vector<std::string> accept_languages; |
| 52 accept_languages.push_back("en"); | 52 accept_languages.push_back("en"); |
| 53 accept_languages.push_back("en-US"); | 53 accept_languages.push_back("en-US"); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 accept_languages.push_back("fr"); | 114 accept_languages.push_back("fr"); |
| 115 accept_languages.push_back("aa"); // Will not exist. | 115 accept_languages.push_back("aa"); // Will not exist. |
| 116 std::vector<std::string> languages; | 116 std::vector<std::string> languages; |
| 117 | 117 |
| 118 SpellcheckService::GetSpellCheckLanguagesFromAcceptLanguages( | 118 SpellcheckService::GetSpellCheckLanguagesFromAcceptLanguages( |
| 119 accept_languages, "fr", &languages); | 119 accept_languages, "fr", &languages); |
| 120 | 120 |
| 121 EXPECT_EQ(1U, languages.size()); | 121 EXPECT_EQ(1U, languages.size()); |
| 122 EXPECT_EQ("fr", languages[0]); | 122 EXPECT_EQ("fr", languages[0]); |
| 123 } | 123 } |
| OLD | NEW |