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/gdata/gdata_contacts_service.h" | 5 #include "chrome/browser/chromeos/gdata/gdata_contacts_service.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 // Base URL where feeds are located on the test server. | 35 // Base URL where feeds are located on the test server. |
36 const char kFeedBaseUrl[] = "files/chromeos/gdata/contacts/"; | 36 const char kFeedBaseUrl[] = "files/chromeos/gdata/contacts/"; |
37 | 37 |
38 // Filename of JSON feed containing contact groups. | 38 // Filename of JSON feed containing contact groups. |
39 const char kGroupsFeedFilename[] = "groups.json"; | 39 const char kGroupsFeedFilename[] = "groups.json"; |
40 | 40 |
41 // Width and height of /photo.png on the test server. | 41 // Width and height of /photo.png on the test server. |
42 const int kPhotoSize = 48; | 42 const int kPhotoSize = 48; |
43 | 43 |
44 // Initializes |contact| using the passed-in values. | 44 // Initializes |contact| using the passed-in values. |
45 void InitContact(const std::string& provider_id, | 45 void InitContact(const std::string& contact_id, |
46 const std::string& rfc_3339_update_time, | 46 const std::string& rfc_3339_update_time, |
47 bool deleted, | 47 bool deleted, |
48 const std::string& full_name, | 48 const std::string& full_name, |
49 const std::string& given_name, | 49 const std::string& given_name, |
50 const std::string& additional_name, | 50 const std::string& additional_name, |
51 const std::string& family_name, | 51 const std::string& family_name, |
52 const std::string& name_prefix, | 52 const std::string& name_prefix, |
53 const std::string& name_suffix, | 53 const std::string& name_suffix, |
54 contacts::Contact* contact) { | 54 contacts::Contact* contact) { |
55 DCHECK(contact); | 55 DCHECK(contact); |
56 contact->set_provider_id(provider_id); | 56 contact->set_contact_id(contact_id); |
57 base::Time update_time; | 57 base::Time update_time; |
58 CHECK(util::GetTimeFromString(rfc_3339_update_time, &update_time)) | 58 CHECK(util::GetTimeFromString(rfc_3339_update_time, &update_time)) |
59 << "Unable to parse time \"" << rfc_3339_update_time << "\""; | 59 << "Unable to parse time \"" << rfc_3339_update_time << "\""; |
60 contact->set_update_time(update_time.ToInternalValue()); | 60 contact->set_update_time(update_time.ToInternalValue()); |
61 contact->set_deleted(deleted); | 61 contact->set_deleted(deleted); |
62 contact->set_full_name(full_name); | 62 contact->set_full_name(full_name); |
63 contact->set_given_name(given_name); | 63 contact->set_given_name(given_name); |
64 contact->set_additional_name(additional_name); | 64 contact->set_additional_name(additional_name); |
65 contact->set_family_name(family_name); | 65 contact->set_family_name(family_name); |
66 contact->set_name_prefix(name_prefix); | 66 contact->set_name_prefix(name_prefix); |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 "2012-06-04T15:53:36.023Z", | 286 "2012-06-04T15:53:36.023Z", |
287 false, "", "", "", "", "", "", contact); | 287 false, "", "", "", "", "", "", contact); |
288 contacts::test::SetPhoto(gfx::Size(kPhotoSize, kPhotoSize), contact); | 288 contacts::test::SetPhoto(gfx::Size(kPhotoSize, kPhotoSize), contact); |
289 expected_contacts.push_back(contact); | 289 expected_contacts.push_back(contact); |
290 } | 290 } |
291 EXPECT_EQ(contacts::test::ContactsToString(expected_contacts), | 291 EXPECT_EQ(contacts::test::ContactsToString(expected_contacts), |
292 contacts::test::ContactsToString(*contacts)); | 292 contacts::test::ContactsToString(*contacts)); |
293 } | 293 } |
294 | 294 |
295 } // namespace gdata | 295 } // namespace gdata |
OLD | NEW |