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

Side by Side Diff: chrome/browser/chromeos/gdata/fake_gdata_contacts_service.cc

Issue 10542076: ABANDONED: chromeos: Download contacts (work in progress). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: minor changes Created 8 years, 5 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/gdata/fake_gdata_contacts_service.h"
6
7 #include <vector>
8
9 #include "base/time.h"
10 #include "chrome/browser/chromeos/contacts/contact.h"
11 #include "chrome/browser/chromeos/contacts/contact_test_lib.h"
12 #include "chrome/browser/chromeos/gdata/gdata_util.h"
13 #include "content/public/browser/browser_thread.h"
14
15 using content::BrowserThread;
16
17 namespace gdata {
18
19 FakeGDataContactsService::FakeGDataContactsService()
20 : download_should_succeed_(true) {
21 }
22
23 FakeGDataContactsService::~FakeGDataContactsService() {
24 }
25
26 void FakeGDataContactsService::SetContacts(
27 const contacts::ContactPointers& contacts,
28 const base::Time& expected_min_update_time) {
29 contacts::test::CopyContacts(contacts, &contacts_);
30 expected_min_update_time_ = expected_min_update_time;
31 }
32
33 void FakeGDataContactsService::Initialize() {
34 }
35
36 void FakeGDataContactsService::DownloadContacts(
37 SuccessCallback success_callback,
38 FailureCallback failure_callback,
39 const base::Time& min_update_time) {
40 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
41
42 if (download_should_succeed_) {
43 scoped_ptr<ScopedVector<contacts::Contact> > contacts(
44 new ScopedVector<contacts::Contact>());
45 if (min_update_time == expected_min_update_time_) {
46 contacts::test::CopyContacts(contacts_, contacts.get());
47 } else {
48 LOG(ERROR) << "Actual minimum update time ("
49 << util::FormatTimeAsString(min_update_time) << ") "
50 << "differed from expected ("
51 << util::FormatTimeAsString(expected_min_update_time_)
52 << "); not returning any contacts";
53 }
54 success_callback.Run(contacts.Pass());
55 } else {
56 failure_callback.Run();
57 }
58 }
59
60 } // namespace contacts
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/fake_gdata_contacts_service.h ('k') | chrome/browser/chromeos/gdata/gdata_contacts_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698