OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/chromeos/contacts/contact_test_util.h" | 5 #include "chrome/browser/chromeos/contacts/contact_test_util.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 base::IntToString(im.protocol()) + "," + | 64 base::IntToString(im.protocol()) + "," + |
65 base::IntToString(im.type().relation()) + "," + | 65 base::IntToString(im.type().relation()) + "," + |
66 im.type().label() + "," + | 66 im.type().label() + "," + |
67 base::IntToString(im.primary()); | 67 base::IntToString(im.primary()); |
68 } | 68 } |
69 | 69 |
70 } // namespace | 70 } // namespace |
71 | 71 |
72 std::string ContactToString(const Contact& contact) { | 72 std::string ContactToString(const Contact& contact) { |
73 std::string result = | 73 std::string result = |
74 contact.provider_id() + "," + | 74 contact.contact_id() + "," + |
75 base::Int64ToString(contact.update_time()) + "," + | 75 base::Int64ToString(contact.update_time()) + "," + |
76 base::IntToString(contact.deleted()) + "," + | 76 base::IntToString(contact.deleted()) + "," + |
77 contact.full_name() + "," + | 77 contact.full_name() + "," + |
78 contact.given_name() + "," + | 78 contact.given_name() + "," + |
79 contact.additional_name() + "," + | 79 contact.additional_name() + "," + |
80 contact.family_name() + "," + | 80 contact.family_name() + "," + |
81 contact.name_prefix() + "," + | 81 contact.name_prefix() + "," + |
82 contact.name_suffix(); | 82 contact.name_suffix(); |
83 | 83 |
84 SkBitmap bitmap; | 84 SkBitmap bitmap; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 } | 143 } |
144 | 144 |
145 void CopyContacts(const ScopedVector<Contact>& source, | 145 void CopyContacts(const ScopedVector<Contact>& source, |
146 ScopedVector<Contact>* dest) { | 146 ScopedVector<Contact>* dest) { |
147 ContactPointers pointers; | 147 ContactPointers pointers; |
148 for (size_t i = 0; i < source.size(); ++i) | 148 for (size_t i = 0; i < source.size(); ++i) |
149 pointers.push_back(source[i]); | 149 pointers.push_back(source[i]); |
150 CopyContacts(pointers, dest); | 150 CopyContacts(pointers, dest); |
151 } | 151 } |
152 | 152 |
153 void InitContact(const std::string& provider_id, | 153 void InitContact(const std::string& contact_id, |
154 const std::string& name_suffix, | 154 const std::string& name_suffix, |
155 bool deleted, | 155 bool deleted, |
156 Contact* contact) { | 156 Contact* contact) { |
157 DCHECK(contact); | 157 DCHECK(contact); |
158 contact->Clear(); | 158 contact->Clear(); |
159 contact->set_provider_id(provider_id); | 159 contact->set_contact_id(contact_id); |
160 contact->set_update_time(base::Time::Now().ToInternalValue()); | 160 contact->set_update_time(base::Time::Now().ToInternalValue()); |
161 contact->set_deleted(deleted); | 161 contact->set_deleted(deleted); |
162 contact->set_full_name("full_name_" + name_suffix); | 162 contact->set_full_name("full_name_" + name_suffix); |
163 contact->set_given_name("given_name_" + name_suffix); | 163 contact->set_given_name("given_name_" + name_suffix); |
164 contact->set_additional_name("additional_name_" + name_suffix); | 164 contact->set_additional_name("additional_name_" + name_suffix); |
165 contact->set_family_name("family_name_" + name_suffix); | 165 contact->set_family_name("family_name_" + name_suffix); |
166 contact->set_name_prefix("name_prefix_" + name_suffix); | 166 contact->set_name_prefix("name_prefix_" + name_suffix); |
167 contact->set_name_suffix("name_suffix_" + name_suffix); | 167 contact->set_name_suffix("name_suffix_" + name_suffix); |
168 } | 168 } |
169 | 169 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 SkCanvas canvas(bitmap); | 236 SkCanvas canvas(bitmap); |
237 canvas.clear(SK_ColorBLACK); | 237 canvas.clear(SK_ColorBLACK); |
238 | 238 |
239 std::vector<unsigned char> png_photo; | 239 std::vector<unsigned char> png_photo; |
240 CHECK(gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, &png_photo)); | 240 CHECK(gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, &png_photo)); |
241 contact->set_raw_untrusted_photo(&png_photo[0], png_photo.size()); | 241 contact->set_raw_untrusted_photo(&png_photo[0], png_photo.size()); |
242 } | 242 } |
243 | 243 |
244 } // namespace test | 244 } // namespace test |
245 } // namespace contacts | 245 } // namespace contacts |
OLD | NEW |