Index: chrome/browser/chromeos/power/power_data_collector.cc |
diff --git a/chrome/browser/chromeos/power/power_data_collector.cc b/chrome/browser/chromeos/power/power_data_collector.cc |
index b997bb03a9393c7ab51c4f0c4b6a7d007742e9bc..a6ffe8f635264b78445cd76ae65cbb813d00094b 100644 |
--- a/chrome/browser/chromeos/power/power_data_collector.cc |
+++ b/chrome/browser/chromeos/power/power_data_collector.cc |
@@ -25,7 +25,13 @@ void PowerDataCollector::Initialize() { |
// DBusThreadManager is initialized. |
CHECK(DBusThreadManager::Get()); |
CHECK(g_power_data_collector == NULL); |
- g_power_data_collector = new PowerDataCollector(); |
+ g_power_data_collector = new PowerDataCollector(true); |
+} |
+ |
+void PowerDataCollector::InitializeForTesting() { |
+ CHECK(DBusThreadManager::Get()); |
+ CHECK(g_power_data_collector == NULL); |
+ g_power_data_collector = new PowerDataCollector(false); |
} |
// static |
@@ -60,8 +66,10 @@ void PowerDataCollector::SystemResumed(const base::TimeDelta& sleep_duration) { |
AddSample(&system_resumed_data_, sample); |
} |
-PowerDataCollector::PowerDataCollector() { |
+PowerDataCollector::PowerDataCollector(const bool start_cpu_data_collector) { |
DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this); |
+ if (start_cpu_data_collector) |
+ cpu_data_collector_.Start(); |
} |
PowerDataCollector::~PowerDataCollector() { |