mock_display_client.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. #ifndef COMPONENTS_VIZ_TEST_MOCK_DISPLAY_CLIENT_H_
  5. #define COMPONENTS_VIZ_TEST_MOCK_DISPLAY_CLIENT_H_
  6. #include "build/build_config.h"
  7. #include "build/chromeos_buildflags.h"
  8. #include "gpu/command_buffer/common/context_result.h"
  9. #include "mojo/public/cpp/bindings/pending_receiver.h"
  10. #include "mojo/public/cpp/bindings/pending_remote.h"
  11. #include "mojo/public/cpp/bindings/receiver.h"
  12. #include "services/viz/privileged/mojom/compositing/display_private.mojom.h"
  13. #include "services/viz/privileged/mojom/compositing/frame_sink_manager.mojom.h"
  14. #include "testing/gmock/include/gmock/gmock.h"
  15. namespace viz {
  16. class MockDisplayClient : public mojom::DisplayClient {
  17. public:
  18. MockDisplayClient();
  19. MockDisplayClient(const MockDisplayClient&) = delete;
  20. MockDisplayClient& operator=(const MockDisplayClient&) = delete;
  21. ~MockDisplayClient() override;
  22. mojo::PendingRemote<mojom::DisplayClient> BindRemote();
  23. // mojom::DisplayClient implementation.
  24. #if BUILDFLAG(IS_APPLE)
  25. MOCK_METHOD1(OnDisplayReceivedCALayerParams, void(const gfx::CALayerParams&));
  26. #endif
  27. #if BUILDFLAG(IS_WIN)
  28. MOCK_METHOD1(CreateLayeredWindowUpdater,
  29. void(mojo::PendingReceiver<mojom::LayeredWindowUpdater>));
  30. #endif
  31. #if BUILDFLAG(IS_ANDROID)
  32. MOCK_METHOD1(DidCompleteSwapWithSize, void(const gfx::Size&));
  33. MOCK_METHOD1(OnContextCreationResult, void(gpu::ContextResult));
  34. MOCK_METHOD1(SetWideColorEnabled, void(bool enabled));
  35. MOCK_METHOD1(SetPreferredRefreshRate, void(float refresh_rate));
  36. #endif
  37. // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch
  38. // of lacros-chrome is complete.
  39. #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
  40. MOCK_METHOD1(DidCompleteSwapWithNewSize, void(const gfx::Size&));
  41. #endif
  42. private:
  43. mojo::Receiver<mojom::DisplayClient> receiver_{this};
  44. };
  45. } // namespace viz
  46. #endif // COMPONENTS_VIZ_TEST_MOCK_DISPLAY_CLIENT_H_