proto_database_provider_test_base.h 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. // Copyright 2019 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. #ifndef COMPONENTS_OPTIMIZATION_GUIDE_CORE_PROTO_DATABASE_PROVIDER_TEST_BASE_H_
  5. #define COMPONENTS_OPTIMIZATION_GUIDE_CORE_PROTO_DATABASE_PROVIDER_TEST_BASE_H_
  6. #include "base/files/scoped_temp_dir.h"
  7. #include "components/leveldb_proto/public/proto_database_provider.h"
  8. #include "testing/gtest/include/gtest/gtest.h"
  9. namespace optimization_guide {
  10. // Test class that creates a ScopedTempDir, a SimpleFactoryKey and a
  11. // ProtoDatabaseProvider on each run, it is used because many tests need to
  12. // create a HintCacheStore, which needs a ProtoDatabaseProvider to initialize
  13. // its database.
  14. class ProtoDatabaseProviderTestBase : public testing::Test {
  15. public:
  16. ProtoDatabaseProviderTestBase();
  17. ~ProtoDatabaseProviderTestBase() override;
  18. void SetUp() override;
  19. void TearDown() override;
  20. protected:
  21. base::ScopedTempDir temp_dir_;
  22. std::unique_ptr<leveldb_proto::ProtoDatabaseProvider> db_provider_;
  23. };
  24. } // namespace optimization_guide
  25. #endif // COMPONENTS_OPTIMIZATION_GUIDE_CORE_PROTO_DATABASE_PROVIDER_TEST_BASE_H_