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

Side by Side Diff: chrome/browser/chromeos/contacts/gdata_contacts_service_stub.cc

Issue 190063004: chromeos: Delete old, unused contacts code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge again Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/chromeos/contacts/gdata_contacts_service_stub.h"
6
7 #include <vector>
8
9 #include "chrome/browser/chromeos/contacts/contact.pb.h"
10 #include "chrome/browser/chromeos/contacts/contact_test_util.h"
11 #include "content/public/browser/browser_thread.h"
12 #include "google_apis/drive/time_util.h"
13
14 using content::BrowserThread;
15
16 namespace contacts {
17
18 GDataContactsServiceStub::GDataContactsServiceStub()
19 : num_download_requests_(0),
20 num_download_requests_with_wrong_timestamps_(0),
21 download_should_succeed_(true) {
22 }
23
24 GDataContactsServiceStub::~GDataContactsServiceStub() {
25 }
26
27 void GDataContactsServiceStub::SetContacts(
28 const contacts::ContactPointers& contacts,
29 const base::Time& expected_min_update_time) {
30 contacts::test::CopyContacts(contacts, &contacts_);
31 expected_min_update_time_ = expected_min_update_time;
32 }
33
34 void GDataContactsServiceStub::DownloadContacts(
35 SuccessCallback success_callback,
36 FailureCallback failure_callback,
37 const base::Time& min_update_time) {
38 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
39 num_download_requests_++;
40
41 if (!download_should_succeed_) {
42 failure_callback.Run();
43 return;
44 }
45
46 if (min_update_time != expected_min_update_time_) {
47 LOG(ERROR) << "Actual minimum update time ("
48 << google_apis::util::FormatTimeAsString(min_update_time) << ") "
49 << "differed from expected ("
50 << google_apis::util::FormatTimeAsString(
51 expected_min_update_time_)
52 << "); not returning any contacts";
53 num_download_requests_with_wrong_timestamps_++;
54 failure_callback.Run();
55 return;
56 }
57
58 scoped_ptr<ScopedVector<contacts::Contact> > contacts(
59 new ScopedVector<contacts::Contact>());
60 contacts::test::CopyContacts(contacts_, contacts.get());
61 success_callback.Run(contacts.Pass());
62 }
63
64 } // namespace contacts
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698