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

Side by Side 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, 4 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/contacts/fake_contact_database.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_CHROMEOS_CONTACTS_FAKE_CONTACT_DATABASE_H_
6 #define CHROME_BROWSER_CHROMEOS_CONTACTS_FAKE_CONTACT_DATABASE_H_
7
8 #include "chrome/browser/chromeos/contacts/contact_database.h"
9
10 #include "chrome/browser/chromeos/contacts/contact.pb.h"
11
12 namespace contacts {
13
14 // Fake implementation used for testing.
15 class FakeContactDatabase : public ContactDatabaseInterface {
16 public:
17 FakeContactDatabase();
18
19 const ScopedVector<Contact>& contacts() const { return contacts_; }
20
21 void set_init_success(bool success) { init_success_ = success; }
22 void set_save_success(bool success) { save_success_ = success; }
23 void set_load_success(bool success) { load_success_ = success; }
24
25 // Copies |contacts| into |contacts_| and |metadata| into |metadata_|. These
26 // values will be returned by subsequent calls to LoadContacts().
27 void SetContacts(const ContactPointers& contacts,
28 const UpdateMetadata& metadata);
29
30 // ContactDatabaseInterface implementation.
31 virtual void DestroyOnUIThread() OVERRIDE;
32 virtual void Init(const FilePath& database_dir,
33 InitCallback callback) OVERRIDE;
34 virtual void SaveContacts(scoped_ptr<ContactPointers> contacts,
35 scoped_ptr<UpdateMetadata> metadata,
36 bool is_full_update,
37 SaveCallback callback) OVERRIDE;
38 virtual void LoadContacts(LoadCallback callback) OVERRIDE;
39
40 protected:
41 virtual ~FakeContactDatabase();
42
43 private:
44 // Should we report success in response to various requests?
45 bool init_success_;
46 bool save_success_;
47 bool load_success_;
48
49 // Currently-stored contacts and metadata.
50 ScopedVector<Contact> contacts_;
51 UpdateMetadata metadata_;
52
53 DISALLOW_COPY_AND_ASSIGN(FakeContactDatabase);
54 };
55
56 } // namespace contacts
57
58 #endif // CHROME_BROWSER_CHROMEOS_CONTACTS_FAKE_CONTACT_DATABASE_H_
OLDNEW
« 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