| 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 "chrome/browser/spellchecker/spellcheck_service.h" | 5 #include "chrome/browser/spellchecker/spellcheck_service.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" |
| 9 #include "chrome/browser/spellchecker/feedback_sender.h" | 10 #include "chrome/browser/spellchecker/feedback_sender.h" |
| 10 #include "chrome/browser/spellchecker/spellcheck_factory.h" | 11 #include "chrome/browser/spellchecker/spellcheck_factory.h" |
| 11 #include "chrome/test/base/testing_profile.h" | 12 #include "chrome/test/base/testing_profile.h" |
| 12 #include "content/public/test/test_browser_thread_bundle.h" | 13 #include "content/public/test/test_browser_thread_bundle.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 15 |
| 15 static KeyedService* BuildSpellcheckService(content::BrowserContext* profile) { | 16 static scoped_ptr<KeyedService> BuildSpellcheckService( |
| 16 return new SpellcheckService(static_cast<Profile*>(profile)); | 17 content::BrowserContext* profile) { |
| 18 return make_scoped_ptr(new SpellcheckService(static_cast<Profile*>(profile))); |
| 17 } | 19 } |
| 18 | 20 |
| 19 class SpellcheckServiceTest : public testing::Test { | 21 class SpellcheckServiceTest : public testing::Test { |
| 20 protected: | 22 protected: |
| 21 void SetUp() override { | 23 void SetUp() override { |
| 22 // Use SetTestingFactoryAndUse to force creation and initialization. | 24 // Use SetTestingFactoryAndUse to force creation and initialization. |
| 23 SpellcheckServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 25 SpellcheckServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
| 24 &profile_, &BuildSpellcheckService); | 26 &profile_, &BuildSpellcheckService); |
| 25 } | 27 } |
| 26 | 28 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 accept_languages.push_back("fr"); | 98 accept_languages.push_back("fr"); |
| 97 accept_languages.push_back("aa"); // Will not exist. | 99 accept_languages.push_back("aa"); // Will not exist. |
| 98 std::vector<std::string> languages; | 100 std::vector<std::string> languages; |
| 99 | 101 |
| 100 SpellcheckService::GetSpellCheckLanguagesFromAcceptLanguages( | 102 SpellcheckService::GetSpellCheckLanguagesFromAcceptLanguages( |
| 101 accept_languages, "fr", &languages); | 103 accept_languages, "fr", &languages); |
| 102 | 104 |
| 103 EXPECT_EQ(1U, languages.size()); | 105 EXPECT_EQ(1U, languages.size()); |
| 104 EXPECT_EQ("fr", languages[0]); | 106 EXPECT_EQ("fr", languages[0]); |
| 105 } | 107 } |
| OLD | NEW |