GrContextAbandonTest.cpp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Copyright 2016 Google Inc.
  3. *
  4. * Use of this source code is governed by a BSD-style license that can be
  5. * found in the LICENSE file.
  6. */
  7. #include "include/core/SkTypes.h"
  8. #include "tests/Test.h"
  9. #include "tools/gpu/GrContextFactory.h"
  10. using namespace sk_gpu_test;
  11. DEF_GPUTEST(GrContext_abandonContext, reporter, options) {
  12. for (int testType = 0; testType < 6; ++testType) {
  13. for (int i = 0; i < GrContextFactory::kContextTypeCnt; ++i) {
  14. GrContextFactory testFactory(options);
  15. GrContextFactory::ContextType ctxType = (GrContextFactory::ContextType) i;
  16. ContextInfo info = testFactory.getContextInfo(ctxType);
  17. if (GrContext* context = info.grContext()) {
  18. switch (testType) {
  19. case 0:
  20. context->abandonContext();
  21. break;
  22. case 1:
  23. context->releaseResourcesAndAbandonContext();
  24. break;
  25. case 2:
  26. context->abandonContext();
  27. context->abandonContext();
  28. break;
  29. case 3:
  30. context->abandonContext();
  31. context->releaseResourcesAndAbandonContext();
  32. break;
  33. case 4:
  34. context->releaseResourcesAndAbandonContext();
  35. context->abandonContext();
  36. break;
  37. case 5:
  38. context->releaseResourcesAndAbandonContext();
  39. context->releaseResourcesAndAbandonContext();
  40. break;
  41. }
  42. }
  43. }
  44. }
  45. }