test_tracker.cc 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Copyright 2017 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. #include "components/feature_engagement/test/test_tracker.h"
  5. #include <utility>
  6. #include "base/threading/sequenced_task_runner_handle.h"
  7. #include "components/feature_engagement/internal/chrome_variations_configuration.h"
  8. #include "components/feature_engagement/internal/event_model_impl.h"
  9. #include "components/feature_engagement/internal/feature_config_condition_validator.h"
  10. #include "components/feature_engagement/internal/feature_config_event_storage_validator.h"
  11. #include "components/feature_engagement/internal/in_memory_event_store.h"
  12. #include "components/feature_engagement/internal/init_aware_event_model.h"
  13. #include "components/feature_engagement/internal/never_availability_model.h"
  14. #include "components/feature_engagement/internal/noop_display_lock_controller.h"
  15. #include "components/feature_engagement/internal/system_time_provider.h"
  16. #include "components/feature_engagement/internal/tracker_impl.h"
  17. #include "components/feature_engagement/public/feature_list.h"
  18. #include "components/feature_engagement/public/tracker.h"
  19. namespace feature_engagement {
  20. // static
  21. std::unique_ptr<Tracker> CreateTestTracker() {
  22. auto configuration = std::make_unique<ChromeVariationsConfiguration>();
  23. configuration->ParseFeatureConfigs(GetAllFeatures());
  24. auto storage_validator =
  25. std::make_unique<FeatureConfigEventStorageValidator>();
  26. storage_validator->InitializeFeatures(GetAllFeatures(), *configuration);
  27. auto raw_event_model = std::make_unique<EventModelImpl>(
  28. std::make_unique<InMemoryEventStore>(), std::move(storage_validator));
  29. auto event_model =
  30. std::make_unique<InitAwareEventModel>(std::move(raw_event_model));
  31. return std::make_unique<TrackerImpl>(
  32. std::move(event_model), std::make_unique<NeverAvailabilityModel>(),
  33. std::move(configuration), std::make_unique<NoopDisplayLockController>(),
  34. std::make_unique<FeatureConfigConditionValidator>(),
  35. std::make_unique<SystemTimeProvider>());
  36. }
  37. } // namespace feature_engagement