This source file includes following definitions.
- TEST_F
#include "base/debug/trace_event_system_stats_monitor.h"
#include <sstream>
#include <string>
#include "base/debug/trace_event_impl.h"
#include "base/message_loop/message_loop.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace base {
namespace debug {
#if !defined(OS_IOS)
class TraceSystemStatsMonitorTest : public testing::Test {
public:
TraceSystemStatsMonitorTest() {}
virtual ~TraceSystemStatsMonitorTest() {}
private:
DISALLOW_COPY_AND_ASSIGN(TraceSystemStatsMonitorTest);
};
TEST_F(TraceSystemStatsMonitorTest, TraceEventSystemStatsMonitor) {
MessageLoop message_loop;
EXPECT_EQ(0u, TraceLog::GetInstance()->GetObserverCountForTest());
scoped_ptr<TraceEventSystemStatsMonitor> system_stats_monitor(
new TraceEventSystemStatsMonitor(
message_loop.message_loop_proxy()));
EXPECT_EQ(1u, TraceLog::GetInstance()->GetObserverCountForTest());
EXPECT_TRUE(
TraceLog::GetInstance()->HasEnabledStateObserver(
system_stats_monitor.get()));
EXPECT_FALSE(system_stats_monitor->IsTimerRunningForTest());
system_stats_monitor->StartProfiling();
message_loop.RunUntilIdle();
EXPECT_TRUE(system_stats_monitor->IsTimerRunningForTest());
system_stats_monitor->StopProfiling();
message_loop.RunUntilIdle();
EXPECT_FALSE(system_stats_monitor->IsTimerRunningForTest());
system_stats_monitor.reset();
EXPECT_EQ(0u, TraceLog::GetInstance()->GetObserverCountForTest());
}
#endif
}
}