Skip to content

Instantly share code, notes, and snippets.

@chebert
Created July 16, 2012 21:30
Show Gist options
  • Select an option

  • Save chebert/3125188 to your computer and use it in GitHub Desktop.

Select an option

Save chebert/3125188 to your computer and use it in GitHub Desktop.
TEST(PerformanceMonitorDatabaseSetupTest,
ActiveIntervalRetrievalDuringActiveInterval) {
FilePath alternate_path;
file_util::CreateNewTempDirectory(FilePath::StringType(), &alternate_path);
TestingClock* clock = new TestingClock();
scoped_ptr<Database> db = Database::Create(alternate_path);
db->set_clock(scoped_ptr<Database::Clock>(clock));
db->AddStateValue("test", "test"); //1
base::Time start_time = clock->GetTime(); //2
db->AddStateValue("test", "test"); //3
base::Time end_time = clock->GetTime(); //4
db->AddStateValue("test", "test"); //5
std::vector<TimeRange> active_interval = db->GetActiveIntervals(start_time,
end_time);
ASSERT_EQ(active_interval.size(), 1u);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment