Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: chrome/browser/spellchecker/spellcheck_service_browsertest.cc

Issue 184563006: Move WriteFile and WriteFileDescriptor from file_util to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "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_factory.h"
9 #include "chrome/browser/spellchecker/spellcheck_service.h" 9 #include "chrome/browser/spellchecker/spellcheck_service.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 // Tests that we can delete a corrupted BDICT file used by hunspell. We do not 44 // Tests that we can delete a corrupted BDICT file used by hunspell. We do not
45 // run this test on Mac because Mac does not use hunspell by default. 45 // run this test on Mac because Mac does not use hunspell by default.
46 IN_PROC_BROWSER_TEST_F(SpellcheckServiceBrowserTest, DeleteCorruptedBDICT) { 46 IN_PROC_BROWSER_TEST_F(SpellcheckServiceBrowserTest, DeleteCorruptedBDICT) {
47 // Write the corrupted BDICT data to create a corrupted BDICT file. 47 // Write the corrupted BDICT data to create a corrupted BDICT file.
48 base::FilePath dict_dir; 48 base::FilePath dict_dir;
49 ASSERT_TRUE(PathService::Get(chrome::DIR_APP_DICTIONARIES, &dict_dir)); 49 ASSERT_TRUE(PathService::Get(chrome::DIR_APP_DICTIONARIES, &dict_dir));
50 base::FilePath bdict_path = 50 base::FilePath bdict_path =
51 chrome::spellcheck_common::GetVersionedFileName("en-US", dict_dir); 51 chrome::spellcheck_common::GetVersionedFileName("en-US", dict_dir);
52 52
53 size_t actual = file_util::WriteFile(bdict_path, 53 size_t actual = base::WriteFile(bdict_path,
54 reinterpret_cast<const char*>(kCorruptedBDICT), 54 reinterpret_cast<const char*>(kCorruptedBDICT),
55 arraysize(kCorruptedBDICT)); 55 arraysize(kCorruptedBDICT));
56 EXPECT_EQ(arraysize(kCorruptedBDICT), actual); 56 EXPECT_EQ(arraysize(kCorruptedBDICT), actual);
57 57
58 // Attach an event to the SpellcheckService object so we can receive its 58 // Attach an event to the SpellcheckService object so we can receive its
59 // status updates. 59 // status updates.
60 base::WaitableEvent event(true, false); 60 base::WaitableEvent event(true, false);
61 SpellcheckService::AttachStatusEvent(&event); 61 SpellcheckService::AttachStatusEvent(&event);
62 62
63 BrowserContext * context = static_cast<BrowserContext*>(GetProfile()); 63 BrowserContext * context = static_cast<BrowserContext*>(GetProfile());
(...skipping 18 matching lines...) Expand all
82 // leaking it when this test fails. 82 // leaking it when this test fails.
83 content::RunAllPendingInMessageLoop(content::BrowserThread::FILE); 83 content::RunAllPendingInMessageLoop(content::BrowserThread::FILE);
84 content::RunAllPendingInMessageLoop(content::BrowserThread::UI); 84 content::RunAllPendingInMessageLoop(content::BrowserThread::UI);
85 EXPECT_EQ(SpellcheckService::BDICT_CORRUPTED, 85 EXPECT_EQ(SpellcheckService::BDICT_CORRUPTED,
86 SpellcheckService::GetStatusEvent()); 86 SpellcheckService::GetStatusEvent());
87 if (base::PathExists(bdict_path)) { 87 if (base::PathExists(bdict_path)) {
88 ADD_FAILURE(); 88 ADD_FAILURE();
89 EXPECT_TRUE(base::DeleteFile(bdict_path, true)); 89 EXPECT_TRUE(base::DeleteFile(bdict_path, true));
90 } 90 }
91 } 91 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698