clock_skew_tool.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Copyright 2021 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 TOOLS_PRIVACY_BUDGET_CLOCK_SKEW_CLOCK_SKEW_TOOL_H_
  5. #define TOOLS_PRIVACY_BUDGET_CLOCK_SKEW_CLOCK_SKEW_TOOL_H_
  6. #include <memory>
  7. #include "base/message_loop/message_pump_type.h"
  8. #include "base/task/single_thread_task_executor.h"
  9. #include "base/test/scoped_feature_list.h"
  10. #include "components/network_time/network_time_tracker.h"
  11. #include "components/prefs/testing_pref_service.h"
  12. #include "mojo/public/cpp/bindings/remote.h"
  13. #include "services/network/network_context.h"
  14. #include "services/network/network_service.h"
  15. #include "services/network/public/cpp/shared_url_loader_factory.h"
  16. namespace clock_skew {
  17. class ClockSkewTool {
  18. public:
  19. ClockSkewTool();
  20. ~ClockSkewTool();
  21. network_time::NetworkTimeTracker* tracker() const { return tracker_.get(); }
  22. private:
  23. base::SingleThreadTaskExecutor executor_{base::MessagePumpType::IO};
  24. // TODO(https://crbug.com/1258624) Replace `ScopedFeatureList` and
  25. // `TestingPrefServiceSimple` since they're meant to be used in tests.
  26. base::test::ScopedFeatureList features_;
  27. TestingPrefServiceSimple pref_service_;
  28. std::unique_ptr<network::NetworkService> network_service_;
  29. std::unique_ptr<network::NetworkContext> network_context_;
  30. mojo::Remote<network::mojom::URLLoaderFactory> url_loader_factory_;
  31. scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory_;
  32. std::unique_ptr<network_time::NetworkTimeTracker> tracker_;
  33. };
  34. } // namespace clock_skew
  35. #endif // TOOLS_PRIVACY_BUDGET_CLOCK_SKEW_CLOCK_SKEW_TOOL_H_