| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/path_service.h" | 5 #include "base/path_service.h" |
| 6 #include "base/synchronization/waitable_event.h" | 6 #include "base/synchronization/waitable_event.h" |
| 7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
| 8 #include "chrome/browser/spellchecker/spellcheck_factory.h" |
| 8 #include "chrome/browser/spellchecker/spellcheck_host.h" | 9 #include "chrome/browser/spellchecker/spellcheck_host.h" |
| 9 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/common/chrome_paths.h" | 11 #include "chrome/common/chrome_paths.h" |
| 11 #include "chrome/common/spellcheck_common.h" | 12 #include "chrome/common/spellcheck_common.h" |
| 12 #include "chrome/test/base/in_process_browser_test.h" | 13 #include "chrome/test/base/in_process_browser_test.h" |
| 13 #include "chrome/test/base/ui_test_utils.h" | 14 #include "chrome/test/base/ui_test_utils.h" |
| 14 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
| 15 | 16 |
| 16 namespace { | 17 namespace { |
| 17 | 18 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 48 arraysize(kCorruptedBDICT)); | 49 arraysize(kCorruptedBDICT)); |
| 49 EXPECT_EQ(arraysize(kCorruptedBDICT), actual); | 50 EXPECT_EQ(arraysize(kCorruptedBDICT), actual); |
| 50 | 51 |
| 51 // Attach an event to the SpellCheckHost object so we can receive its status | 52 // Attach an event to the SpellCheckHost object so we can receive its status |
| 52 // updates. | 53 // updates. |
| 53 base::WaitableEvent event(true, false); | 54 base::WaitableEvent event(true, false); |
| 54 SpellCheckHost::AttachStatusEvent(&event); | 55 SpellCheckHost::AttachStatusEvent(&event); |
| 55 | 56 |
| 56 // Initialize the SpellCheckHost object with the corrupted BDICT file created | 57 // Initialize the SpellCheckHost object with the corrupted BDICT file created |
| 57 // above. The SpellCheckHost object will send a BDICT_CORRUPTED event. | 58 // above. The SpellCheckHost object will send a BDICT_CORRUPTED event. |
| 58 browser()->profile()->ReinitializeSpellCheckHost(false); | 59 SpellCheckFactory::ReinitializeSpellCheckHost(browser()->profile(), false); |
| 59 | 60 |
| 60 // Check the received event. Also we check if Chrome has successfully deleted | 61 // Check the received event. Also we check if Chrome has successfully deleted |
| 61 // the corrupted dictionary. We delete the corrupted dictionary to avoid | 62 // the corrupted dictionary. We delete the corrupted dictionary to avoid |
| 62 // leaking it when this test fails. | 63 // leaking it when this test fails. |
| 63 int type = SpellCheckHost::WaitStatusEvent(); | 64 int type = SpellCheckHost::WaitStatusEvent(); |
| 64 EXPECT_EQ(SpellCheckHost::BDICT_CORRUPTED, type); | 65 EXPECT_EQ(SpellCheckHost::BDICT_CORRUPTED, type); |
| 65 if (file_util::PathExists(bdict_path)) { | 66 if (file_util::PathExists(bdict_path)) { |
| 66 ADD_FAILURE(); | 67 ADD_FAILURE(); |
| 67 EXPECT_TRUE(file_util::Delete(bdict_path, true)); | 68 EXPECT_TRUE(file_util::Delete(bdict_path, true)); |
| 68 } | 69 } |
| 69 } | 70 } |
| OLD | NEW |