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 <stddef.h> |
| 6 #include <stdint.h> |
| 7 |
5 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/macros.h" |
6 #include "base/path_service.h" | 10 #include "base/path_service.h" |
7 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
8 #include "base/synchronization/waitable_event.h" | 12 #include "base/synchronization/waitable_event.h" |
9 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/spellchecker/spellcheck_factory.h" | 14 #include "chrome/browser/spellchecker/spellcheck_factory.h" |
11 #include "chrome/browser/spellchecker/spellcheck_service.h" | 15 #include "chrome/browser/spellchecker/spellcheck_service.h" |
12 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
13 #include "chrome/common/chrome_paths.h" | 17 #include "chrome/common/chrome_paths.h" |
14 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
15 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
16 #include "chrome/common/spellcheck_common.h" | 20 #include "chrome/common/spellcheck_common.h" |
17 #include "chrome/test/base/in_process_browser_test.h" | 21 #include "chrome/test/base/in_process_browser_test.h" |
18 #include "components/user_prefs/user_prefs.h" | 22 #include "components/user_prefs/user_prefs.h" |
19 #include "content/public/test/test_utils.h" | 23 #include "content/public/test/test_utils.h" |
20 #include "url/gurl.h" | 24 #include "url/gurl.h" |
21 | 25 |
22 using content::BrowserContext; | 26 using content::BrowserContext; |
23 | 27 |
24 namespace { | 28 namespace { |
25 | 29 |
26 // A corrupted BDICT data used in DeleteCorruptedBDICT. Please do not use this | 30 // A corrupted BDICT data used in DeleteCorruptedBDICT. Please do not use this |
27 // BDICT data for other tests. | 31 // BDICT data for other tests. |
28 const uint8 kCorruptedBDICT[] = { | 32 const uint8_t kCorruptedBDICT[] = { |
29 0x42, 0x44, 0x69, 0x63, 0x02, 0x00, 0x01, 0x00, | 33 0x42, 0x44, 0x69, 0x63, 0x02, 0x00, 0x01, 0x00, 0x20, 0x00, 0x00, 0x00, |
30 0x20, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, | 34 0x3b, 0x00, 0x00, 0x00, 0x65, 0x72, 0xe0, 0xac, 0x27, 0xc7, 0xda, 0x66, |
31 0x65, 0x72, 0xe0, 0xac, 0x27, 0xc7, 0xda, 0x66, | 35 0x6d, 0x1e, 0xa6, 0x35, 0xd1, 0xf6, 0xb7, 0x35, 0x32, 0x00, 0x00, 0x00, |
32 0x6d, 0x1e, 0xa6, 0x35, 0xd1, 0xf6, 0xb7, 0x35, | 36 0x38, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x00, 0x00, |
33 0x32, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, | 37 0x0a, 0x0a, 0x41, 0x46, 0x20, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe6, |
34 0x39, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x00, 0x00, | 38 0x49, 0x00, 0x68, 0x02, 0x73, 0x06, 0x74, 0x0b, 0x77, 0x11, 0x79, 0x15, |
35 0x0a, 0x0a, 0x41, 0x46, 0x20, 0x30, 0x00, 0x00, | |
36 0x00, 0x00, 0x00, 0xe6, 0x49, 0x00, 0x68, 0x02, | |
37 0x73, 0x06, 0x74, 0x0b, 0x77, 0x11, 0x79, 0x15, | |
38 }; | 39 }; |
39 | 40 |
40 } // namespace | 41 } // namespace |
41 | 42 |
42 class SpellcheckServiceBrowserTest : public InProcessBrowserTest { | 43 class SpellcheckServiceBrowserTest : public InProcessBrowserTest { |
43 public: | 44 public: |
44 BrowserContext* GetContext() { | 45 BrowserContext* GetContext() { |
45 return static_cast<BrowserContext*>(browser()->profile()); | 46 return static_cast<BrowserContext*>(browser()->profile()); |
46 } | 47 } |
47 }; | 48 }; |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 | 217 |
217 // Should not migrate any preferences. | 218 // Should not migrate any preferences. |
218 SpellcheckServiceFactory::GetForContext(GetContext()); | 219 SpellcheckServiceFactory::GetForContext(GetContext()); |
219 | 220 |
220 EXPECT_EQ(1U, prefs->GetList(prefs::kSpellCheckDictionaries)->GetSize()); | 221 EXPECT_EQ(1U, prefs->GetList(prefs::kSpellCheckDictionaries)->GetSize()); |
221 std::string pref; | 222 std::string pref; |
222 ASSERT_TRUE( | 223 ASSERT_TRUE( |
223 prefs->GetList(prefs::kSpellCheckDictionaries)->GetString(0, &pref)); | 224 prefs->GetList(prefs::kSpellCheckDictionaries)->GetString(0, &pref)); |
224 EXPECT_EQ("en-US", pref); | 225 EXPECT_EQ("en-US", pref); |
225 } | 226 } |
OLD | NEW |