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

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: Refactor out status detection, update tests. 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/gmock/include/gmock/gmock.h"
12 #include "testing/gtest/include/gtest/gtest.h"
13
14 using testing::Return;
15
16 class FakeSigninManagerBase;
17 class MockSyncService;
18 class TestingPrefServiceSimple;
19 class TestSigninClient;
20 class AccountTrackerService;
Bernhard Bauer 2016/06/28 13:47:39 Nit: Sort alphabetically
dgn 2016/06/28 16:38:57 Done.
21
22 namespace ntp_snippets {
23 namespace test {
24
25 class MockSyncService : public sync_driver::FakeSyncService {
26 public:
27 MockSyncService();
28 virtual ~MockSyncService();
29 MOCK_CONST_METHOD0(CanSyncStart, bool());
30 MOCK_CONST_METHOD0(IsSyncActive, bool());
31 MOCK_CONST_METHOD0(ConfigurationDone, bool());
32 MOCK_CONST_METHOD0(IsEncryptEverythingEnabled, bool());
33 MOCK_CONST_METHOD0(GetActiveDataTypes, syncer::ModelTypeSet());
34 };
35
36 // Common base for snippet tests, handles initializing mocks for sync and
37 // signin. |SetUp()| should be called if a subclass overrides it.
38 class NTPSnippetsTestBase : public testing::Test {
39 public:
40 void SetUp() override;
41
42 protected:
43 NTPSnippetsTestBase();
44 ~NTPSnippetsTestBase() override;
45 void ResetSigninManager();
46
47 MockSyncService* mock_sync_service() { return mock_sync_service_.get(); }
48 FakeSigninManagerBase* fake_signin_manager() {
49 return fake_signin_manager_.get();
50 }
51 TestingPrefServiceSimple* pref_service() { return pref_service_.get(); }
52
53 private:
54 void ResetSyncServiceMock();
55 std::unique_ptr<FakeSigninManagerBase> fake_signin_manager_;
56 std::unique_ptr<MockSyncService> mock_sync_service_;
57 std::unique_ptr<TestingPrefServiceSimple> pref_service_;
58 std::unique_ptr<TestSigninClient> signin_client_;
59 std::unique_ptr<AccountTrackerService> account_tracker_;
60 };
61
62 } // namespace test
63 } // namespace ntp_snippets
64
65 #endif // COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_TEST_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698