Home | History | Annotate | Download | only in tests

Lines Matching refs:Reporter

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