| 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_stub.h" | 5 #include "chrome/browser/chromeos/gdata/gdata_contacts_service_stub.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "chrome/browser/chromeos/contacts/contact.pb.h" | 9 #include "chrome/browser/chromeos/contacts/contact.pb.h" |
| 10 #include "chrome/browser/chromeos/contacts/contact_test_util.h" | 10 #include "chrome/browser/chromeos/contacts/contact_test_util.h" |
| 11 #include "chrome/browser/google_apis/gdata_util.h" | 11 #include "chrome/browser/google_apis/gdata_util.h" |
| 12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
| 13 | 13 |
| 14 using content::BrowserThread; | 14 using content::BrowserThread; |
| 15 | 15 |
| 16 namespace gdata { | 16 namespace gdata { |
| 17 | 17 |
| 18 GDataContactsServiceStub::GDataContactsServiceStub() | 18 GDataContactsServiceStub::GDataContactsServiceStub() |
| 19 : num_download_requests_(0), | 19 : num_download_requests_(0), |
| 20 num_download_requests_with_wrong_timestamps_(0), |
| 20 download_should_succeed_(true) { | 21 download_should_succeed_(true) { |
| 21 } | 22 } |
| 22 | 23 |
| 23 GDataContactsServiceStub::~GDataContactsServiceStub() { | 24 GDataContactsServiceStub::~GDataContactsServiceStub() { |
| 24 } | 25 } |
| 25 | 26 |
| 26 void GDataContactsServiceStub::SetContacts( | 27 void GDataContactsServiceStub::SetContacts( |
| 27 const contacts::ContactPointers& contacts, | 28 const contacts::ContactPointers& contacts, |
| 28 const base::Time& expected_min_update_time) { | 29 const base::Time& expected_min_update_time) { |
| 29 contacts::test::CopyContacts(contacts, &contacts_); | 30 contacts::test::CopyContacts(contacts, &contacts_); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 44 failure_callback.Run(); | 45 failure_callback.Run(); |
| 45 return; | 46 return; |
| 46 } | 47 } |
| 47 | 48 |
| 48 if (min_update_time != expected_min_update_time_) { | 49 if (min_update_time != expected_min_update_time_) { |
| 49 LOG(ERROR) << "Actual minimum update time (" | 50 LOG(ERROR) << "Actual minimum update time (" |
| 50 << util::FormatTimeAsString(min_update_time) << ") " | 51 << util::FormatTimeAsString(min_update_time) << ") " |
| 51 << "differed from expected (" | 52 << "differed from expected (" |
| 52 << util::FormatTimeAsString(expected_min_update_time_) | 53 << util::FormatTimeAsString(expected_min_update_time_) |
| 53 << "); not returning any contacts"; | 54 << "); not returning any contacts"; |
| 55 num_download_requests_with_wrong_timestamps_++; |
| 54 failure_callback.Run(); | 56 failure_callback.Run(); |
| 55 return; | 57 return; |
| 56 } | 58 } |
| 57 | 59 |
| 58 scoped_ptr<ScopedVector<contacts::Contact> > contacts( | 60 scoped_ptr<ScopedVector<contacts::Contact> > contacts( |
| 59 new ScopedVector<contacts::Contact>()); | 61 new ScopedVector<contacts::Contact>()); |
| 60 contacts::test::CopyContacts(contacts_, contacts.get()); | 62 contacts::test::CopyContacts(contacts_, contacts.get()); |
| 61 success_callback.Run(contacts.Pass()); | 63 success_callback.Run(contacts.Pass()); |
| 62 } | 64 } |
| 63 | 65 |
| 64 } // namespace contacts | 66 } // namespace contacts |
| OLD | NEW |