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

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_contacts_service_stub.h

Issue 10818017: contacts: Add GDataContactsService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: apply review feedback 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 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CONTACTS_SERVICE_STUB_H_
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CONTACTS_SERVICE_STUB_H_
7
8 #include "chrome/browser/chromeos/gdata/gdata_contacts_service.h"
9
10 #include "base/basictypes.h"
11 #include "base/callback.h"
12 #include "base/compiler_specific.h"
13 #include "base/time.h"
14
15 namespace contacts {
16 typedef std::vector<const contacts::Contact*> ContactPointers;
17 }
18
19 namespace gdata {
20
21 // "Stub" implementation of GDataContactsServiceInterface used for testing.
22 // Returns a pre-set list of contacts in response to DownloadContacts() calls.
23 class GDataContactsServiceStub : public GDataContactsServiceInterface {
satorux1 2012/07/24 21:34:29 Is this class used in this patch? Otherwise, you m
Daniel Erat 2012/07/27 16:54:19 Sure, I'll defer it for a later change.
24 public:
25 GDataContactsServiceStub();
26 virtual ~GDataContactsServiceStub();
27
28 void set_download_should_succeed(bool succeed) {
29 download_should_succeed_ = succeed;
30 }
31
32 // Sets the contacts that will be returned by DownloadContacts(), assuming
33 // that the request's |min_update_time| matches |expected_min_update_time|.
34 void SetContacts(const contacts::ContactPointers& contacts,
35 const base::Time& expected_min_update_time);
36
37 // Overridden from GDataContactsServiceInterface:
38 virtual void Initialize() OVERRIDE;
39 virtual void DownloadContacts(SuccessCallback success_callback,
40 FailureCallback failure_callback,
41 const base::Time& min_update_time) OVERRIDE;
42
43 private:
44 // Should calls to DownloadContacts() succeed?
45 bool download_should_succeed_;
46
47 // Contacts to be returned by calls to DownloadContacts().
48 ScopedVector<contacts::Contact> contacts_;
49
50 // |min_update_time| value that we expect to be passed to DownloadContacts().
51 // If a different value is passed, we'll log an error and report failure.
52 base::Time expected_min_update_time_;
53
54 DISALLOW_COPY_AND_ASSIGN(GDataContactsServiceStub);
55 };
56
57 } // namespace gdata
58
59 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CONTACTS_SERVICE_STUB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698