NativeWindow.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Copyright 2019 The Android Open Source Project
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #pragma once
  17. #include <gmock/gmock.h>
  18. #include <system/window.h>
  19. #include <ui/ANativeObjectBase.h>
  20. #include <ui/GraphicTypes.h>
  21. #include <ui/PixelFormat.h>
  22. namespace android::compositionengine::mock {
  23. /* ------------------------------------------------------------------------
  24. * Mock NativeWindow
  25. *
  26. * An intentionally simplified Mock which implements a minimal subset of the full
  27. * ANativeWindow interface.
  28. */
  29. class NativeWindow : public ANativeObjectBase<ANativeWindow, NativeWindow, RefBase> {
  30. public:
  31. NativeWindow();
  32. ~NativeWindow();
  33. MOCK_METHOD1(setSwapInterval, int(int));
  34. MOCK_METHOD2(dequeueBuffer, int(struct ANativeWindowBuffer**, int*));
  35. MOCK_METHOD2(cancelBuffer, int(struct ANativeWindowBuffer*, int));
  36. MOCK_METHOD2(queueBuffer, int(struct ANativeWindowBuffer*, int));
  37. MOCK_CONST_METHOD2(query, int(int, int*));
  38. MOCK_METHOD1(connect, int(int));
  39. MOCK_METHOD1(disconnect, int(int));
  40. MOCK_METHOD1(lockBuffer_DEPRECATED, int(struct ANativeWindowBuffer*));
  41. MOCK_METHOD1(setBuffersFormat, int(PixelFormat));
  42. MOCK_METHOD1(setBuffersDataSpace, int(ui::Dataspace));
  43. MOCK_METHOD1(setUsage, int(uint64_t));
  44. };
  45. } // namespace android::compositionengine::mock