• Home
  • Raw
  • Download

Lines Matching refs:reporter

35 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheCache, reporter, ctxInfo) {  in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()  argument
79 REPORTER_ASSERT(reporter, curCacheSize <= maxCacheSize); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
94 DEF_GPUTEST_FOR_CONTEXTS(ResourceCacheStencilBuffers, &is_rendering_and_not_angle_es3, reporter,
119 REPORTER_ASSERT(reporter,
130 REPORTER_ASSERT(reporter,
147 REPORTER_ASSERT(reporter,
169 REPORTER_ASSERT(reporter,
180 REPORTER_ASSERT(reporter,
198 REPORTER_ASSERT(reporter,
208 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheWrappedResources, reporter, ctxInfo) { in DEF_GPUTEST_FOR_RENDERING_CONTEXTS() argument
243 REPORTER_ASSERT(reporter, borrowed != nullptr && adopted != nullptr); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
256 REPORTER_ASSERT(reporter, borrowedIsAlive); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
257 REPORTER_ASSERT(reporter, !adoptedIsAlive); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
379 static void test_no_key(skiatest::Reporter* reporter) { in test_no_key() argument
394 REPORTER_ASSERT(reporter, 4 == TestResource::NumAlive()); in test_no_key()
395 REPORTER_ASSERT(reporter, 4 == cache->getResourceCount()); in test_no_key()
396 REPORTER_ASSERT(reporter, a->gpuMemorySize() + b->gpuMemorySize() + c->gpuMemorySize() + in test_no_key()
401 REPORTER_ASSERT(reporter, 4 == TestResource::NumAlive()); in test_no_key()
406 REPORTER_ASSERT(reporter, 3 == TestResource::NumAlive()); in test_no_key()
407 REPORTER_ASSERT(reporter, 3 == cache->getResourceCount()); in test_no_key()
408 REPORTER_ASSERT(reporter, b->gpuMemorySize() + c->gpuMemorySize() + d->gpuMemorySize() == in test_no_key()
412 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive()); in test_no_key()
413 REPORTER_ASSERT(reporter, 2 == cache->getResourceCount()); in test_no_key()
414 REPORTER_ASSERT(reporter, b->gpuMemorySize() + d->gpuMemorySize() == in test_no_key()
418 REPORTER_ASSERT(reporter, 1 == TestResource::NumAlive()); in test_no_key()
419 REPORTER_ASSERT(reporter, 1 == cache->getResourceCount()); in test_no_key()
420 REPORTER_ASSERT(reporter, b->gpuMemorySize() == cache->getResourceBytes()); in test_no_key()
423 REPORTER_ASSERT(reporter, 0 == TestResource::NumAlive()); in test_no_key()
424 REPORTER_ASSERT(reporter, 0 == cache->getResourceCount()); in test_no_key()
425 REPORTER_ASSERT(reporter, 0 == cache->getResourceBytes()); in test_no_key()
436 static void test_budgeting(skiatest::Reporter* reporter) { in test_budgeting() argument
462 REPORTER_ASSERT(reporter, wrappedViaKey != nullptr); in test_budgeting()
468 REPORTER_ASSERT(reporter, 4 == cache->getResourceCount()); in test_budgeting()
469 REPORTER_ASSERT(reporter, scratch->gpuMemorySize() + unique->gpuMemorySize() + in test_budgeting()
472 REPORTER_ASSERT(reporter, 2 == cache->getBudgetedResourceCount()); in test_budgeting()
473 REPORTER_ASSERT(reporter, scratch->gpuMemorySize() + unique->gpuMemorySize() == in test_budgeting()
475 REPORTER_ASSERT(reporter, 0 == cache->getPurgeableBytes()); in test_budgeting()
479 REPORTER_ASSERT(reporter, 4 == cache->getResourceCount()); in test_budgeting()
480 REPORTER_ASSERT(reporter, scratch->gpuMemorySize() + unique->gpuMemorySize() + in test_budgeting()
483 REPORTER_ASSERT(reporter, 2 == cache->getBudgetedResourceCount()); in test_budgeting()
484 REPORTER_ASSERT(reporter, scratch->gpuMemorySize() + unique->gpuMemorySize() == in test_budgeting()
486 REPORTER_ASSERT(reporter, 0 == cache->getPurgeableBytes()); in test_budgeting()
490 REPORTER_ASSERT(reporter, 3 == cache->getResourceCount()); in test_budgeting()
491 REPORTER_ASSERT(reporter, scratch->gpuMemorySize() + unique->gpuMemorySize() + in test_budgeting()
493 REPORTER_ASSERT(reporter, 0 == cache->getPurgeableBytes()); in test_budgeting()
499 REPORTER_ASSERT(reporter, 11 == cache->getPurgeableBytes()); in test_budgeting()
501 REPORTER_ASSERT(reporter, 3 == cache->getResourceCount()); in test_budgeting()
502 REPORTER_ASSERT(reporter, scratch->gpuMemorySize() + wrapped->gpuMemorySize() + in test_budgeting()
504 REPORTER_ASSERT(reporter, 1 == cache->getBudgetedResourceCount()); in test_budgeting()
505 REPORTER_ASSERT(reporter, scratch->gpuMemorySize() == cache->getBudgetedResourceBytes()); in test_budgeting()
506 REPORTER_ASSERT(reporter, 0 == cache->getPurgeableBytes()); in test_budgeting()
509 REPORTER_ASSERT(reporter, 12 == cache->getPurgeableBytes()); in test_budgeting()
511 REPORTER_ASSERT(reporter, 2 == cache->getResourceCount()); in test_budgeting()
512 REPORTER_ASSERT(reporter, unbudgeted->gpuMemorySize() + wrapped->gpuMemorySize() == in test_budgeting()
514 REPORTER_ASSERT(reporter, 0 == cache->getBudgetedResourceCount()); in test_budgeting()
515 REPORTER_ASSERT(reporter, 0 == cache->getBudgetedResourceBytes()); in test_budgeting()
516 REPORTER_ASSERT(reporter, 0 == cache->getPurgeableBytes()); in test_budgeting()
519 REPORTER_ASSERT(reporter, 1 == cache->getResourceCount()); in test_budgeting()
520 REPORTER_ASSERT(reporter, unbudgeted->gpuMemorySize() == cache->getResourceBytes()); in test_budgeting()
521 REPORTER_ASSERT(reporter, 0 == cache->getBudgetedResourceCount()); in test_budgeting()
522 REPORTER_ASSERT(reporter, 0 == cache->getBudgetedResourceBytes()); in test_budgeting()
523 REPORTER_ASSERT(reporter, 0 == cache->getPurgeableBytes()); in test_budgeting()
526 REPORTER_ASSERT(reporter, 0 == cache->getResourceCount()); in test_budgeting()
527 REPORTER_ASSERT(reporter, 0 == cache->getResourceBytes()); in test_budgeting()
528 REPORTER_ASSERT(reporter, 0 == cache->getBudgetedResourceCount()); in test_budgeting()
529 REPORTER_ASSERT(reporter, 0 == cache->getBudgetedResourceBytes()); in test_budgeting()
530 REPORTER_ASSERT(reporter, 0 == cache->getPurgeableBytes()); in test_budgeting()
533 static void test_unbudgeted(skiatest::Reporter* reporter) { in test_unbudgeted() argument
552 REPORTER_ASSERT(reporter, 1 == cache->getResourceCount()); in test_unbudgeted()
553 REPORTER_ASSERT(reporter, 10 == cache->getResourceBytes()); in test_unbudgeted()
554 REPORTER_ASSERT(reporter, 1 == cache->getBudgetedResourceCount()); in test_unbudgeted()
555 REPORTER_ASSERT(reporter, 10 == cache->getBudgetedResourceBytes()); in test_unbudgeted()
556 REPORTER_ASSERT(reporter, 10 == cache->getPurgeableBytes()); in test_unbudgeted()
562 REPORTER_ASSERT(reporter, 2 == cache->getResourceCount()); in test_unbudgeted()
563 REPORTER_ASSERT(reporter, 21 == cache->getResourceBytes()); in test_unbudgeted()
564 REPORTER_ASSERT(reporter, 2 == cache->getBudgetedResourceCount()); in test_unbudgeted()
565 REPORTER_ASSERT(reporter, 21 == cache->getBudgetedResourceBytes()); in test_unbudgeted()
566 REPORTER_ASSERT(reporter, 21 == cache->getPurgeableBytes()); in test_unbudgeted()
570 REPORTER_ASSERT(reporter, 3 == cache->getResourceCount()); in test_unbudgeted()
571 REPORTER_ASSERT(reporter, 21 + large == cache->getResourceBytes()); in test_unbudgeted()
572 REPORTER_ASSERT(reporter, 2 == cache->getBudgetedResourceCount()); in test_unbudgeted()
573 REPORTER_ASSERT(reporter, 21 == cache->getBudgetedResourceBytes()); in test_unbudgeted()
574 REPORTER_ASSERT(reporter, 21 == cache->getPurgeableBytes()); in test_unbudgeted()
577 REPORTER_ASSERT(reporter, 2 == cache->getResourceCount()); in test_unbudgeted()
578 REPORTER_ASSERT(reporter, 21 == cache->getResourceBytes()); in test_unbudgeted()
579 REPORTER_ASSERT(reporter, 2 == cache->getBudgetedResourceCount()); in test_unbudgeted()
580 REPORTER_ASSERT(reporter, 21 == cache->getBudgetedResourceBytes()); in test_unbudgeted()
581 REPORTER_ASSERT(reporter, 21 == cache->getPurgeableBytes()); in test_unbudgeted()
584 REPORTER_ASSERT(reporter, 3 == cache->getResourceCount()); in test_unbudgeted()
585 REPORTER_ASSERT(reporter, 21 + large == cache->getResourceBytes()); in test_unbudgeted()
586 REPORTER_ASSERT(reporter, 2 == cache->getBudgetedResourceCount()); in test_unbudgeted()
587 REPORTER_ASSERT(reporter, 21 == cache->getBudgetedResourceBytes()); in test_unbudgeted()
588 REPORTER_ASSERT(reporter, 21 == cache->getPurgeableBytes()); in test_unbudgeted()
591 REPORTER_ASSERT(reporter, 2 == cache->getResourceCount()); in test_unbudgeted()
592 REPORTER_ASSERT(reporter, 21 == cache->getResourceBytes()); in test_unbudgeted()
593 REPORTER_ASSERT(reporter, 2 == cache->getBudgetedResourceCount()); in test_unbudgeted()
594 REPORTER_ASSERT(reporter, 21 == cache->getBudgetedResourceBytes()); in test_unbudgeted()
595 REPORTER_ASSERT(reporter, 21 == cache->getPurgeableBytes()); in test_unbudgeted()
598 REPORTER_ASSERT(reporter, 0 == cache->getResourceCount()); in test_unbudgeted()
599 REPORTER_ASSERT(reporter, 0 == cache->getResourceBytes()); in test_unbudgeted()
600 REPORTER_ASSERT(reporter, 0 == cache->getBudgetedResourceCount()); in test_unbudgeted()
601 REPORTER_ASSERT(reporter, 0 == cache->getBudgetedResourceBytes()); in test_unbudgeted()
602 REPORTER_ASSERT(reporter, 0 == cache->getPurgeableBytes()); in test_unbudgeted()
606 void test_unbudgeted_to_scratch(skiatest::Reporter* reporter);
607 /*static*/ void test_unbudgeted_to_scratch(skiatest::Reporter* reporter) { in test_unbudgeted_to_scratch() argument
621 REPORTER_ASSERT(reporter, resource->resourcePriv().getScratchKey() == key); in test_unbudgeted_to_scratch()
622 REPORTER_ASSERT(reporter, !resource->cacheAccess().isScratch()); in test_unbudgeted_to_scratch()
623 REPORTER_ASSERT(reporter, SkBudgeted::kNo == resource->resourcePriv().isBudgeted()); in test_unbudgeted_to_scratch()
624 …REPORTER_ASSERT(reporter, nullptr == cache->findAndRefScratchResource(key, TestResource::kDefaultS… in test_unbudgeted_to_scratch()
625 REPORTER_ASSERT(reporter, 1 == cache->getResourceCount()); in test_unbudgeted_to_scratch()
626 REPORTER_ASSERT(reporter, size == cache->getResourceBytes()); in test_unbudgeted_to_scratch()
627 REPORTER_ASSERT(reporter, 0 == cache->getBudgetedResourceCount()); in test_unbudgeted_to_scratch()
628 REPORTER_ASSERT(reporter, 0 == cache->getBudgetedResourceBytes()); in test_unbudgeted_to_scratch()
629 REPORTER_ASSERT(reporter, 0 == cache->getPurgeableBytes()); in test_unbudgeted_to_scratch()
633 REPORTER_ASSERT(reporter, 1 == cache->getResourceCount()); in test_unbudgeted_to_scratch()
634 REPORTER_ASSERT(reporter, size == cache->getResourceBytes()); in test_unbudgeted_to_scratch()
635 REPORTER_ASSERT(reporter, 1 == cache->getBudgetedResourceCount()); in test_unbudgeted_to_scratch()
636 REPORTER_ASSERT(reporter, size == cache->getBudgetedResourceBytes()); in test_unbudgeted_to_scratch()
637 REPORTER_ASSERT(reporter, size == cache->getPurgeableBytes()); in test_unbudgeted_to_scratch()
639 REPORTER_ASSERT(reporter, resource); in test_unbudgeted_to_scratch()
640 REPORTER_ASSERT(reporter, resource->resourcePriv().getScratchKey() == key); in test_unbudgeted_to_scratch()
641 REPORTER_ASSERT(reporter, resource->cacheAccess().isScratch()); in test_unbudgeted_to_scratch()
642 REPORTER_ASSERT(reporter, SkBudgeted::kYes == resource->resourcePriv().isBudgeted()); in test_unbudgeted_to_scratch()
651 REPORTER_ASSERT(reporter, 1 == cache->getResourceCount()); in test_unbudgeted_to_scratch()
652 REPORTER_ASSERT(reporter, size == cache->getResourceBytes()); in test_unbudgeted_to_scratch()
653 REPORTER_ASSERT(reporter, 1 == cache->getBudgetedResourceCount()); in test_unbudgeted_to_scratch()
654 REPORTER_ASSERT(reporter, size == cache->getBudgetedResourceBytes()); in test_unbudgeted_to_scratch()
655 REPORTER_ASSERT(reporter, 0 == cache->getPurgeableBytes()); in test_unbudgeted_to_scratch()
656 REPORTER_ASSERT(reporter, !resource->resourcePriv().getScratchKey().isValid()); in test_unbudgeted_to_scratch()
657 REPORTER_ASSERT(reporter, !resource->cacheAccess().isScratch()); in test_unbudgeted_to_scratch()
658 REPORTER_ASSERT(reporter, SkBudgeted::kYes == resource->resourcePriv().isBudgeted()); in test_unbudgeted_to_scratch()
662 REPORTER_ASSERT(reporter, 0 == cache->getResourceCount()); in test_unbudgeted_to_scratch()
663 REPORTER_ASSERT(reporter, 0 == cache->getResourceBytes()); in test_unbudgeted_to_scratch()
664 REPORTER_ASSERT(reporter, 0 == cache->getBudgetedResourceCount()); in test_unbudgeted_to_scratch()
665 REPORTER_ASSERT(reporter, 0 == cache->getBudgetedResourceBytes()); in test_unbudgeted_to_scratch()
666 REPORTER_ASSERT(reporter, 0 == cache->getPurgeableBytes()); in test_unbudgeted_to_scratch()
671 static void test_duplicate_scratch_key(skiatest::Reporter* reporter) { in test_duplicate_scratch_key() argument
688 …REPORTER_ASSERT(reporter, nullptr == cache->findAndRefScratchResource(scratchKey1, TestResource::k… in test_duplicate_scratch_key()
694 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive()); in test_duplicate_scratch_key()
695 SkDEBUGCODE(REPORTER_ASSERT(reporter, 2 == cache->countScratchEntriesForKey(scratchKey));) in test_duplicate_scratch_key()
696 REPORTER_ASSERT(reporter, 2 == cache->getResourceCount()); in test_duplicate_scratch_key()
697 REPORTER_ASSERT(reporter, a->gpuMemorySize() + b->gpuMemorySize() == in test_duplicate_scratch_key()
702 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive()); in test_duplicate_scratch_key()
703 REPORTER_ASSERT(reporter, 2 == cache->getResourceCount()); in test_duplicate_scratch_key()
708 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive()); in test_duplicate_scratch_key()
709 SkDEBUGCODE(REPORTER_ASSERT(reporter, 2 == cache->countScratchEntriesForKey(scratchKey));) in test_duplicate_scratch_key()
713 REPORTER_ASSERT(reporter, 0 == TestResource::NumAlive()); in test_duplicate_scratch_key()
714 REPORTER_ASSERT(reporter, 0 == cache->getResourceCount()); in test_duplicate_scratch_key()
715 SkDEBUGCODE(REPORTER_ASSERT(reporter, 0 == cache->countScratchEntriesForKey(scratchKey));) in test_duplicate_scratch_key()
718 static void test_remove_scratch_key(skiatest::Reporter* reporter) { in test_remove_scratch_key() argument
735 …REPORTER_ASSERT(reporter, cache->findAndRefScratchResource(scratchKey, TestResource::kDefaultSize,… in test_remove_scratch_key()
739 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive()); in test_remove_scratch_key()
740 SkDEBUGCODE(REPORTER_ASSERT(reporter, 2 == cache->countScratchEntriesForKey(scratchKey));) in test_remove_scratch_key()
741 REPORTER_ASSERT(reporter, 2 == cache->getResourceCount()); in test_remove_scratch_key()
748 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive()); in test_remove_scratch_key()
749 SkDEBUGCODE(REPORTER_ASSERT(reporter, 1 == cache->countScratchEntriesForKey(scratchKey));) in test_remove_scratch_key()
750 REPORTER_ASSERT(reporter, 2 == cache->getResourceCount()); in test_remove_scratch_key()
754 REPORTER_ASSERT(reporter, 1 == TestResource::NumAlive()); in test_remove_scratch_key()
755 SkDEBUGCODE(REPORTER_ASSERT(reporter, 1 == cache->countScratchEntriesForKey(scratchKey));) in test_remove_scratch_key()
756 REPORTER_ASSERT(reporter, 1 == cache->getResourceCount()); in test_remove_scratch_key()
761 REPORTER_ASSERT(reporter, 1 == TestResource::NumAlive()); in test_remove_scratch_key()
762 SkDEBUGCODE(REPORTER_ASSERT(reporter, 0 == cache->countScratchEntriesForKey(scratchKey));) in test_remove_scratch_key()
763 REPORTER_ASSERT(reporter, 1 == cache->getResourceCount()); in test_remove_scratch_key()
767 REPORTER_ASSERT(reporter, 1 == TestResource::NumAlive()); in test_remove_scratch_key()
768 SkDEBUGCODE(REPORTER_ASSERT(reporter, 0 == cache->countScratchEntriesForKey(scratchKey));) in test_remove_scratch_key()
769 REPORTER_ASSERT(reporter, 1 == cache->getResourceCount()); in test_remove_scratch_key()
772 REPORTER_ASSERT(reporter, 0 == TestResource::NumAlive()); in test_remove_scratch_key()
773 SkDEBUGCODE(REPORTER_ASSERT(reporter, 0 == cache->countScratchEntriesForKey(scratchKey));) in test_remove_scratch_key()
774 REPORTER_ASSERT(reporter, 0 == cache->getResourceCount()); in test_remove_scratch_key()
777 static void test_scratch_key_consistency(skiatest::Reporter* reporter) { in test_scratch_key_consistency() argument
796 REPORTER_ASSERT(reporter, scratchKey1.size() == TestResource::ExpectedScratchKeySize()); in test_scratch_key_consistency()
797 REPORTER_ASSERT(reporter, scratchKey1 != scratchKey2); in test_scratch_key_consistency()
798 REPORTER_ASSERT(reporter, scratchKey2 != scratchKey1); in test_scratch_key_consistency()
800 REPORTER_ASSERT(reporter, scratchKey.size() == TestResource::ExpectedScratchKeySize()); in test_scratch_key_consistency()
801 REPORTER_ASSERT(reporter, scratchKey1 == scratchKey); in test_scratch_key_consistency()
802 REPORTER_ASSERT(reporter, scratchKey == scratchKey1); in test_scratch_key_consistency()
803 REPORTER_ASSERT(reporter, scratchKey2 != scratchKey); in test_scratch_key_consistency()
804 REPORTER_ASSERT(reporter, scratchKey != scratchKey2); in test_scratch_key_consistency()
806 REPORTER_ASSERT(reporter, scratchKey.size() == TestResource::ExpectedScratchKeySize()); in test_scratch_key_consistency()
807 REPORTER_ASSERT(reporter, scratchKey1 != scratchKey); in test_scratch_key_consistency()
808 REPORTER_ASSERT(reporter, scratchKey != scratchKey1); in test_scratch_key_consistency()
809 REPORTER_ASSERT(reporter, scratchKey2 == scratchKey); in test_scratch_key_consistency()
810 REPORTER_ASSERT(reporter, scratchKey == scratchKey2); in test_scratch_key_consistency()
815 …REPORTER_ASSERT(reporter, cache->findAndRefScratchResource(scratchKey, TestResource::kDefaultSize,… in test_scratch_key_consistency()
820 REPORTER_ASSERT(reporter, find != nullptr); in test_scratch_key_consistency()
825 REPORTER_ASSERT(reporter, find != nullptr); in test_scratch_key_consistency()
826 REPORTER_ASSERT(reporter, find == a || find == b); in test_scratch_key_consistency()
829 REPORTER_ASSERT(reporter, find2 != nullptr); in test_scratch_key_consistency()
830 REPORTER_ASSERT(reporter, find2 == a || find2 == b); in test_scratch_key_consistency()
831 REPORTER_ASSERT(reporter, find2 != find); in test_scratch_key_consistency()
836 static void test_duplicate_unique_key(skiatest::Reporter* reporter) { in test_duplicate_unique_key() argument
850 REPORTER_ASSERT(reporter, a == cache->findAndRefUniqueResource(key)); in test_duplicate_unique_key()
855 REPORTER_ASSERT(reporter, a == cache->findAndRefUniqueResource(key)); in test_duplicate_unique_key()
857 REPORTER_ASSERT(reporter, 1 == cache->getResourceCount()); in test_duplicate_unique_key()
858 REPORTER_ASSERT(reporter, a->gpuMemorySize() == cache->getResourceBytes()); in test_duplicate_unique_key()
859 REPORTER_ASSERT(reporter, 1 == TestResource::NumAlive()); in test_duplicate_unique_key()
865 REPORTER_ASSERT(reporter, b == cache->findAndRefUniqueResource(key)); in test_duplicate_unique_key()
869 REPORTER_ASSERT(reporter, 2 == cache->getResourceCount()); in test_duplicate_unique_key()
870 REPORTER_ASSERT(reporter, a->gpuMemorySize() + b->gpuMemorySize() == cache->getResourceBytes()); in test_duplicate_unique_key()
871 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive()); in test_duplicate_unique_key()
875 REPORTER_ASSERT(reporter, 1 == cache->getResourceCount()); in test_duplicate_unique_key()
876 REPORTER_ASSERT(reporter, b->gpuMemorySize() == cache->getResourceBytes()); in test_duplicate_unique_key()
877 REPORTER_ASSERT(reporter, 1 == TestResource::NumAlive()); in test_duplicate_unique_key()
887 REPORTER_ASSERT(reporter, 2 == cache->getResourceCount()); in test_duplicate_unique_key()
888 REPORTER_ASSERT(reporter, b->gpuMemorySize() + c->gpuMemorySize() == cache->getResourceBytes()); in test_duplicate_unique_key()
889 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive()); in test_duplicate_unique_key()
892 REPORTER_ASSERT(reporter, 1 == cache->getResourceCount()); in test_duplicate_unique_key()
893 REPORTER_ASSERT(reporter, c->gpuMemorySize() == cache->getResourceBytes()); in test_duplicate_unique_key()
894 REPORTER_ASSERT(reporter, 1 == TestResource::NumAlive()); in test_duplicate_unique_key()
898 REPORTER_ASSERT(reporter, 1 == cache->getResourceCount()); in test_duplicate_unique_key()
899 REPORTER_ASSERT(reporter, c->gpuMemorySize() == cache->getResourceBytes()); in test_duplicate_unique_key()
900 REPORTER_ASSERT(reporter, 1 == TestResource::NumAlive()); in test_duplicate_unique_key()
904 REPORTER_ASSERT(reporter, 1 == cache->getResourceCount()); in test_duplicate_unique_key()
905 REPORTER_ASSERT(reporter, c->gpuMemorySize() == cache->getResourceBytes()); in test_duplicate_unique_key()
906 REPORTER_ASSERT(reporter, 1 == TestResource::NumAlive()); in test_duplicate_unique_key()
909 REPORTER_ASSERT(reporter, c == cache->findAndRefUniqueResource(key)); in test_duplicate_unique_key()
912 REPORTER_ASSERT(reporter, 0 == cache->getResourceCount()); in test_duplicate_unique_key()
913 REPORTER_ASSERT(reporter, 0 == cache->getResourceBytes()); in test_duplicate_unique_key()
914 REPORTER_ASSERT(reporter, 0 == TestResource::NumAlive()); in test_duplicate_unique_key()
928 REPORTER_ASSERT(reporter, *(int*) d2->getUniqueKey().getCustomData()->data() == 4132); in test_duplicate_unique_key()
931 static void test_purge_invalidated(skiatest::Reporter* reporter) { in test_purge_invalidated() argument
953 REPORTER_ASSERT(reporter, cache->hasUniqueKey(key1)); in test_purge_invalidated()
954 REPORTER_ASSERT(reporter, cache->hasUniqueKey(key2)); in test_purge_invalidated()
955 REPORTER_ASSERT(reporter, cache->hasUniqueKey(key3)); in test_purge_invalidated()
956 REPORTER_ASSERT(reporter, 3 == TestResource::NumAlive()); in test_purge_invalidated()
966 REPORTER_ASSERT(reporter, !cache->hasUniqueKey(key1)); in test_purge_invalidated()
967 REPORTER_ASSERT(reporter, !cache->hasUniqueKey(key2)); in test_purge_invalidated()
968 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive()); in test_purge_invalidated()
969 REPORTER_ASSERT(reporter, cache->hasUniqueKey(key3)); in test_purge_invalidated()
975 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive()); in test_purge_invalidated()
976 REPORTER_ASSERT(reporter, !cache->hasUniqueKey(key3)); in test_purge_invalidated()
980 REPORTER_ASSERT(reporter, 1 == TestResource::NumAlive()); in test_purge_invalidated()
986 REPORTER_ASSERT(reporter, scratch == c); in test_purge_invalidated()
992 REPORTER_ASSERT(reporter, 0 == TestResource::NumAlive()); in test_purge_invalidated()
993 REPORTER_ASSERT(reporter, 0 == cache->getResourceCount()); in test_purge_invalidated()
994 REPORTER_ASSERT(reporter, 0 == cache->getResourceBytes()); in test_purge_invalidated()
995 REPORTER_ASSERT(reporter, !scratch); in test_purge_invalidated()
999 static void test_cache_chained_purge(skiatest::Reporter* reporter) { in test_cache_chained_purge() argument
1017 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive()); in test_cache_chained_purge()
1022 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive()); in test_cache_chained_purge()
1025 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive()); in test_cache_chained_purge()
1029 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive()); in test_cache_chained_purge()
1032 REPORTER_ASSERT(reporter, 0 == TestResource::NumAlive()); in test_cache_chained_purge()
1035 static void test_resource_size_changed(skiatest::Reporter* reporter) { in test_resource_size_changed() argument
1054 REPORTER_ASSERT(reporter, 200 == cache->getResourceBytes()); in test_resource_size_changed()
1055 REPORTER_ASSERT(reporter, 2 == cache->getResourceCount()); in test_resource_size_changed()
1065 REPORTER_ASSERT(reporter, 250 == cache->getResourceBytes()); in test_resource_size_changed()
1066 REPORTER_ASSERT(reporter, 2 == cache->getResourceCount()); in test_resource_size_changed()
1085 REPORTER_ASSERT(reporter, 200 == cache->getResourceBytes()); in test_resource_size_changed()
1086 REPORTER_ASSERT(reporter, 2 == cache->getResourceCount()); in test_resource_size_changed()
1093 REPORTER_ASSERT(reporter, !cache->hasUniqueKey(key1)); in test_resource_size_changed()
1095 REPORTER_ASSERT(reporter, 201 == cache->getResourceBytes()); in test_resource_size_changed()
1096 REPORTER_ASSERT(reporter, 1 == cache->getResourceCount()); in test_resource_size_changed()
1100 static void test_timestamp_wrap(skiatest::Reporter* reporter) { in test_timestamp_wrap() argument
1152 REPORTER_ASSERT(reporter, nullptr == res); in test_timestamp_wrap()
1154 REPORTER_ASSERT(reporter, nullptr != res); in test_timestamp_wrap()
1165 static void test_flush(skiatest::Reporter* reporter) { in test_flush() argument
1189 REPORTER_ASSERT(reporter, kFlushCount - i - 1 == cache->getResourceCount()); in test_flush()
1194 REPORTER_ASSERT(reporter, !SkToBool(r)); in test_flush()
1199 REPORTER_ASSERT(reporter, 0 == cache->getResourceCount()); in test_flush()
1224 REPORTER_ASSERT(reporter, kFlushCount - i/2 - 1 == cache->getResourceCount()); in test_flush()
1235 REPORTER_ASSERT(reporter, kFlushCount >> 1 == cache->getResourceCount()); in test_flush()
1238 REPORTER_ASSERT(reporter, 0 == cache->getResourceCount()); in test_flush()
1243 REPORTER_ASSERT(reporter, 0 == cache->getResourceCount()); in test_flush()
1255 REPORTER_ASSERT(reporter, 10 == cache->getResourceCount()); in test_flush()
1259 REPORTER_ASSERT(reporter, 10 == cache->getResourceCount()); in test_flush()
1262 static void test_time_purge(skiatest::Reporter* reporter) { in test_time_purge() argument
1296 REPORTER_ASSERT(reporter, cnt - i - 1 == cache->getResourceCount()); in test_time_purge()
1301 REPORTER_ASSERT(reporter, !SkToBool(r)); in test_time_purge()
1306 REPORTER_ASSERT(reporter, 0 == cache->getResourceCount()); in test_time_purge()
1331 REPORTER_ASSERT(reporter, cnt - i / 2 - 1 == cache->getResourceCount()); in test_time_purge()
1338 REPORTER_ASSERT(reporter, cnt / 2 - i - 1 == cache->getResourceCount()); in test_time_purge()
1344 REPORTER_ASSERT(reporter, 0 == cache->getResourceCount()); in test_time_purge()
1356 REPORTER_ASSERT(reporter, 10 == cache->getResourceCount()); in test_time_purge()
1358 REPORTER_ASSERT(reporter, 10 == cache->getResourceCount()); in test_time_purge()
1360 REPORTER_ASSERT(reporter, 0 == cache->getResourceCount()); in test_time_purge()
1364 static void test_partial_purge(skiatest::Reporter* reporter) { in test_partial_purge() argument
1408 REPORTER_ASSERT(reporter, 5 == cache->getBudgetedResourceCount()); in test_partial_purge()
1409 REPORTER_ASSERT(reporter, 60 == cache->getBudgetedResourceBytes()); in test_partial_purge()
1410 REPORTER_ASSERT(reporter, 0 == cache->getPurgeableBytes()); in test_partial_purge()
1419 REPORTER_ASSERT(reporter, 5 == cache->getBudgetedResourceCount()); in test_partial_purge()
1420 REPORTER_ASSERT(reporter, 60 == cache->getBudgetedResourceBytes()); in test_partial_purge()
1421 REPORTER_ASSERT(reporter, 60 == cache->getPurgeableBytes()); in test_partial_purge()
1426 REPORTER_ASSERT(reporter, 3 == cache->getBudgetedResourceCount()); in test_partial_purge()
1427 REPORTER_ASSERT(reporter, 33 == cache->getBudgetedResourceBytes()); in test_partial_purge()
1432 REPORTER_ASSERT(reporter, 4 == cache->getBudgetedResourceCount()); in test_partial_purge()
1433 REPORTER_ASSERT(reporter, 47 == cache->getBudgetedResourceBytes()); in test_partial_purge()
1438 REPORTER_ASSERT(reporter, 0 == cache->getBudgetedResourceCount()); in test_partial_purge()
1439 REPORTER_ASSERT(reporter, 0 == cache->getBudgetedResourceBytes()); in test_partial_purge()
1444 REPORTER_ASSERT(reporter, 3 == cache->getBudgetedResourceCount()); in test_partial_purge()
1445 REPORTER_ASSERT(reporter, 37 == cache->getBudgetedResourceBytes()); in test_partial_purge()
1450 REPORTER_ASSERT(reporter, 0 == cache->getBudgetedResourceCount()); in test_partial_purge()
1451 REPORTER_ASSERT(reporter, 0 == cache->getBudgetedResourceBytes()); in test_partial_purge()
1457 REPORTER_ASSERT(reporter, 5 == cache->getBudgetedResourceCount()); in test_partial_purge()
1458 REPORTER_ASSERT(reporter, 60 == cache->getBudgetedResourceBytes()); in test_partial_purge()
1459 REPORTER_ASSERT(reporter, 60 == cache->getPurgeableBytes()); in test_partial_purge()
1466 REPORTER_ASSERT(reporter, 0 == cache->getBudgetedResourceCount()); in test_partial_purge()
1467 REPORTER_ASSERT(reporter, 0 == cache->getPurgeableBytes()); in test_partial_purge()
1472 static void test_large_resource_count(skiatest::Reporter* reporter) { in test_large_resource_count() argument
1500 REPORTER_ASSERT(reporter, TestResource::NumAlive() == 2 * kResourceCnt); in test_large_resource_count()
1501 REPORTER_ASSERT(reporter, cache->getPurgeableBytes() == 2 * kResourceCnt); in test_large_resource_count()
1502 REPORTER_ASSERT(reporter, cache->getBudgetedResourceBytes() == 2 * kResourceCnt); in test_large_resource_count()
1503 REPORTER_ASSERT(reporter, cache->getBudgetedResourceCount() == 2 * kResourceCnt); in test_large_resource_count()
1504 REPORTER_ASSERT(reporter, cache->getResourceBytes() == 2 * kResourceCnt); in test_large_resource_count()
1505 REPORTER_ASSERT(reporter, cache->getResourceCount() == 2 * kResourceCnt); in test_large_resource_count()
1511 REPORTER_ASSERT(reporter, cache->hasUniqueKey(key1)); in test_large_resource_count()
1512 REPORTER_ASSERT(reporter, cache->hasUniqueKey(key2)); in test_large_resource_count()
1516 REPORTER_ASSERT(reporter, TestResource::NumAlive() == 0); in test_large_resource_count()
1517 REPORTER_ASSERT(reporter, cache->getPurgeableBytes() == 0); in test_large_resource_count()
1518 REPORTER_ASSERT(reporter, cache->getBudgetedResourceBytes() == 0); in test_large_resource_count()
1519 REPORTER_ASSERT(reporter, cache->getBudgetedResourceCount() == 0); in test_large_resource_count()
1520 REPORTER_ASSERT(reporter, cache->getResourceBytes() == 0); in test_large_resource_count()
1521 REPORTER_ASSERT(reporter, cache->getResourceCount() == 0); in test_large_resource_count()
1528 REPORTER_ASSERT(reporter, !cache->hasUniqueKey(key1)); in test_large_resource_count()
1529 REPORTER_ASSERT(reporter, !cache->hasUniqueKey(key2)); in test_large_resource_count()
1533 static void test_custom_data(skiatest::Reporter* reporter) { in test_custom_data() argument
1539 REPORTER_ASSERT(reporter, *(int*) key1.getCustomData()->data() == 4132); in test_custom_data()
1540 REPORTER_ASSERT(reporter, key2.getCustomData() == nullptr); in test_custom_data()
1544 REPORTER_ASSERT(reporter, *(int*) key3.getCustomData()->data() == 4132); in test_custom_data()
1547 static void test_abandoned(skiatest::Reporter* reporter) { in test_abandoned() argument
1553 REPORTER_ASSERT(reporter, resource->wasDestroyed()); in test_abandoned()
1575 static void test_tags(skiatest::Reporter* reporter) { in test_tags() argument
1606 REPORTER_ASSERT(reporter, cache->countUniqueKeysWithTag(tagStr.c_str()) == i); in test_tags()
1611 DEF_GPUTEST(ResourceCacheMisc, reporter, factory) { in DEF_GPUTEST() argument
1613 test_no_key(reporter); in DEF_GPUTEST()
1614 test_budgeting(reporter); in DEF_GPUTEST()
1615 test_unbudgeted(reporter); in DEF_GPUTEST()
1616 test_unbudgeted_to_scratch(reporter); in DEF_GPUTEST()
1617 test_duplicate_unique_key(reporter); in DEF_GPUTEST()
1618 test_duplicate_scratch_key(reporter); in DEF_GPUTEST()
1619 test_remove_scratch_key(reporter); in DEF_GPUTEST()
1620 test_scratch_key_consistency(reporter); in DEF_GPUTEST()
1621 test_purge_invalidated(reporter); in DEF_GPUTEST()
1622 test_cache_chained_purge(reporter); in DEF_GPUTEST()
1623 test_resource_size_changed(reporter); in DEF_GPUTEST()
1624 test_timestamp_wrap(reporter); in DEF_GPUTEST()
1625 test_flush(reporter); in DEF_GPUTEST()
1626 test_time_purge(reporter); in DEF_GPUTEST()
1627 test_partial_purge(reporter); in DEF_GPUTEST()
1628 test_large_resource_count(reporter); in DEF_GPUTEST()
1629 test_custom_data(reporter); in DEF_GPUTEST()
1630 test_abandoned(reporter); in DEF_GPUTEST()
1631 test_tags(reporter); in DEF_GPUTEST()
1690 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GPUMemorySize, reporter, ctxInfo) { in DEF_GPUTEST_FOR_RENDERING_CONTEXTS() argument
1702 REPORTER_ASSERT(reporter, kSize*kSize*4 == size); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
1709 REPORTER_ASSERT(reporter, in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
1717 REPORTER_ASSERT(reporter, kSize*kSize*4 == size); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
1727 REPORTER_ASSERT(reporter, kSize*kSize*4+(kSize*kSize*4)/3 == size); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
1734 REPORTER_ASSERT(reporter, in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
1742 REPORTER_ASSERT(reporter, kSize*kSize*4+(kSize*kSize*4)/3 == size); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()