Exemplo n.º 1
0
static void CheckTimeRanges(dom::TimeRanges* aTr, const media::TimeIntervals& aTi)
{
  nsRefPtr<dom::TimeRanges> tr = new dom::TimeRanges;
  tr->Union(aTr, 0); // This will normalize the time range.
  EXPECT_EQ(tr->Length(), aTi.Length());
  for (dom::TimeRanges::index_type i = 0; i < tr->Length(); i++) {
    ErrorResult rv;
    EXPECT_EQ(tr->Start(i, rv), aTi[i].mStart.ToSeconds());
    EXPECT_EQ(tr->Start(i, rv), aTi.Start(i).ToSeconds());
    EXPECT_EQ(tr->End(i, rv), aTi[i].mEnd.ToSeconds());
    EXPECT_EQ(tr->End(i, rv), aTi.End(i).ToSeconds());
  }
}
Exemplo n.º 2
0
nsCString
DumpTimeRanges(const media::TimeIntervals& aRanges)
{
  nsCString dump;

  dump = "[";

  for (uint32_t i = 0; i < aRanges.Length(); ++i) {
    if (i > 0) {
      dump += ", ";
    }
    dump += nsPrintfCString("(%f, %f)",
                            aRanges.Start(i).ToSeconds(),
                            aRanges.End(i).ToSeconds());
  }

  dump += "]";

  return dump;
}