123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- // Copyright 2020 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_REPORTING_STORAGE_TEST_STORAGE_MODULE_H_
- #define COMPONENTS_REPORTING_STORAGE_TEST_STORAGE_MODULE_H_
- #include "base/callback.h"
- #include "components/reporting/proto/synced/record.pb.h"
- #include "components/reporting/proto/synced/record_constants.pb.h"
- #include "components/reporting/storage/storage_module_interface.h"
- #include "testing/gmock/include/gmock/gmock.h"
- #include "testing/gtest/include/gtest/gtest.h"
- #include "third_party/abseil-cpp/absl/types/optional.h"
- namespace reporting {
- namespace test {
- class TestStorageModuleStrict : public StorageModuleInterface {
- public:
- // As opposed to the production |StorageModule|, test module does not need to
- // call factory method - it is created directly by constructor.
- TestStorageModuleStrict();
- MOCK_METHOD(void,
- AddRecord,
- (Priority priority, Record record, EnqueueCallback callback),
- (override));
- MOCK_METHOD(void,
- Flush,
- (Priority priority, FlushCallback callback),
- (override));
- MOCK_METHOD(void,
- ReportSuccess,
- (SequenceInformation sequence_information, bool force),
- (override));
- MOCK_METHOD(void,
- UpdateEncryptionKey,
- (SignedEncryptionInfo signed_encryption_key),
- (override));
- const Record& record() const;
- Priority priority() const;
- protected:
- ~TestStorageModuleStrict() override;
- private:
- void AddRecordSuccessfully(Priority priority,
- Record record,
- EnqueueCallback callback);
- absl::optional<Record> record_;
- absl::optional<Priority> priority_;
- };
- // Most of the time no need to log uninterested calls to |AddRecord|.
- typedef ::testing::NiceMock<TestStorageModuleStrict> TestStorageModule;
- } // namespace test
- } // namespace reporting
- #endif // COMPONENTS_REPORTING_STORAGE_TEST_STORAGE_MODULE_H_
|