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 #ifndef CHROME_BROWSER_CHROMEOS_CONTACTS_GDATA_CONTACTS_SERVICE_STUB_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_CONTACTS_GDATA_CONTACTS_SERVICE_STUB_H_ |
6 #define CHROME_BROWSER_CHROMEOS_CONTACTS_GDATA_CONTACTS_SERVICE_STUB_H_ | 6 #define CHROME_BROWSER_CHROMEOS_CONTACTS_GDATA_CONTACTS_SERVICE_STUB_H_ |
7 | 7 |
8 #include "chrome/browser/chromeos/contacts/gdata_contacts_service.h" | 8 #include "chrome/browser/chromeos/contacts/gdata_contacts_service.h" |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 void set_download_should_succeed(bool succeed) { | 32 void set_download_should_succeed(bool succeed) { |
33 download_should_succeed_ = succeed; | 33 download_should_succeed_ = succeed; |
34 } | 34 } |
35 | 35 |
36 // Sets the contacts that will be returned by DownloadContacts(), assuming | 36 // Sets the contacts that will be returned by DownloadContacts(), assuming |
37 // that the request's |min_update_time| matches |expected_min_update_time|. | 37 // that the request's |min_update_time| matches |expected_min_update_time|. |
38 void SetContacts(const contacts::ContactPointers& contacts, | 38 void SetContacts(const contacts::ContactPointers& contacts, |
39 const base::Time& expected_min_update_time); | 39 const base::Time& expected_min_update_time); |
40 | 40 |
41 // Overridden from GDataContactsServiceInterface: | 41 // Overridden from GDataContactsServiceInterface: |
42 virtual void Initialize() OVERRIDE; | |
43 virtual void DownloadContacts(SuccessCallback success_callback, | 42 virtual void DownloadContacts(SuccessCallback success_callback, |
44 FailureCallback failure_callback, | 43 FailureCallback failure_callback, |
45 const base::Time& min_update_time) OVERRIDE; | 44 const base::Time& min_update_time) OVERRIDE; |
46 | 45 |
47 private: | 46 private: |
48 // How many times has DownloadContacts() been called? | 47 // How many times has DownloadContacts() been called? |
49 int num_download_requests_; | 48 int num_download_requests_; |
50 | 49 |
51 // How many times has DownloadContacts() been called with a |min_update_time| | 50 // How many times has DownloadContacts() been called with a |min_update_time| |
52 // parameter that doesn't match |expected_min_update_time_|? | 51 // parameter that doesn't match |expected_min_update_time_|? |
53 int num_download_requests_with_wrong_timestamps_; | 52 int num_download_requests_with_wrong_timestamps_; |
54 | 53 |
55 // Should calls to DownloadContacts() succeed? | 54 // Should calls to DownloadContacts() succeed? |
56 bool download_should_succeed_; | 55 bool download_should_succeed_; |
57 | 56 |
58 // Contacts to be returned by calls to DownloadContacts(). | 57 // Contacts to be returned by calls to DownloadContacts(). |
59 ScopedVector<contacts::Contact> contacts_; | 58 ScopedVector<contacts::Contact> contacts_; |
60 | 59 |
61 // |min_update_time| value that we expect to be passed to DownloadContacts(). | 60 // |min_update_time| value that we expect to be passed to DownloadContacts(). |
62 // If a different value is passed, we'll log an error and report failure. | 61 // If a different value is passed, we'll log an error and report failure. |
63 base::Time expected_min_update_time_; | 62 base::Time expected_min_update_time_; |
64 | 63 |
65 DISALLOW_COPY_AND_ASSIGN(GDataContactsServiceStub); | 64 DISALLOW_COPY_AND_ASSIGN(GDataContactsServiceStub); |
66 }; | 65 }; |
67 | 66 |
68 } // namespace contacts | 67 } // namespace contacts |
69 | 68 |
70 #endif // CHROME_BROWSER_CHROMEOS_CONTACTS_GDATA_CONTACTS_SERVICE_STUB_H_ | 69 #endif // CHROME_BROWSER_CHROMEOS_CONTACTS_GDATA_CONTACTS_SERVICE_STUB_H_ |
OLD | NEW |