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

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

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 #ifndef CHROME_BROWSER_CHROMEOS_CONTACTS_GDATA_CONTACTS_SERVICE_STUB_H_
6 #define CHROME_BROWSER_CHROMEOS_CONTACTS_GDATA_CONTACTS_SERVICE_STUB_H_
7
8 #include "chrome/browser/chromeos/contacts/gdata_contacts_service.h"
9
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/time/time.h"
13
14 namespace contacts {
15 typedef std::vector<const contacts::Contact*> ContactPointers;
16
17 // "Stub" implementation of GDataContactsServiceInterface used for testing.
18 // Returns a pre-set list of contacts in response to DownloadContacts() calls.
19 class GDataContactsServiceStub : public GDataContactsServiceInterface {
20 public:
21 GDataContactsServiceStub();
22 virtual ~GDataContactsServiceStub();
23
24 int num_download_requests() const { return num_download_requests_; }
25 int num_download_requests_with_wrong_timestamps() const {
26 return num_download_requests_with_wrong_timestamps_;
27 }
28 void reset_stats() {
29 num_download_requests_ = 0;
30 num_download_requests_with_wrong_timestamps_ = 0;
31 }
32 void set_download_should_succeed(bool succeed) {
33 download_should_succeed_ = succeed;
34 }
35
36 // Sets the contacts that will be returned by DownloadContacts(), assuming
37 // that the request's |min_update_time| matches |expected_min_update_time|.
38 void SetContacts(const contacts::ContactPointers& contacts,
39 const base::Time& expected_min_update_time);
40
41 // Overridden from GDataContactsServiceInterface:
42 virtual void DownloadContacts(SuccessCallback success_callback,
43 FailureCallback failure_callback,
44 const base::Time& min_update_time) OVERRIDE;
45
46 private:
47 // How many times has DownloadContacts() been called?
48 int num_download_requests_;
49
50 // How many times has DownloadContacts() been called with a |min_update_time|
51 // parameter that doesn't match |expected_min_update_time_|?
52 int num_download_requests_with_wrong_timestamps_;
53
54 // Should calls to DownloadContacts() succeed?
55 bool download_should_succeed_;
56
57 // Contacts to be returned by calls to DownloadContacts().
58 ScopedVector<contacts::Contact> contacts_;
59
60 // |min_update_time| value that we expect to be passed to DownloadContacts().
61 // If a different value is passed, we'll log an error and report failure.
62 base::Time expected_min_update_time_;
63
64 DISALLOW_COPY_AND_ASSIGN(GDataContactsServiceStub);
65 };
66
67 } // namespace contacts
68
69 #endif // CHROME_BROWSER_CHROMEOS_CONTACTS_GDATA_CONTACTS_SERVICE_STUB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698