| 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/message_loop.h" | 8 #include "base/message_loop/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" |
| 11 #include "chrome/browser/spellchecker/spellcheck_service.h" | 11 #include "chrome/browser/spellchecker/spellcheck_service.h" |
| 12 #include "chrome/common/spellcheck_common.h" | 12 #include "chrome/common/spellcheck_common.h" |
| 13 #include "chrome/test/base/testing_profile.h" | 13 #include "chrome/test/base/testing_profile.h" |
| 14 #include "content/public/test/test_browser_thread_bundle.h" | 14 #include "content/public/test/test_browser_thread_bundle.h" |
| 15 #include "testing/gmock/include/gmock/gmock.h" | 15 #include "testing/gmock/include/gmock/gmock.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 17 |
| 18 using chrome::spellcheck_common::WordList; | 18 using chrome::spellcheck_common::WordList; |
| 19 | 19 |
| 20 static KeyedService* BuildSpellcheckService(content::BrowserContext* profile) { | 20 static KeyedService* BuildSpellcheckService(content::BrowserContext* profile) { |
| 21 return new SpellcheckService(static_cast<Profile*>(profile)); | 21 return new SpellcheckService(static_cast<Profile*>(profile)); |
| 22 } | 22 } |
| 23 | 23 |
| 24 class SpellcheckServiceTest : public testing::Test { | 24 class SpellcheckServiceTest : public testing::Test { |
| 25 protected: | 25 protected: |
| 26 virtual void SetUp() override { | 26 void SetUp() override { |
| 27 // Use SetTestingFactoryAndUse to force creation and initialization. | 27 // Use SetTestingFactoryAndUse to force creation and initialization. |
| 28 SpellcheckServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 28 SpellcheckServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
| 29 &profile_, &BuildSpellcheckService); | 29 &profile_, &BuildSpellcheckService); |
| 30 } | 30 } |
| 31 | 31 |
| 32 private: | 32 private: |
| 33 content::TestBrowserThreadBundle thread_bundle_; | 33 content::TestBrowserThreadBundle thread_bundle_; |
| 34 TestingProfile profile_; | 34 TestingProfile profile_; |
| 35 }; | 35 }; |
| 36 | 36 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 accept_languages.push_back("fr"); | 101 accept_languages.push_back("fr"); |
| 102 accept_languages.push_back("aa"); // Will not exist. | 102 accept_languages.push_back("aa"); // Will not exist. |
| 103 std::vector<std::string> languages; | 103 std::vector<std::string> languages; |
| 104 | 104 |
| 105 SpellcheckService::GetSpellCheckLanguagesFromAcceptLanguages( | 105 SpellcheckService::GetSpellCheckLanguagesFromAcceptLanguages( |
| 106 accept_languages, "fr", &languages); | 106 accept_languages, "fr", &languages); |
| 107 | 107 |
| 108 EXPECT_EQ(1U, languages.size()); | 108 EXPECT_EQ(1U, languages.size()); |
| 109 EXPECT_EQ("fr", languages[0]); | 109 EXPECT_EQ("fr", languages[0]); |
| 110 } | 110 } |
| OLD | NEW |