Index: chrome/browser/chromeos/contacts/contact_test_lib.h |
diff --git a/chrome/browser/chromeos/contacts/contact_test_lib.h b/chrome/browser/chromeos/contacts/contact_test_lib.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f1c51073cd15770b5da611e873a0c89e13f7dcc8 |
--- /dev/null |
+++ b/chrome/browser/chromeos/contacts/contact_test_lib.h |
@@ -0,0 +1,83 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#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.
|
+#define CHROME_BROWSER_CHROMEOS_CONTACTS_CONTACT_TEST_LIB_H_ |
+ |
+#include <string> |
+ |
+#include "base/memory/scoped_vector.h" |
+#include "chrome/browser/chromeos/contacts/contact.h" |
+#include "ui/gfx/size.h" |
+ |
+namespace contacts { |
+namespace test { |
+ |
+// Returns a string containing the information stored in |contact|. The same |
+// string will be returned for functionally-equivalent contacts (e.g. ones |
+// containing the same email addresses but in a different order). |
+std::string ContactToString(const Contact& contact); |
+ |
+// Runs ContactToString() on each entry in |contacts| and returns the results |
+// joined by newlines (in a consistent order). |
+std::string ContactsToString(const ContactPointers& contacts); |
+std::string ContactsToString(const ScopedVector<Contact>& contacts); |
+ |
+// Convenience wrapper for ContactsToString(). Takes |num_contacts| |
+// const Contact* arguments. |
+std::string VarContactsToString(int num_contacts, ...); |
+ |
+// Copies |source|'s data to |dest|. |
+void CopyContact(const Contact& source, Contact* dest); |
+ |
+// Saves copies of all contacts in |source| to |dest|. |
+void CopyContacts(const ContactPointers& source, |
+ ScopedVector<Contact>* dest); |
+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.
|
+ ScopedVector<Contact>* dest); |
+ |
+// Initializes |contact| with the passed-in data. The photo and all address |
+// fields are cleared. |
+void InitContact(const std::string& provider_id, |
+ const std::string& field_suffix, |
+ bool deleted, |
satorux1
2012/07/20 17:42:57
could you document the three parameters?
Daniel Erat
2012/07/23 16:55:47
Done.
|
+ Contact* contact); |
+ |
+// Adds an email address to |contact|. |
+void AddEmailAddress(const std::string& address, |
+ Contact::AddressType::Relation relation, |
+ const std::string& label, |
+ bool primary, |
+ Contact* contact); |
+ |
+// Adds a phone number to |contact|. |
+void AddPhoneNumber(const std::string& number, |
+ Contact::AddressType::Relation relation, |
+ const std::string& label, |
+ bool primary, |
+ Contact* contact); |
+ |
+// Adds a postal address to |contact|. |
+void AddPostalAddress(const std::string& address, |
+ Contact::AddressType::Relation relation, |
+ const std::string& label, |
+ bool primary, |
+ Contact* contact); |
+ |
+// Adds an IM address to |contact|. |
+void AddInstantMessagingAddress( |
+ const std::string& address, |
+ Contact::InstantMessagingAddress::Protocol protocol, |
+ Contact::AddressType::Relation relation, |
+ const std::string& label, |
+ bool primary, |
+ Contact* contact); |
+ |
+// Initializes |contact|'s photo to a bitmap of the given size. |
+void SetPhoto(const gfx::Size& size, Contact* contact); |
+ |
+} // namespace test |
+} // namespace contacts |
+ |
+#endif // CHROME_BROWSER_CHROMEOS_CONTACTS_CONTACT_TEST_LIB_H_ |