| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <tuple> | 10 #include <tuple> |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 base::FilePath bdict_path = | 268 base::FilePath bdict_path = |
| 269 chrome::spellcheck_common::GetVersionedFileName("en-US", dict_dir); | 269 chrome::spellcheck_common::GetVersionedFileName("en-US", dict_dir); |
| 270 | 270 |
| 271 size_t actual = base::WriteFile(bdict_path, | 271 size_t actual = base::WriteFile(bdict_path, |
| 272 reinterpret_cast<const char*>(kCorruptedBDICT), | 272 reinterpret_cast<const char*>(kCorruptedBDICT), |
| 273 arraysize(kCorruptedBDICT)); | 273 arraysize(kCorruptedBDICT)); |
| 274 EXPECT_EQ(arraysize(kCorruptedBDICT), actual); | 274 EXPECT_EQ(arraysize(kCorruptedBDICT), actual); |
| 275 | 275 |
| 276 // Attach an event to the SpellcheckService object so we can receive its | 276 // Attach an event to the SpellcheckService object so we can receive its |
| 277 // status updates. | 277 // status updates. |
| 278 base::WaitableEvent event(true, false); | 278 base::WaitableEvent event(base::WaitableEvent::ResetPolicy::MANUAL, |
| 279 base::WaitableEvent::InitialState::NOT_SIGNALED); |
| 279 SpellcheckService::AttachStatusEvent(&event); | 280 SpellcheckService::AttachStatusEvent(&event); |
| 280 | 281 |
| 281 BrowserContext* context = GetContext(); | 282 BrowserContext* context = GetContext(); |
| 282 | 283 |
| 283 // Ensure that the SpellcheckService object does not already exist. Otherwise | 284 // Ensure that the SpellcheckService object does not already exist. Otherwise |
| 284 // the next line will not force creation of the SpellcheckService and the | 285 // the next line will not force creation of the SpellcheckService and the |
| 285 // test will fail. | 286 // test will fail. |
| 286 SpellcheckService* service = static_cast<SpellcheckService*>( | 287 SpellcheckService* service = static_cast<SpellcheckService*>( |
| 287 SpellcheckServiceFactory::GetInstance()->GetServiceForBrowserContext( | 288 SpellcheckServiceFactory::GetInstance()->GetServiceForBrowserContext( |
| 288 context, | 289 context, |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 EXPECT_TRUE(GetPrefs()->GetBoolean(prefs::kEnableContinuousSpellcheck)); | 376 EXPECT_TRUE(GetPrefs()->GetBoolean(prefs::kEnableContinuousSpellcheck)); |
| 376 EXPECT_EQ(2U, GetPrefs()->GetList(prefs::kSpellCheckDictionaries)->GetSize()); | 377 EXPECT_EQ(2U, GetPrefs()->GetList(prefs::kSpellCheckDictionaries)->GetSize()); |
| 377 std::string pref; | 378 std::string pref; |
| 378 ASSERT_TRUE( | 379 ASSERT_TRUE( |
| 379 GetPrefs()->GetList(prefs::kSpellCheckDictionaries)->GetString(0, &pref)); | 380 GetPrefs()->GetList(prefs::kSpellCheckDictionaries)->GetString(0, &pref)); |
| 380 EXPECT_EQ("en-US", pref); | 381 EXPECT_EQ("en-US", pref); |
| 381 ASSERT_TRUE( | 382 ASSERT_TRUE( |
| 382 GetPrefs()->GetList(prefs::kSpellCheckDictionaries)->GetString(1, &pref)); | 383 GetPrefs()->GetList(prefs::kSpellCheckDictionaries)->GetString(1, &pref)); |
| 383 EXPECT_EQ("fr", pref); | 384 EXPECT_EQ("fr", pref); |
| 384 } | 385 } |
| OLD | NEW |