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

Unified Diff: chrome/browser/chromeos/gdata/gdata_contacts_service_browsertest.cc

Issue 10829435: contacts: Strip Unicode byte order marks from strings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/gdata/gdata_contacts_service_browsertest.cc
diff --git a/chrome/browser/chromeos/gdata/gdata_contacts_service_browsertest.cc b/chrome/browser/chromeos/gdata/gdata_contacts_service_browsertest.cc
index 54c7f48677c2a9eb3afbcfc90a459ac4d5425d3b..88991c57fa3c186727e51f7b0472cc7e5429c826 100644
--- a/chrome/browser/chromeos/gdata/gdata_contacts_service_browsertest.cc
+++ b/chrome/browser/chromeos/gdata/gdata_contacts_service_browsertest.cc
@@ -169,22 +169,18 @@ IN_PROC_BROWSER_TEST_F(GDataContactsServiceTest, BrokenFeeds) {
EXPECT_TRUE(Download("feed_photo_404.json", base::Time(), &contacts));
ASSERT_EQ(static_cast<size_t>(1), contacts->size());
EXPECT_FALSE((*contacts)[0]->has_raw_untrusted_photo());
-}
-// We should report failure when we're unable to download the contact group
-// feed.
-IN_PROC_BROWSER_TEST_F(GDataContactsServiceTest, MissingGroupsFeed) {
- scoped_ptr<ScopedVector<contacts::Contact> > contacts;
+ // We should report failure when we're unable to download the contact group
+ // feed.
+ service_->clear_cached_my_contacts_group_id_for_testing();
service_->set_groups_feed_url_for_testing(
test_server_.GetURL(std::string(kFeedBaseUrl) + "404"));
EXPECT_FALSE(Download("feed.json", base::Time(), &contacts));
EXPECT_TRUE(service_->cached_my_contacts_group_id_for_testing().empty());
-}
-// We should also fail when the "My Contacts" group isn't listed in the group
-// feed.
-IN_PROC_BROWSER_TEST_F(GDataContactsServiceTest, NoMyContactsGroup) {
- scoped_ptr<ScopedVector<contacts::Contact> > contacts;
+ // We should also fail when the "My Contacts" group isn't listed in the group
+ // feed.
+ service_->clear_cached_my_contacts_group_id_for_testing();
service_->set_groups_feed_url_for_testing(
test_server_.GetURL(std::string(kFeedBaseUrl) +
"groups_no_my_contacts.json"));
@@ -292,4 +288,22 @@ IN_PROC_BROWSER_TEST_F(GDataContactsServiceTest, ParallelPhotoDownload) {
contacts::test::ContactsToString(*contacts));
}
+IN_PROC_BROWSER_TEST_F(GDataContactsServiceTest, UnicodeStrings) {
+ scoped_ptr<ScopedVector<contacts::Contact> > contacts;
+ EXPECT_TRUE(Download("feed_unicode.json", base::Time(), &contacts));
+
+ // All of these expected values are hardcoded in the feed.
+ scoped_ptr<contacts::Contact> contact1(new contacts::Contact);
+ InitContact("http://example.com/1", "2012-06-04T15:53:36.023Z",
+ false, "安藤 忠雄", "忠雄", "", "安藤", "", "",
satorux1 2012/08/20 18:37:58 I think it's safer to escape them. multi-byte char
Daniel Erat 2012/08/20 19:09:43 Sure, was wondering about this too. Updated.
+ contact1.get());
+ scoped_ptr<contacts::Contact> contact2(new contacts::Contact);
+ InitContact("http://example.com/2", "2012-06-21T16:20:13.208Z",
+ false, "Bob Smith", "Bob", "", "Smith", "", "",
+ contact2.get());
+ EXPECT_EQ(contacts::test::VarContactsToString(
+ 2, contact1.get(), contact2.get()),
+ contacts::test::ContactsToString(*contacts));
+}
+
} // namespace gdata
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_contacts_service.cc ('k') | chrome/test/data/chromeos/gdata/contacts/feed_unicode.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698