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

Unified Diff: chrome/browser/chromeos/contacts/fake_contact_database.h

Issue 10829117: contacts: Add FakeContactDatabase. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/chromeos/contacts/fake_contact_database.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/contacts/fake_contact_database.h
diff --git a/chrome/browser/chromeos/contacts/fake_contact_database.h b/chrome/browser/chromeos/contacts/fake_contact_database.h
new file mode 100644
index 0000000000000000000000000000000000000000..bc2256c6272199b3d9ce06d9553f5c54a3bfef8c
--- /dev/null
+++ b/chrome/browser/chromeos/contacts/fake_contact_database.h
@@ -0,0 +1,58 @@
+// 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.
+
+#ifndef CHROME_BROWSER_CHROMEOS_CONTACTS_FAKE_CONTACT_DATABASE_H_
+#define CHROME_BROWSER_CHROMEOS_CONTACTS_FAKE_CONTACT_DATABASE_H_
+
+#include "chrome/browser/chromeos/contacts/contact_database.h"
+
+#include "chrome/browser/chromeos/contacts/contact.pb.h"
+
+namespace contacts {
+
+// Fake implementation used for testing.
+class FakeContactDatabase : public ContactDatabaseInterface {
+ public:
+ FakeContactDatabase();
+
+ const ScopedVector<Contact>& contacts() const { return contacts_; }
+
+ void set_init_success(bool success) { init_success_ = success; }
+ void set_save_success(bool success) { save_success_ = success; }
+ void set_load_success(bool success) { load_success_ = success; }
+
+ // Copies |contacts| into |contacts_| and |metadata| into |metadata_|. These
+ // values will be returned by subsequent calls to LoadContacts().
+ void SetContacts(const ContactPointers& contacts,
+ const UpdateMetadata& metadata);
+
+ // ContactDatabaseInterface implementation.
+ virtual void DestroyOnUIThread() OVERRIDE;
+ virtual void Init(const FilePath& database_dir,
+ InitCallback callback) OVERRIDE;
+ virtual void SaveContacts(scoped_ptr<ContactPointers> contacts,
+ scoped_ptr<UpdateMetadata> metadata,
+ bool is_full_update,
+ SaveCallback callback) OVERRIDE;
+ virtual void LoadContacts(LoadCallback callback) OVERRIDE;
+
+ protected:
+ virtual ~FakeContactDatabase();
+
+ private:
+ // Should we report success in response to various requests?
+ bool init_success_;
+ bool save_success_;
+ bool load_success_;
+
+ // Currently-stored contacts and metadata.
+ ScopedVector<Contact> contacts_;
+ UpdateMetadata metadata_;
+
+ DISALLOW_COPY_AND_ASSIGN(FakeContactDatabase);
+};
+
+} // namespace contacts
+
+#endif // CHROME_BROWSER_CHROMEOS_CONTACTS_FAKE_CONTACT_DATABASE_H_
« no previous file with comments | « no previous file | chrome/browser/chromeos/contacts/fake_contact_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698