summaryrefslogtreecommitdiffstats
path: root/components/webdata_services/web_data_service_test_util.h
diff options
context:
space:
mode:
authorsdefresne <sdefresne@chromium.org>2014-12-15 15:21:56 -0800
committerCommit bot <commit-bot@chromium.org>2014-12-15 23:22:23 +0000
commitcb955cd06650ee281f745b5a86aff7864fe44066 (patch)
treed663541ca9f25582d5de09be3844285467d404dd /components/webdata_services/web_data_service_test_util.h
parent81c98ba5f74cbe9e6f1a12a0b96371b65dd4374e (diff)
downloadchromium_src-cb955cd06650ee281f745b5a86aff7864fe44066.zip
chromium_src-cb955cd06650ee281f745b5a86aff7864fe44066.tar.gz
chromium_src-cb955cd06650ee281f745b5a86aff7864fe44066.tar.bz2
Introduce new component webdata_services
Move WebDataServiceWrapper into its own component webdata_services so that the code can be shared with iOS. The code cannot go into webdata component since it depends on other components (autofill, password_manager, search_engine, signin) that depends on webdata (as they implements the WebDataService interface). BUG=437508 Review URL: https://codereview.chromium.org/777863002 Cr-Commit-Position: refs/heads/master@{#308451}
Diffstat (limited to 'components/webdata_services/web_data_service_test_util.h')
-rw-r--r--components/webdata_services/web_data_service_test_util.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/components/webdata_services/web_data_service_test_util.h b/components/webdata_services/web_data_service_test_util.h
new file mode 100644
index 0000000..4c260a1
--- /dev/null
+++ b/components/webdata_services/web_data_service_test_util.h
@@ -0,0 +1,48 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_WEBDATA_SERVICES_WEB_DATA_SERVICE_TEST_UTIL_H__
+#define COMPONENTS_WEBDATA_SERVICES_WEB_DATA_SERVICE_TEST_UTIL_H__
+
+#include "base/basictypes.h"
+#include "base/message_loop/message_loop.h"
+#include "components/signin/core/browser/webdata/token_web_data.h"
+#include "components/webdata_services/web_data_service_wrapper.h"
+
+// Base class for mocks of WebDataService, that does nothing in
+// Shutdown().
+class MockWebDataServiceWrapperBase : public WebDataServiceWrapper {
+ public:
+ MockWebDataServiceWrapperBase();
+ ~MockWebDataServiceWrapperBase() override;
+
+ void Shutdown() override;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(MockWebDataServiceWrapperBase);
+};
+
+// Pass your fake WebDataService in the constructor and this will
+// serve it up via GetWebData().
+class MockWebDataServiceWrapper : public MockWebDataServiceWrapperBase {
+ public:
+ MockWebDataServiceWrapper(
+ scoped_refptr<autofill::AutofillWebDataService> fake_autofill,
+ scoped_refptr<TokenWebData> fake_token);
+
+ ~MockWebDataServiceWrapper() override;
+
+ scoped_refptr<autofill::AutofillWebDataService> GetAutofillWebData() override;
+
+ scoped_refptr<TokenWebData> GetTokenWebData() override;
+
+ protected:
+ scoped_refptr<autofill::AutofillWebDataService> fake_autofill_web_data_;
+ scoped_refptr<TokenWebData> fake_token_web_data_;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(MockWebDataServiceWrapper);
+};
+
+#endif // COMPONENTS_WEBDATA_SERVICES_WEB_DATA_SERVICE_TEST_UTIL_H__