mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1201997
- Part 3 - Make internally used methods private. r=froydn
This commit is contained in:
parent
6381b45f6d
commit
9dca1c4f11
@ -140,11 +140,6 @@ public:
|
||||
*/
|
||||
void* ObjectAt(int aIndex) const;
|
||||
|
||||
/**
|
||||
* Remove all items from container without destroying them.
|
||||
*/
|
||||
void Empty();
|
||||
|
||||
/**
|
||||
* Remove and delete all items from container.
|
||||
* Deletes are handled by the deallocator nsDequeFunctor
|
||||
@ -161,8 +156,6 @@ public:
|
||||
*/
|
||||
void ForEach(nsDequeFunctor& aFunctor) const;
|
||||
|
||||
void SetDeallocator(nsDequeFunctor* aDeallocator);
|
||||
|
||||
size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
|
||||
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
|
||||
|
||||
@ -192,5 +185,11 @@ private:
|
||||
nsDeque& operator=(const nsDeque& aOther);
|
||||
|
||||
bool GrowCapacity();
|
||||
void SetDeallocator(nsDequeFunctor* aDeallocator);
|
||||
|
||||
/**
|
||||
* Remove all items from container without destroying them.
|
||||
*/
|
||||
void Empty();
|
||||
};
|
||||
#endif
|
||||
|
@ -67,7 +67,7 @@ namespace TestNsDeque {
|
||||
|
||||
using namespace TestNsDeque;
|
||||
|
||||
TEST(NsDeque, OriginalTest)
|
||||
TEST(NsDeque, OriginalTest)
|
||||
{
|
||||
const int size = 200;
|
||||
int ints[size];
|
||||
@ -181,8 +181,6 @@ TEST(NsDeque, OriginalFlaw)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
TEST(NsDeque, TestObjectAt)
|
||||
{
|
||||
nsDeque d;
|
||||
@ -279,27 +277,11 @@ TEST(NsDeque,TestEmpty)
|
||||
EXPECT_EQ(nullptr, d.ObjectAt(0)) << "Invalid operation should return nullptr";
|
||||
}
|
||||
|
||||
TEST(NsDeque,TestEmptyMethod)
|
||||
TEST(NsDeque,TestEraseMethod)
|
||||
{
|
||||
nsDeque d;
|
||||
size_t numberOfEntries = 8;
|
||||
|
||||
// Fill it up before calling Empty
|
||||
for (size_t i = 0; i < numberOfEntries; i++) {
|
||||
d.Push((void*)0xAA);
|
||||
}
|
||||
|
||||
// Call empty
|
||||
d.Empty();
|
||||
|
||||
// Now check it again.
|
||||
EXPECT_EQ(0, d.GetSize()) <<"Size should be 0";
|
||||
EXPECT_EQ(nullptr, d.Pop()) <<"Invalid operation should return nullptr";
|
||||
EXPECT_EQ(nullptr, d.PopFront()) << "Invalid operation should return nullptr";
|
||||
EXPECT_EQ(nullptr, d.Peek()) << "Invalid operation should return nullptr";
|
||||
EXPECT_EQ(nullptr, d.PeekFront()) <<"Invalid operation should return nullptr";
|
||||
EXPECT_EQ(nullptr, d.ObjectAt(0)) << "Invalid operation should return nullptr";
|
||||
|
||||
// Fill it up before calling Erase
|
||||
for (size_t i = 0; i < numberOfEntries; i++) {
|
||||
d.Push((void*)0xAA);
|
||||
@ -343,35 +325,6 @@ TEST(NsDeque,TestEraseShouldCallDeallocator)
|
||||
for (size_t i=0; i < NumTestValues; i++)
|
||||
{
|
||||
EXPECT_EQ(-1, *(testArray[i])) << "Erase should call deallocator: " << *(testArray[i]);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(NsDeque,TestEmptyShouldNotCallDeallocator)
|
||||
{
|
||||
nsDeque d(new Deallocator());
|
||||
const int NumTestValues = 8;
|
||||
|
||||
int* testArray[NumTestValues];
|
||||
for (size_t i=0; i < NumTestValues; i++)
|
||||
{
|
||||
testArray[i] = new int();
|
||||
*(testArray[i]) = i;
|
||||
d.Push((void*)testArray[i]);
|
||||
}
|
||||
|
||||
d.Empty();
|
||||
|
||||
// Now check it again.
|
||||
EXPECT_EQ(0, d.GetSize()) <<"Size should be 0";
|
||||
EXPECT_EQ(nullptr, d.Pop()) <<"Invalid operation should return nullptr";
|
||||
EXPECT_EQ(nullptr, d.PopFront()) << "Invalid operation should return nullptr";
|
||||
EXPECT_EQ(nullptr, d.Peek()) << "Invalid operation should return nullptr";
|
||||
EXPECT_EQ(nullptr, d.PeekFront()) <<"Invalid operation should return nullptr";
|
||||
EXPECT_EQ(nullptr, d.ObjectAt(0)) << "Invalid operation should return nullptr";
|
||||
|
||||
for (size_t i=0; i < NumTestValues; i++)
|
||||
{
|
||||
EXPECT_EQ(i, *(testArray[i])) << "Empty should not call deallocator";
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user