| Index: chrome/browser/chromeos/contacts/fake_contact_database.cc
|
| diff --git a/chrome/browser/chromeos/contacts/fake_contact_database.cc b/chrome/browser/chromeos/contacts/fake_contact_database.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..ff5ccfeb8fd8779c69747f754d1cb45c426758f8
|
| --- /dev/null
|
| +++ b/chrome/browser/chromeos/contacts/fake_contact_database.cc
|
| @@ -0,0 +1,45 @@
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "chrome/browser/chromeos/contacts/fake_contact_database.h"
|
| +
|
| +#include "chrome/browser/chromeos/contacts/contact.h"
|
| +#include "chrome/browser/chromeos/contacts/contact_test_lib.h"
|
| +
|
| +namespace contacts {
|
| +
|
| +FakeContactDatabase::FakeContactDatabase()
|
| + : init_success_(true),
|
| + save_success_(true),
|
| + load_success_(true) {
|
| +}
|
| +
|
| +FakeContactDatabase::~FakeContactDatabase() {
|
| +}
|
| +
|
| +void FakeContactDatabase::Init(const FilePath& database_path,
|
| + InitCallback callback) {
|
| + callback.Run(init_success_);
|
| +}
|
| +
|
| +void FakeContactDatabase::SetContacts(const ContactPointers& contacts) {
|
| + test::CopyContacts(contacts, &contacts_);
|
| +}
|
| +
|
| +void FakeContactDatabase::SaveContacts(scoped_ptr<ContactPointers> contacts,
|
| + bool is_full_update,
|
| + SaveCallback callback) {
|
| + if (save_success_)
|
| + test::CopyContacts(*contacts, &contacts_);
|
| + callback.Run(save_success_);
|
| +}
|
| +
|
| +void FakeContactDatabase::LoadContacts(LoadCallback callback) {
|
| + scoped_ptr<ScopedVector<Contact> > contacts(new ScopedVector<Contact>());
|
| + if (load_success_)
|
| + test::CopyContacts(contacts_, contacts.get());
|
| + callback.Run(load_success_, contacts.Pass());
|
| +}
|
| +
|
| +} // namespace contacts
|
|
|