OLD | NEW |
(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_ |
| 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, |
| 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, |
| 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_ |
OLD | NEW |