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

Unified Diff: components/ntp_snippets/ntp_snippets_test_utils.cc

Issue 2061803002: 📰 The Status card reports disabled sync states (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@simplifyBridge
Patch Set: yolo: another big bag of changes Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/ntp_snippets/ntp_snippets_test_utils.h ('k') | components/ntp_snippets_strings.grdp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/ntp_snippets/ntp_snippets_test_utils.cc
diff --git a/components/ntp_snippets/ntp_snippets_test_utils.cc b/components/ntp_snippets/ntp_snippets_test_utils.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c00629c763230548bb7f23143c047b633af2c37a
--- /dev/null
+++ b/components/ntp_snippets/ntp_snippets_test_utils.cc
@@ -0,0 +1,74 @@
+// 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/ntp_snippets/ntp_snippets_test_utils.h"
+
+#include <memory>
+
+#include "components/prefs/pref_registry_simple.h"
+#include "components/prefs/testing_pref_service.h"
+#include "components/signin/core/browser/account_tracker_service.h"
+#include "components/signin/core/browser/fake_signin_manager.h"
+#include "components/signin/core/browser/test_signin_client.h"
+#include "components/signin/core/common/signin_pref_names.h"
+#include "components/sync_driver/fake_sync_service.h"
+
+namespace ntp_snippets {
+namespace test {
+
+MockSyncService::MockSyncService()
+ : can_sync_start_(true),
+ is_sync_active_(true),
+ configuration_done_(true),
+ is_encrypt_everything_enabled_(false),
+ active_data_types_(syncer::HISTORY_DELETE_DIRECTIVES) {}
+
+MockSyncService::~MockSyncService() {}
+
+bool MockSyncService::CanSyncStart() const {
+ return can_sync_start_;
+}
+
+bool MockSyncService::IsSyncActive() const {
+ return is_sync_active_;
+}
+
+bool MockSyncService::ConfigurationDone() const {
+ return configuration_done_;
+}
+
+bool MockSyncService::IsEncryptEverythingEnabled() const {
+ return is_encrypt_everything_enabled_;
+}
+
+syncer::ModelTypeSet MockSyncService::GetActiveDataTypes() const {
+ return active_data_types_;
+}
+
+NTPSnippetsTestBase::NTPSnippetsTestBase()
+ : pref_service_(new TestingPrefServiceSimple()) {
+ pref_service_->registry()->RegisterStringPref(prefs::kGoogleServicesAccountId,
+ std::string());
+ pref_service_->registry()->RegisterStringPref(
+ prefs::kGoogleServicesLastAccountId, std::string());
+ pref_service_->registry()->RegisterStringPref(
+ prefs::kGoogleServicesLastUsername, std::string());
+}
+
+NTPSnippetsTestBase::~NTPSnippetsTestBase() {}
+
+void NTPSnippetsTestBase::SetUp() {
+ signin_client_.reset(new TestSigninClient(pref_service_.get()));
+ account_tracker_.reset(new AccountTrackerService());
+ mock_sync_service_.reset(new MockSyncService());
+ ResetSigninManager();
+}
+
+void NTPSnippetsTestBase::ResetSigninManager() {
+ fake_signin_manager_.reset(
+ new FakeSigninManagerBase(signin_client_.get(), account_tracker_.get()));
+}
+
+} // namespace test
+} // namespace ntp_snippets
« no previous file with comments | « components/ntp_snippets/ntp_snippets_test_utils.h ('k') | components/ntp_snippets_strings.grdp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698