summaryrefslogtreecommitdiffstats
path: root/components/browser_sync
diff options
context:
space:
mode:
authorvabr <vabr@chromium.org>2016-01-21 02:18:03 -0800
committerCommit bot <commit-bot@chromium.org>2016-01-21 10:19:28 +0000
commit9e9222f52c71c65bdd1cfc810f83b5ed1d1d3016 (patch)
treec9ceddf38ccc9b1da58547c79c1efce7089a3f0f /components/browser_sync
parente851311c07d93803331eeb24106dfd46100ba4b4 (diff)
downloadchromium_src-9e9222f52c71c65bdd1cfc810f83b5ed1d1d3016.zip
chromium_src-9e9222f52c71c65bdd1cfc810f83b5ed1d1d3016.tar.gz
chromium_src-9e9222f52c71c65bdd1cfc810f83b5ed1d1d3016.tar.bz2
Create profile_sync_test_util in components
There are already such utils in //chrome/browser/sync and the //ios version as well. This CL starts by pulling out some trivial parts into a common file in //components. More will follow as ProfileSyncService unittests will get componentised. BUG=544972 Review URL: https://codereview.chromium.org/1607473003 Cr-Commit-Position: refs/heads/master@{#370659}
Diffstat (limited to 'components/browser_sync')
-rw-r--r--components/browser_sync/browser/BUILD.gn3
-rw-r--r--components/browser_sync/browser/profile_sync_test_util.cc17
-rw-r--r--components/browser_sync/browser/profile_sync_test_util.h35
3 files changed, 55 insertions, 0 deletions
diff --git a/components/browser_sync/browser/BUILD.gn b/components/browser_sync/browser/BUILD.gn
index 3ad2405..38ef95f 100644
--- a/components/browser_sync/browser/BUILD.gn
+++ b/components/browser_sync/browser/BUILD.gn
@@ -83,11 +83,14 @@ source_set("test_support") {
sources = [
"profile_sync_service_mock.cc",
"profile_sync_service_mock.h",
+ "profile_sync_test_util.cc",
+ "profile_sync_test_util.h",
]
deps = [
":browser",
"//base",
+ "//components/sync_driver",
"//components/sync_driver:test_support",
"//google_apis",
"//testing/gmock",
diff --git a/components/browser_sync/browser/profile_sync_test_util.cc b/components/browser_sync/browser/profile_sync_test_util.cc
new file mode 100644
index 0000000..b941c32
--- /dev/null
+++ b/components/browser_sync/browser/profile_sync_test_util.cc
@@ -0,0 +1,17 @@
+// Copyright 2016 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.
+
+#include "components/browser_sync/browser/profile_sync_test_util.h"
+
+namespace browser_sync {
+
+void EmptyNetworkTimeUpdate(const base::Time&,
+ const base::TimeDelta&,
+ const base::TimeDelta&) {}
+
+SyncServiceObserverMock::SyncServiceObserverMock() {}
+
+SyncServiceObserverMock::~SyncServiceObserverMock() {}
+
+} // namespace browser_sync
diff --git a/components/browser_sync/browser/profile_sync_test_util.h b/components/browser_sync/browser/profile_sync_test_util.h
new file mode 100644
index 0000000..d0b7007
--- /dev/null
+++ b/components/browser_sync/browser/profile_sync_test_util.h
@@ -0,0 +1,35 @@
+// Copyright 2016 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_BROWSER_SYNC_BROWSER_PROFILE_SYNC_TEST_UTIL_H_
+#define COMPONENTS_BROWSER_SYNC_BROWSER_PROFILE_SYNC_TEST_UTIL_H_
+
+#include "base/time/time.h"
+#include "components/sync_driver/sync_service_observer.h"
+#include "testing/gmock/include/gmock/gmock.h"
+
+namespace base {
+class Time;
+class TimeDelta;
+}
+
+namespace browser_sync {
+
+// An empty syncer::NetworkTimeUpdateCallback. Used in various tests to
+// instantiate ProfileSyncService.
+void EmptyNetworkTimeUpdate(const base::Time&,
+ const base::TimeDelta&,
+ const base::TimeDelta&);
+
+class SyncServiceObserverMock : public sync_driver::SyncServiceObserver {
+ public:
+ SyncServiceObserverMock();
+ virtual ~SyncServiceObserverMock();
+
+ MOCK_METHOD0(OnStateChanged, void());
+};
+
+} // namespace browser_sync
+
+#endif // COMPONENTS_BROWSER_SYNC_BROWSER_PROFILE_SYNC_TEST_UTIL_H_