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

Side by Side Diff: chrome/browser/chromeos/contacts/fake_contact_database.h

Issue 190063004: chromeos: Delete old, unused contacts code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge again 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
(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 #include "chrome/browser/chromeos/contacts/contact_map.h"
12
13 namespace contacts {
14
15 // Fake implementation used for testing.
16 class FakeContactDatabase : public ContactDatabaseInterface {
17 public:
18 FakeContactDatabase();
19
20 const ContactMap& contacts() const { return contacts_; }
21 const UpdateMetadata& metadata() const { return metadata_; }
22
23 void set_init_success(bool success) { init_success_ = success; }
24 void set_save_success(bool success) { save_success_ = success; }
25 void set_load_success(bool success) { load_success_ = success; }
26
27 int num_saved_contacts() const { return num_saved_contacts_; }
28 void reset_stats() { num_saved_contacts_ = 0; }
29
30 // Copies |contacts| into |contacts_| and |metadata| into |metadata_|. These
31 // values will be returned by subsequent calls to LoadContacts().
32 void SetContacts(const ContactPointers& contacts,
33 const UpdateMetadata& metadata);
34
35 // ContactDatabaseInterface implementation.
36 virtual void DestroyOnUIThread() OVERRIDE;
37 virtual void Init(const base::FilePath& database_dir,
38 InitCallback callback) OVERRIDE;
39 virtual void SaveContacts(scoped_ptr<ContactPointers> contacts_to_save,
40 scoped_ptr<ContactIds> contact_ids_to_delete,
41 scoped_ptr<UpdateMetadata> metadata,
42 bool is_full_update,
43 SaveCallback callback) OVERRIDE;
44 virtual void LoadContacts(LoadCallback callback) OVERRIDE;
45
46 protected:
47 virtual ~FakeContactDatabase();
48
49 private:
50 // Merges |updated_contacts| into |contacts_| and deletes contacts with IDs in
51 // |contact_ids_to_delete|.
52 void MergeContacts(const ContactPointers& updated_contacts,
53 const ContactIds& contact_ids_to_delete);
54
55 // Should we report success in response to various requests?
56 bool init_success_;
57 bool save_success_;
58 bool load_success_;
59
60 // Total number of contacts that have been passed to SaveContacts() while
61 // |save_success_| is true.
62 int num_saved_contacts_;
63
64 // Currently-stored contacts and metadata.
65 ContactMap contacts_;
66 UpdateMetadata metadata_;
67
68 DISALLOW_COPY_AND_ASSIGN(FakeContactDatabase);
69 };
70
71 } // namespace contacts
72
73 #endif // CHROME_BROWSER_CHROMEOS_CONTACTS_FAKE_CONTACT_DATABASE_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/contacts/contact_test_util.cc ('k') | chrome/browser/chromeos/contacts/fake_contact_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698