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

Unified Diff: components/ntp_snippets/ntp_snippets_test_utils.h

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
Index: components/ntp_snippets/ntp_snippets_test_utils.h
diff --git a/components/ntp_snippets/ntp_snippets_test_utils.h b/components/ntp_snippets/ntp_snippets_test_utils.h
new file mode 100644
index 0000000000000000000000000000000000000000..20e9c854b617731ceaf18c05e16431640d45032e
--- /dev/null
+++ b/components/ntp_snippets/ntp_snippets_test_utils.h
@@ -0,0 +1,68 @@
+// 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_NTP_SNIPPETS_NTP_SNIPPETS_TEST_UTILS_H_
+#define COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_TEST_UTILS_H_
+
+#include <memory>
+
+#include "components/sync_driver/fake_sync_service.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+class AccountTrackerService;
+class FakeSigninManagerBase;
+class MockSyncService;
+class TestingPrefServiceSimple;
+class TestSigninClient;
+
+namespace ntp_snippets {
+namespace test {
+
+class MockSyncService : public sync_driver::FakeSyncService {
+ public:
+ MockSyncService();
+ ~MockSyncService() override;
+
+ bool CanSyncStart() const override;
+ bool IsSyncActive() const override;
+ bool ConfigurationDone() const override;
+ bool IsEncryptEverythingEnabled() const override;
+ syncer::ModelTypeSet GetActiveDataTypes() const override;
+
+ bool can_sync_start_;
+ bool is_sync_active_;
+ bool configuration_done_;
+ bool is_encrypt_everything_enabled_;
+ syncer::ModelTypeSet active_data_types_;
+};
+
+// Common base for snippet tests, handles initializing mocks for sync and
+// signin. |SetUp()| should be called if a subclass overrides it.
+class NTPSnippetsTestBase : public testing::Test {
+ public:
+ void SetUp() override;
+
+ protected:
+ NTPSnippetsTestBase();
+ ~NTPSnippetsTestBase() override;
+ void ResetSigninManager();
+
+ MockSyncService* mock_sync_service() { return mock_sync_service_.get(); }
+ FakeSigninManagerBase* fake_signin_manager() {
+ return fake_signin_manager_.get();
+ }
+ TestingPrefServiceSimple* pref_service() { return pref_service_.get(); }
+
+ private:
+ std::unique_ptr<FakeSigninManagerBase> fake_signin_manager_;
+ std::unique_ptr<MockSyncService> mock_sync_service_;
+ std::unique_ptr<TestingPrefServiceSimple> pref_service_;
+ std::unique_ptr<TestSigninClient> signin_client_;
+ std::unique_ptr<AccountTrackerService> account_tracker_;
+};
+
+} // namespace test
+} // namespace ntp_snippets
+
+#endif // COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_TEST_UTILS_H_
« no previous file with comments | « components/ntp_snippets/ntp_snippets_status_service_unittest.cc ('k') | components/ntp_snippets/ntp_snippets_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698