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

Side by Side Diff: chrome/browser/chromeos/contacts/contact_test_util.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_CONTACT_TEST_UTIL_H_
6 #define CHROME_BROWSER_CHROMEOS_CONTACTS_CONTACT_TEST_UTIL_H_
7
8 #include <string>
9
10 #include "base/memory/scoped_vector.h"
11 #include "chrome/browser/chromeos/contacts/contact.pb.h"
12 #include "ui/gfx/size.h"
13
14 namespace contacts {
15
16 typedef std::vector<const Contact*> ContactPointers;
17 class ContactMap;
18
19 namespace test {
20
21 // Returns a string containing the information stored in |contact|. The same
22 // string will be returned for functionally-equivalent contacts (e.g. ones
23 // containing the same email addresses but in a different order).
24 std::string ContactToString(const Contact& contact);
25
26 // Runs ContactToString() on each entry in |contacts| and returns the results
27 // joined by newlines (in a consistent order).
28 std::string ContactsToString(const ContactPointers& contacts);
29 std::string ContactsToString(const ScopedVector<Contact>& contacts);
30
31 // Convenience wrapper for ContactsToString(). Takes |num_contacts|
32 // const Contact* arguments.
33 std::string VarContactsToString(int num_contacts, ...);
34
35 // Like ContactsToStrings(), but takes a ContactMap as input.
36 std::string ContactMapToString(const ContactMap& contact_map);
37
38 // Saves copies of all contacts in |source| to |dest|.
39 void CopyContacts(const ContactPointers& source,
40 ScopedVector<Contact>* dest);
41 void CopyContacts(const ScopedVector<Contact>& source,
42 ScopedVector<Contact>* dest);
43
44 // Initializes |contact| with the passed-in data. The photo and all address
45 // fields are cleared. |contact_id| corresponds to Contact::contact_id,
46 // |deleted| to Contact::deleted, and a unique string should be passed to
47 // |name_suffix| to make the name-related fields be distinct from those in other
48 // contacts.
49 void InitContact(const std::string& contact_id,
50 const std::string& name_suffix,
51 bool deleted,
52 Contact* contact);
53
54 // Adds an email address to |contact|.
55 void AddEmailAddress(const std::string& address,
56 Contact_AddressType_Relation relation,
57 const std::string& label,
58 bool primary,
59 Contact* contact);
60
61 // Adds a phone number to |contact|.
62 void AddPhoneNumber(const std::string& number,
63 Contact_AddressType_Relation relation,
64 const std::string& label,
65 bool primary,
66 Contact* contact);
67
68 // Adds a postal address to |contact|.
69 void AddPostalAddress(const std::string& address,
70 Contact_AddressType_Relation relation,
71 const std::string& label,
72 bool primary,
73 Contact* contact);
74
75 // Adds an IM address to |contact|.
76 void AddInstantMessagingAddress(
77 const std::string& address,
78 Contact_InstantMessagingAddress_Protocol protocol,
79 Contact_AddressType_Relation relation,
80 const std::string& label,
81 bool primary,
82 Contact* contact);
83
84 // Initializes |contact|'s photo to a bitmap of the given size.
85 // ContactToString() includes the photo's dimensions in its output, so tests can
86 // call this method to set the photo to a given size and then check that the
87 // size matches later (e.g. after loading the contact from a server or from
88 // disk) to confirm that the photo was loaded correctly.
89 void SetPhoto(const gfx::Size& size, Contact* contact);
90
91 } // namespace test
92 } // namespace contacts
93
94 #endif // CHROME_BROWSER_CHROMEOS_CONTACTS_CONTACT_TEST_UTIL_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/contacts/contact_store_observer.h ('k') | chrome/browser/chromeos/contacts/contact_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698