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

Side by Side 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, 5 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_TEST_UTILS_H_
6 #define COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_TEST_UTILS_H_
7
8 #include <memory>
9
10 #include "components/sync_driver/fake_sync_service.h"
11 #include "testing/gtest/include/gtest/gtest.h"
12
13 class AccountTrackerService;
14 class FakeSigninManagerBase;
15 class MockSyncService;
16 class TestingPrefServiceSimple;
17 class TestSigninClient;
18
19 namespace ntp_snippets {
20 namespace test {
21
22 class MockSyncService : public sync_driver::FakeSyncService {
23 public:
24 MockSyncService();
25 ~MockSyncService() override;
26
27 bool CanSyncStart() const override;
28 bool IsSyncActive() const override;
29 bool ConfigurationDone() const override;
30 bool IsEncryptEverythingEnabled() const override;
31 syncer::ModelTypeSet GetActiveDataTypes() const override;
32
33 bool can_sync_start_;
34 bool is_sync_active_;
35 bool configuration_done_;
36 bool is_encrypt_everything_enabled_;
37 syncer::ModelTypeSet active_data_types_;
38 };
39
40 // Common base for snippet tests, handles initializing mocks for sync and
41 // signin. |SetUp()| should be called if a subclass overrides it.
42 class NTPSnippetsTestBase : public testing::Test {
43 public:
44 void SetUp() override;
45
46 protected:
47 NTPSnippetsTestBase();
48 ~NTPSnippetsTestBase() override;
49 void ResetSigninManager();
50
51 MockSyncService* mock_sync_service() { return mock_sync_service_.get(); }
52 FakeSigninManagerBase* fake_signin_manager() {
53 return fake_signin_manager_.get();
54 }
55 TestingPrefServiceSimple* pref_service() { return pref_service_.get(); }
56
57 private:
58 std::unique_ptr<FakeSigninManagerBase> fake_signin_manager_;
59 std::unique_ptr<MockSyncService> mock_sync_service_;
60 std::unique_ptr<TestingPrefServiceSimple> pref_service_;
61 std::unique_ptr<TestSigninClient> signin_client_;
62 std::unique_ptr<AccountTrackerService> account_tracker_;
63 };
64
65 } // namespace test
66 } // namespace ntp_snippets
67
68 #endif // COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_TEST_UTILS_H_
OLDNEW
« 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