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

Side by Side Diff: chrome/browser/chromeos/contacts/contact_database_unittest.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 "chrome/browser/chromeos/contacts/contact_database.h" 5 #include "chrome/browser/chromeos/contacts/contact_database.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 } 312 }
313 313
314 // Test that we create a new database when we encounter a corrupted one. 314 // Test that we create a new database when we encounter a corrupted one.
315 TEST_F(ContactDatabaseTest, DeleteWhenCorrupt) { 315 TEST_F(ContactDatabaseTest, DeleteWhenCorrupt) {
316 DestroyDatabase(); 316 DestroyDatabase();
317 // Overwrite all of the files in the database with a space character. 317 // Overwrite all of the files in the database with a space character.
318 base::FileEnumerator enumerator( 318 base::FileEnumerator enumerator(
319 database_path(), false, base::FileEnumerator::FILES); 319 database_path(), false, base::FileEnumerator::FILES);
320 for (base::FilePath path = enumerator.Next(); !path.empty(); 320 for (base::FilePath path = enumerator.Next(); !path.empty();
321 path = enumerator.Next()) { 321 path = enumerator.Next()) {
322 file_util::WriteFile(path, " ", 1); 322 base::WriteFile(path, " ", 1);
323 } 323 }
324 CreateDatabase(); 324 CreateDatabase();
325 325
326 // Make sure that the resulting database is usable. 326 // Make sure that the resulting database is usable.
327 scoped_ptr<Contact> contact(new Contact); 327 scoped_ptr<Contact> contact(new Contact);
328 InitContact("1", "1", false, contact.get()); 328 InitContact("1", "1", false, contact.get());
329 scoped_ptr<ContactPointers> contacts_to_save(new ContactPointers); 329 scoped_ptr<ContactPointers> contacts_to_save(new ContactPointers);
330 contacts_to_save->push_back(contact.get()); 330 contacts_to_save->push_back(contact.get());
331 scoped_ptr<ContactDatabaseInterface::ContactIds> contact_ids_to_delete( 331 scoped_ptr<ContactDatabaseInterface::ContactIds> contact_ids_to_delete(
332 new ContactDatabaseInterface::ContactIds); 332 new ContactDatabaseInterface::ContactIds);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 contact_ids_to_delete.Pass(), 408 contact_ids_to_delete.Pass(),
409 metadata_to_save.Pass(), 409 metadata_to_save.Pass(),
410 false); 410 false);
411 LoadContacts(&loaded_contacts, &loaded_metadata); 411 LoadContacts(&loaded_contacts, &loaded_metadata);
412 EXPECT_EQ(VarContactsToString(1, contact3.get()), 412 EXPECT_EQ(VarContactsToString(1, contact3.get()),
413 ContactsToString(*loaded_contacts)); 413 ContactsToString(*loaded_contacts));
414 } 414 }
415 415
416 } // namespace test 416 } // namespace test
417 } // namespace contacts 417 } // namespace contacts
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/boot_times_loader.cc ('k') | chrome/browser/chromeos/drive/file_system_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698