begin_frame_args_test.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. // Copyright 2014 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_VIZ_TEST_BEGIN_FRAME_ARGS_TEST_H_
  5. #define COMPONENTS_VIZ_TEST_BEGIN_FRAME_ARGS_TEST_H_
  6. #include <stdint.h>
  7. #include <iosfwd>
  8. #include "base/time/time.h"
  9. #include "components/viz/common/frame_sinks/begin_frame_args.h"
  10. namespace base {
  11. class TickClock;
  12. }
  13. namespace viz {
  14. // Functions for quickly creating BeginFrameArgs
  15. BeginFrameArgs CreateBeginFrameArgsForTesting(
  16. BeginFrameArgs::CreationLocation location,
  17. uint64_t source_id,
  18. uint64_t sequence_number);
  19. BeginFrameArgs CreateBeginFrameArgsForTesting(
  20. BeginFrameArgs::CreationLocation location,
  21. uint64_t source_id,
  22. uint64_t sequence_number,
  23. base::TimeTicks frame_time);
  24. BeginFrameArgs CreateBeginFrameArgsForTesting(
  25. BeginFrameArgs::CreationLocation location,
  26. uint64_t source_id,
  27. uint64_t sequence_number,
  28. int64_t frame_time,
  29. int64_t deadline,
  30. int64_t interval);
  31. BeginFrameArgs CreateBeginFrameArgsForTesting(
  32. BeginFrameArgs::CreationLocation location,
  33. uint64_t source_id,
  34. uint64_t sequence_number,
  35. int64_t frame_time,
  36. int64_t deadline,
  37. int64_t interval,
  38. BeginFrameArgs::BeginFrameArgsType type);
  39. // Creates a BeginFrameArgs using the fake Now value stored on the
  40. // OrderSimpleTaskRunner.
  41. BeginFrameArgs CreateBeginFrameArgsForTesting(
  42. BeginFrameArgs::CreationLocation location,
  43. uint64_t source_id,
  44. uint64_t sequence_number,
  45. const base::TickClock* now_src);
  46. // gtest helpers -- these *must* be in the same namespace as the types they
  47. // operate on.
  48. // Allow "EXPECT_EQ(args1, args2);"
  49. // We don't define operator!= because EXPECT_NE(args1, args2) isn't all that
  50. // sensible.
  51. bool operator==(const BeginFrameArgs& lhs, const BeginFrameArgs& rhs);
  52. // Allow gtest to pretty print begin frame args.
  53. ::std::ostream& operator<<(::std::ostream& os, const BeginFrameArgs& args);
  54. void PrintTo(const BeginFrameArgs& args, ::std::ostream* os);
  55. // Allow "EXPECT_EQ(ack1, ack2);"
  56. bool operator==(const BeginFrameAck& lhs, const BeginFrameAck& rhs);
  57. // Allow gtest to pretty print BeginFrameAcks.
  58. ::std::ostream& operator<<(::std::ostream& os, const BeginFrameAck& ack);
  59. void PrintTo(const BeginFrameAck& ack, ::std::ostream* os);
  60. } // namespace viz
  61. #endif // COMPONENTS_VIZ_TEST_BEGIN_FRAME_ARGS_TEST_H_