| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 COMPONENTS_WEBDATA_COMMON_WEB_DATA_SERVICE_TEST_UTIL_H__ | 5 #ifndef COMPONENTS_WEBDATA_COMMON_WEB_DATA_SERVICE_TEST_UTIL_H__ |
| 6 #define COMPONENTS_WEBDATA_COMMON_WEB_DATA_SERVICE_TEST_UTIL_H__ | 6 #define COMPONENTS_WEBDATA_COMMON_WEB_DATA_SERVICE_TEST_UTIL_H__ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "chrome/browser/webdata/token_web_data.h" |
| 10 #include "chrome/browser/webdata/web_data_service.h" | 11 #include "chrome/browser/webdata/web_data_service.h" |
| 11 #include "chrome/browser/webdata/web_data_service_factory.h" | 12 #include "chrome/browser/webdata/web_data_service_factory.h" |
| 12 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
| 13 | 14 |
| 14 template <class T> | 15 template <class T> |
| 15 class AutofillWebDataServiceConsumer: public WebDataServiceConsumer { | 16 class AutofillWebDataServiceConsumer: public WebDataServiceConsumer { |
| 16 public: | 17 public: |
| 17 AutofillWebDataServiceConsumer() : handle_(0) {} | 18 AutofillWebDataServiceConsumer() : handle_(0) {} |
| 18 virtual ~AutofillWebDataServiceConsumer() {} | 19 virtual ~AutofillWebDataServiceConsumer() {} |
| 19 | 20 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 50 private: | 51 private: |
| 51 DISALLOW_COPY_AND_ASSIGN(MockWebDataServiceWrapperBase); | 52 DISALLOW_COPY_AND_ASSIGN(MockWebDataServiceWrapperBase); |
| 52 }; | 53 }; |
| 53 | 54 |
| 54 // Pass your fake WebDataService in the constructor and this will | 55 // Pass your fake WebDataService in the constructor and this will |
| 55 // serve it up via GetWebData(). | 56 // serve it up via GetWebData(). |
| 56 class MockWebDataServiceWrapper : public MockWebDataServiceWrapperBase { | 57 class MockWebDataServiceWrapper : public MockWebDataServiceWrapperBase { |
| 57 public: | 58 public: |
| 58 MockWebDataServiceWrapper( | 59 MockWebDataServiceWrapper( |
| 59 scoped_refptr<WebDataService> fake_service, | 60 scoped_refptr<WebDataService> fake_service, |
| 60 scoped_refptr<autofill::AutofillWebDataService> fake_autofill); | 61 scoped_refptr<autofill::AutofillWebDataService> fake_autofill, |
| 62 scoped_refptr<TokenWebData> fake_token); |
| 61 | 63 |
| 62 virtual ~MockWebDataServiceWrapper(); | 64 virtual ~MockWebDataServiceWrapper(); |
| 63 | 65 |
| 64 virtual scoped_refptr<autofill::AutofillWebDataService> | 66 virtual scoped_refptr<autofill::AutofillWebDataService> |
| 65 GetAutofillWebData() OVERRIDE; | 67 GetAutofillWebData() OVERRIDE; |
| 66 | 68 |
| 69 virtual scoped_refptr<TokenWebData> GetTokenWebData() OVERRIDE; |
| 70 |
| 67 virtual scoped_refptr<WebDataService> GetWebData() OVERRIDE; | 71 virtual scoped_refptr<WebDataService> GetWebData() OVERRIDE; |
| 68 | 72 |
| 69 protected: | 73 protected: |
| 70 scoped_refptr<autofill::AutofillWebDataService> fake_autofill_web_data_; | 74 scoped_refptr<autofill::AutofillWebDataService> fake_autofill_web_data_; |
| 75 scoped_refptr<TokenWebData> fake_token_web_data_; |
| 71 scoped_refptr<WebDataService> fake_web_data_; | 76 scoped_refptr<WebDataService> fake_web_data_; |
| 72 | 77 |
| 73 private: | 78 private: |
| 74 DISALLOW_COPY_AND_ASSIGN(MockWebDataServiceWrapper); | 79 DISALLOW_COPY_AND_ASSIGN(MockWebDataServiceWrapper); |
| 75 }; | 80 }; |
| 76 | 81 |
| 77 #endif // COMPONENTS_WEBDATA_COMMON_WEB_DATA_SERVICE_TEST_UTIL_H__ | 82 #endif // COMPONENTS_WEBDATA_COMMON_WEB_DATA_SERVICE_TEST_UTIL_H__ |
| OLD | NEW |