9#include "gtest/gtest.h"
13TEST(AXPlatformUniqueIdTest, IdsAreUnique) {
15 EXPECT_FALSE(id1 == id2);
16 EXPECT_GT(id2.
Get(), id1.
Get());
34TEST(AXPlatformUniqueIdTest, UnassignedIdsAreReused) {
39 std::unique_ptr<AXTestSmallBankUniqueId> ids[
kMaxId];
42 ids[
i] = std::make_unique<AXTestSmallBankUniqueId>();
45 static int kIdToReplace = 10;
46 int32_t expected_id = ids[kIdToReplace]->Get();
49 ids[kIdToReplace] =
nullptr;
50 ids[kIdToReplace] = std::make_unique<AXTestSmallBankUniqueId>();
53 EXPECT_EQ(ids[kIdToReplace]->
Get(), expected_id);
56TEST(AXPlatformUniqueIdTest, DoesCreateCorrectId) {
57 constexpr int kLargerThanMaxId =
kMaxId * 2;
58 std::unique_ptr<AXUniqueId> ids[kLargerThanMaxId];
60 for (
int i = 0;
i < kLargerThanMaxId;
i++) {
61 ids[
i] = std::make_unique<AXUniqueId>();
63 for (
int i = 0;
i < kLargerThanMaxId;
i++) {
64 ids[
i].reset(
nullptr);
68 std::unique_ptr<AXTestSmallBankUniqueId> unique_id =
69 std::make_unique<AXTestSmallBankUniqueId>();
71 EXPECT_LE(unique_id->Get(),
kMaxId);
~AXTestSmallBankUniqueId() override
AXTestSmallBankUniqueId()
const GrXPFactory * Get(SkBlendMode mode)
TEST(AXEnumUtilTest, Event)
static const int32_t kMaxId
#define BASE_DISALLOW_COPY_AND_ASSIGN(TypeName)