示例#1
0
static bool VerifyContents(const nsDeque& aDeque, const int* aContents, int aLength) {
  for (int i=0; i<aLength; ++i) {
    if (*(int*)aDeque.ObjectAt(i) != aContents[i]) {
      return false;
    }
  }
  return true;
}
示例#2
0
void CheckIfQueueEmpty(nsDeque& d)
{
  EXPECT_EQ(0u, 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(0u)) <<  "Invalid operation should return nullptr";
}
/**
 * This is a utilty method for ScanDocStructure, which finds a given
 * tag in the stack. The return value is meant to be used with
 * nsDeque::ObjectAt() on aTagStack.
 *
 * @param   aTag -- the ID of the tag we're seeking
 * @param   aTagStack -- the stack to be searched
 * @return  index position of tag in stack if found, otherwise kNotFound
 */
static int32_t
FindLastIndexOfTag(eHTMLTags aTag, nsDeque &aTagStack)
{
  int32_t theCount = aTagStack.GetSize();
  
  while (0 < theCount) {
    CHTMLToken* theToken = (CHTMLToken*)aTagStack.ObjectAt(--theCount);  
    if (theToken) {
      eHTMLTags theTag = (eHTMLTags)theToken->GetTypeID();
      if (theTag == aTag) {
        return theCount;
      }
    }
  }

  return kNotFound;
}