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

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

Issue 10803045: contacts: Add Contact struct and test functions. (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 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_LIB_H_
satorux1 2012/07/20 17:42:57 maybe contact_test_util.h would sound slightly nic
Daniel Erat 2012/07/23 16:55:47 Done.
6 #define CHROME_BROWSER_CHROMEOS_CONTACTS_CONTACT_TEST_LIB_H_
7
8 #include <string>
9
10 #include "base/memory/scoped_vector.h"
11 #include "chrome/browser/chromeos/contacts/contact.h"
12 #include "ui/gfx/size.h"
13
14 namespace contacts {
15 namespace test {
16
17 // Returns a string containing the information stored in |contact|. The same
18 // string will be returned for functionally-equivalent contacts (e.g. ones
19 // containing the same email addresses but in a different order).
20 std::string ContactToString(const Contact& contact);
21
22 // Runs ContactToString() on each entry in |contacts| and returns the results
23 // joined by newlines (in a consistent order).
24 std::string ContactsToString(const ContactPointers& contacts);
25 std::string ContactsToString(const ScopedVector<Contact>& contacts);
26
27 // Convenience wrapper for ContactsToString(). Takes |num_contacts|
28 // const Contact* arguments.
29 std::string VarContactsToString(int num_contacts, ...);
30
31 // Copies |source|'s data to |dest|.
32 void CopyContact(const Contact& source, Contact* dest);
33
34 // Saves copies of all contacts in |source| to |dest|.
35 void CopyContacts(const ContactPointers& source,
36 ScopedVector<Contact>* dest);
37 void CopyContacts(const ScopedVector<Contact>& source,
satorux1 2012/07/20 17:42:57 give them different names? http://google-stylegui
Daniel Erat 2012/07/23 16:55:47 Are you sure that this doesn't fall under the "a c
satorux1 2012/07/23 19:39:51 Oh I see. then it's fine.
38 ScopedVector<Contact>* dest);
39
40 // Initializes |contact| with the passed-in data. The photo and all address
41 // fields are cleared.
42 void InitContact(const std::string& provider_id,
43 const std::string& field_suffix,
44 bool deleted,
satorux1 2012/07/20 17:42:57 could you document the three parameters?
Daniel Erat 2012/07/23 16:55:47 Done.
45 Contact* contact);
46
47 // Adds an email address to |contact|.
48 void AddEmailAddress(const std::string& address,
49 Contact::AddressType::Relation relation,
50 const std::string& label,
51 bool primary,
52 Contact* contact);
53
54 // Adds a phone number to |contact|.
55 void AddPhoneNumber(const std::string& number,
56 Contact::AddressType::Relation relation,
57 const std::string& label,
58 bool primary,
59 Contact* contact);
60
61 // Adds a postal address to |contact|.
62 void AddPostalAddress(const std::string& address,
63 Contact::AddressType::Relation relation,
64 const std::string& label,
65 bool primary,
66 Contact* contact);
67
68 // Adds an IM address to |contact|.
69 void AddInstantMessagingAddress(
70 const std::string& address,
71 Contact::InstantMessagingAddress::Protocol protocol,
72 Contact::AddressType::Relation relation,
73 const std::string& label,
74 bool primary,
75 Contact* contact);
76
77 // Initializes |contact|'s photo to a bitmap of the given size.
78 void SetPhoto(const gfx::Size& size, Contact* contact);
79
80 } // namespace test
81 } // namespace contacts
82
83 #endif // CHROME_BROWSER_CHROMEOS_CONTACTS_CONTACT_TEST_LIB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698