Index: src/platform/metrics/metrics_daemon_test.cc |
diff --git a/src/platform/metrics/metrics_daemon_test.cc b/src/platform/metrics/metrics_daemon_test.cc |
index 25b0855c79edc52b5aee91d202c55e4383b4ef26..8180b143caa00058dbb0154ff8d2508665f8f7a8 100644 |
--- a/src/platform/metrics/metrics_daemon_test.cc |
+++ b/src/platform/metrics/metrics_daemon_test.cc |
@@ -3,6 +3,7 @@ |
// found in the LICENSE file. |
#include "metrics_daemon.h" |
+#include "metrics_library_mock.h" |
#include <sys/file.h> |
@@ -12,6 +13,10 @@ |
#include <base/string_util.h> |
#include <gtest/gtest.h> |
+using ::testing::Mock; |
+using ::testing::Return; |
+using ::testing::StrictMock; |
+ |
static const char kTestDailyUseRecordFile[] = "daily-usage-test"; |
static const char kDoesNotExistFile[] = "/does/not/exist"; |
@@ -20,12 +25,12 @@ static const int kSecondsPerDay = 24 * 60 * 60; |
class MetricsDaemonTest : public testing::Test { |
protected: |
virtual void SetUp() { |
- daemon_.Init(true); |
+ daemon_.Init(true, &metrics_lib_); |
daemon_.daily_use_record_file_ = kTestDailyUseRecordFile; |
// The test fixture object will be used by the log message handler. |
daemon_test_ = this; |
- logging::SetLogMessageHandler(LogMessageHandler); |
+ logging::SetLogMessageHandler(HandleLogMessages); |
} |
virtual void TearDown() { |
@@ -36,7 +41,7 @@ class MetricsDaemonTest : public testing::Test { |
// Collects log messages in the |daemon_log_| member string so that |
// they can be analyzed for errors and expected behavior. |
- static bool LogMessageHandler(int severity, const std::string& str) { |
+ static bool HandleLogMessages(int severity, const std::string& str) { |
daemon_test_->daemon_log_.append(str); |
daemon_test_->daemon_log_.append("\n"); |
@@ -49,43 +54,32 @@ class MetricsDaemonTest : public testing::Test { |
return daemon_log_.find(pattern) != std::string::npos; |
} |
- // Resets the daemon log history to empty. |
- void LogReset() { |
- daemon_log_.clear(); |
- } |
- |
- // Returns true if the specified metric is found in the generated |
- // log so far, false otherwise. |
- bool AssertMetricGenerated(const std::string& name, int sample, |
- int min, int max, int buckets) { |
- return LogContains(StringPrintf("received metric: %s %d %d %d %d", |
- name.c_str(), sample, min, max, buckets)); |
- } |
- |
- // Returns true if the specified daily use time metric is found in |
- // the generated log so far, false otherwise. |
- bool AssertDailyUseTimeMetric(int sample) { |
- return AssertMetricGenerated( |
- MetricsDaemon::kMetricDailyUseTimeName, sample, |
- MetricsDaemon::kMetricDailyUseTimeMin, |
- MetricsDaemon::kMetricDailyUseTimeMax, |
- MetricsDaemon::kMetricDailyUseTimeBuckets); |
+ // Adds a metrics library mock expectation that the specified metric |
+ // will be generated. |
+ void ExpectMetric(const std::string& name, int sample, |
+ int min, int max, int buckets) { |
+ EXPECT_CALL(metrics_lib_, SendToUMA(name, sample, min, max, buckets)) |
+ .Times(1) |
+ .WillOnce(Return(true)) |
+ .RetiresOnSaturation(); |
} |
- // Returns true if the specified time to network drop metric is |
- // found in the generated log so far, false otherwise. |
- bool AssertTimeToNetworkDropMetric(int sample) { |
- return AssertMetricGenerated( |
- MetricsDaemon::kMetricTimeToNetworkDropName, sample, |
- MetricsDaemon::kMetricTimeToNetworkDropMin, |
- MetricsDaemon::kMetricTimeToNetworkDropMax, |
- MetricsDaemon::kMetricTimeToNetworkDropBuckets); |
+ // Adds a metrics library mock expectation that the specified daily |
+ // use time metric will be generated. |
+ void ExpectDailyUseTimeMetric(int sample) { |
+ ExpectMetric(MetricsDaemon::kMetricDailyUseTimeName, sample, |
+ MetricsDaemon::kMetricDailyUseTimeMin, |
+ MetricsDaemon::kMetricDailyUseTimeMax, |
+ MetricsDaemon::kMetricDailyUseTimeBuckets); |
} |
- // Returns true if no metric can be found in the generated log so |
- // far, false otherwise. |
- bool NoMetricGenerated() { |
- return !LogContains("received metric"); |
+ // Adds a metrics library mock expectation that the specified time |
+ // to network dropping metric will be generated. |
+ void ExpectTimeToNetworkDropMetric(int sample) { |
+ ExpectMetric(MetricsDaemon::kMetricTimeToNetworkDropName, sample, |
+ MetricsDaemon::kMetricTimeToNetworkDropMin, |
+ MetricsDaemon::kMetricTimeToNetworkDropMax, |
+ MetricsDaemon::kMetricTimeToNetworkDropBuckets); |
} |
// Asserts that the daily use record file contains the specified |
@@ -125,7 +119,7 @@ class MetricsDaemonTest : public testing::Test { |
// Returns true if the daily use record file does not exist or is |
// empty, false otherwise. |
- bool NoOrEmptyUseRecordFile() { |
+ bool AssertNoOrEmptyUseRecordFile() { |
FilePath record_file(daemon_.daily_use_record_file_); |
int64 record_file_size; |
return !file_util::PathExists(record_file) || |
@@ -167,6 +161,10 @@ class MetricsDaemonTest : public testing::Test { |
// The MetricsDaemon under test. |
MetricsDaemon daemon_; |
+ // Metrics library mock. It's a strict mock so that all unexpected |
+ // metric generation calls are marked as failures. |
+ StrictMock<MetricsLibraryMock> metrics_lib_; |
+ |
// The accumulated metrics daemon log. |
std::string daemon_log_; |
}; |
@@ -174,9 +172,20 @@ class MetricsDaemonTest : public testing::Test { |
// static |
MetricsDaemonTest* MetricsDaemonTest::daemon_test_ = NULL; |
-TEST_F(MetricsDaemonTest, LogDailyUseRecord) { |
+TEST_F(MetricsDaemonTest, LogDailyUseRecordBadFileLocation) { |
+ // Checks that the daemon doesn't die badly if the file can't be |
+ // created. |
+ daemon_.daily_use_record_file_ = kDoesNotExistFile; |
+ daemon_.LogDailyUseRecord(10, 20); |
+ EXPECT_TRUE(LogContains("Unable to open the daily use file: " |
+ "No such file or directory")); |
+ EXPECT_EQ(0, daemon_.daily_use_day_last_); |
+ file_util::Delete(FilePath(kDoesNotExistFile), false); |
+} |
+ |
+TEST_F(MetricsDaemonTest, LogDailyUseRecordOnLogin) { |
EXPECT_EQ(0, daemon_.daily_use_day_last_); |
- EXPECT_TRUE(NoOrEmptyUseRecordFile()); |
+ EXPECT_TRUE(AssertNoOrEmptyUseRecordFile()); |
daemon_.LogDailyUseRecord(/* day */ 5, /* seconds */ 120); |
EXPECT_PRED_FORMAT2(AssertDailyUseRecord, /* day */ 5, /* seconds */ 120); |
@@ -190,40 +199,42 @@ TEST_F(MetricsDaemonTest, LogDailyUseRecord) { |
EXPECT_PRED_FORMAT2(AssertDailyUseRecord, /* day */ 5, /* seconds */ 360); |
EXPECT_EQ(5, daemon_.daily_use_day_last_); |
- EXPECT_TRUE(NoMetricGenerated()); |
- |
- LogReset(); |
+ ExpectDailyUseTimeMetric(/* sample */ 6); |
daemon_.LogDailyUseRecord(/* day */ 6, /* seconds */ 0); |
- EXPECT_TRUE(NoOrEmptyUseRecordFile()); |
- EXPECT_TRUE(AssertDailyUseTimeMetric(/* sample */ 6)); |
+ EXPECT_TRUE(AssertNoOrEmptyUseRecordFile()); |
EXPECT_EQ(6, daemon_.daily_use_day_last_); |
+} |
- // Tests rounding use time to the closest minute. |
- daemon_.LogDailyUseRecord(/* day */ 6, /* seconds */ 90); |
- EXPECT_PRED_FORMAT2(AssertDailyUseRecord, /* day */ 6, /* seconds */ 90); |
- EXPECT_EQ(6, daemon_.daily_use_day_last_); |
+TEST_F(MetricsDaemonTest, LogDailyUseRecordRoundDown) { |
+ EXPECT_EQ(0, daemon_.daily_use_day_last_); |
+ EXPECT_TRUE(AssertNoOrEmptyUseRecordFile()); |
- LogReset(); |
daemon_.LogDailyUseRecord(/* day */ 7, /* seconds */ 89); |
EXPECT_PRED_FORMAT2(AssertDailyUseRecord, /* day */ 7, /* seconds */ 89); |
- EXPECT_TRUE(AssertDailyUseTimeMetric(/* sample */ 2)); |
EXPECT_EQ(7, daemon_.daily_use_day_last_); |
- LogReset(); |
+ ExpectDailyUseTimeMetric(/* sample */ 1); |
daemon_.LogDailyUseRecord(/* day */ 6, /* seconds */ 15); |
EXPECT_PRED_FORMAT2(AssertDailyUseRecord, /* day */ 6, /* seconds */ 15); |
- EXPECT_TRUE(AssertDailyUseTimeMetric(/* sample */ 1)); |
EXPECT_EQ(6, daemon_.daily_use_day_last_); |
+} |
- // Checks that the daemon doesn't die badly if the file can't be |
- // created. |
- LogReset(); |
- daemon_.daily_use_record_file_ = kDoesNotExistFile; |
- daemon_.LogDailyUseRecord(10, 20); |
- EXPECT_TRUE(LogContains("Unable to open the daily use file: " |
- "No such file or directory")); |
+TEST_F(MetricsDaemonTest, LogDailyUseRecordRoundUp) { |
+ EXPECT_EQ(0, daemon_.daily_use_day_last_); |
+ EXPECT_TRUE(AssertNoOrEmptyUseRecordFile()); |
+ |
+ daemon_.LogDailyUseRecord(/* day */ 6, /* seconds */ 0); |
EXPECT_EQ(6, daemon_.daily_use_day_last_); |
- file_util::Delete(FilePath(kDoesNotExistFile), false); |
+ |
+ // Tests rounding use time to the closest minute. |
+ daemon_.LogDailyUseRecord(/* day */ 6, /* seconds */ 90); |
+ EXPECT_PRED_FORMAT2(AssertDailyUseRecord, /* day */ 6, /* seconds */ 90); |
+ EXPECT_EQ(6, daemon_.daily_use_day_last_); |
+ |
+ ExpectDailyUseTimeMetric(/* sample */ 2); |
+ daemon_.LogDailyUseRecord(/* day */ 7, /* seconds */ 89); |
+ EXPECT_PRED_FORMAT2(AssertDailyUseRecord, /* day */ 7, /* seconds */ 89); |
+ EXPECT_EQ(7, daemon_.daily_use_day_last_); |
} |
TEST_F(MetricsDaemonTest, LookupNetworkState) { |
@@ -320,7 +331,7 @@ TEST_F(MetricsDaemonTest, MessageFilter) { |
DeleteDBusMessage(msg); |
} |
-TEST_F(MetricsDaemonTest, NetStateChanged) { |
+TEST_F(MetricsDaemonTest, NetStateChangedSimpleDrop) { |
EXPECT_EQ(MetricsDaemon::kUnknownNetworkState, daemon_.network_state_); |
EXPECT_EQ(0, daemon_.network_state_last_); |
EXPECT_EQ(MetricsDaemon::kUnknownPowerState, daemon_.power_state_); |
@@ -329,14 +340,21 @@ TEST_F(MetricsDaemonTest, NetStateChanged) { |
EXPECT_EQ(MetricsDaemon::kNetworkStateOnline, daemon_.network_state_); |
EXPECT_EQ(10, daemon_.network_state_last_); |
- EXPECT_TRUE(NoMetricGenerated()); |
+ ExpectTimeToNetworkDropMetric(20); |
+ daemon_.NetStateChanged("offline", /* now */ 30); |
+ EXPECT_EQ(MetricsDaemon::kNetworkStateOffline, daemon_.network_state_); |
+ EXPECT_EQ(30, daemon_.network_state_last_); |
+} |
+ |
+TEST_F(MetricsDaemonTest, NetStateChangedSuspend) { |
+ EXPECT_EQ(MetricsDaemon::kUnknownNetworkState, daemon_.network_state_); |
+ EXPECT_EQ(0, daemon_.network_state_last_); |
+ EXPECT_EQ(MetricsDaemon::kUnknownPowerState, daemon_.power_state_); |
daemon_.NetStateChanged("offline", /* now */ 30); |
EXPECT_EQ(MetricsDaemon::kNetworkStateOffline, daemon_.network_state_); |
EXPECT_EQ(30, daemon_.network_state_last_); |
- EXPECT_TRUE(AssertTimeToNetworkDropMetric(/* sample */ 20)); |
- LogReset(); |
daemon_.NetStateChanged("online", /* now */ 60); |
EXPECT_EQ(MetricsDaemon::kNetworkStateOnline, daemon_.network_state_); |
EXPECT_EQ(60, daemon_.network_state_last_); |
@@ -367,12 +385,10 @@ TEST_F(MetricsDaemonTest, NetStateChanged) { |
EXPECT_EQ(MetricsDaemon::kNetworkStateOnline, daemon_.network_state_); |
EXPECT_EQ(105, daemon_.network_state_last_); |
- EXPECT_TRUE(NoMetricGenerated()); |
- |
+ ExpectTimeToNetworkDropMetric(3); |
daemon_.NetStateChanged("offline", /* now */ 108); |
EXPECT_EQ(MetricsDaemon::kNetworkStateOffline, daemon_.network_state_); |
EXPECT_EQ(108, daemon_.network_state_last_); |
- EXPECT_TRUE(AssertTimeToNetworkDropMetric(/* sample */ 3)); |
} |
TEST_F(MetricsDaemonTest, PowerStateChanged) { |
@@ -380,13 +396,13 @@ TEST_F(MetricsDaemonTest, PowerStateChanged) { |
EXPECT_FALSE(daemon_.user_active_); |
EXPECT_EQ(0, daemon_.user_active_last_); |
EXPECT_EQ(0, daemon_.daily_use_day_last_); |
- EXPECT_TRUE(NoOrEmptyUseRecordFile()); |
+ EXPECT_TRUE(AssertNoOrEmptyUseRecordFile()); |
daemon_.SetUserActiveState(/* active */ true, 7 * kSecondsPerDay + 15); |
EXPECT_TRUE(daemon_.user_active_); |
EXPECT_EQ(7 * kSecondsPerDay + 15, daemon_.user_active_last_); |
EXPECT_EQ(7, daemon_.daily_use_day_last_); |
- EXPECT_TRUE(NoOrEmptyUseRecordFile()); |
+ EXPECT_TRUE(AssertNoOrEmptyUseRecordFile()); |
daemon_.PowerStateChanged("mem", 7 * kSecondsPerDay + 45); |
EXPECT_EQ(MetricsDaemon::kPowerStateMem, daemon_.power_state_); |
@@ -405,14 +421,12 @@ TEST_F(MetricsDaemonTest, PowerStateChanged) { |
EXPECT_FALSE(daemon_.user_active_); |
EXPECT_EQ(7 * kSecondsPerDay + 185, daemon_.user_active_last_); |
EXPECT_PRED_FORMAT2(AssertDailyUseRecord, /* day */ 7, /* seconds */ 30); |
- |
- EXPECT_TRUE(NoMetricGenerated()); |
} |
TEST_F(MetricsDaemonTest, PublishMetric) { |
+ ExpectMetric("Dummy.Metric", 3, 1, 100, 50); |
daemon_.PublishMetric("Dummy.Metric", /* sample */ 3, |
/* min */ 1, /* max */ 100, /* buckets */ 50); |
- EXPECT_TRUE(AssertMetricGenerated("Dummy.Metric", 3, 1, 100, 50)); |
} |
TEST_F(MetricsDaemonTest, ScreenSaverStateChanged) { |
@@ -421,7 +435,7 @@ TEST_F(MetricsDaemonTest, ScreenSaverStateChanged) { |
EXPECT_FALSE(daemon_.user_active_); |
EXPECT_EQ(0, daemon_.user_active_last_); |
EXPECT_EQ(0, daemon_.daily_use_day_last_); |
- EXPECT_TRUE(NoOrEmptyUseRecordFile()); |
+ EXPECT_TRUE(AssertNoOrEmptyUseRecordFile()); |
daemon_.ScreenSaverStateChanged("locked", 5 * kSecondsPerDay + 10); |
EXPECT_EQ(MetricsDaemon::kScreenSaverStateLocked, |
@@ -429,14 +443,14 @@ TEST_F(MetricsDaemonTest, ScreenSaverStateChanged) { |
EXPECT_FALSE(daemon_.user_active_); |
EXPECT_EQ(5 * kSecondsPerDay + 10, daemon_.user_active_last_); |
EXPECT_EQ(5, daemon_.daily_use_day_last_); |
- EXPECT_TRUE(NoOrEmptyUseRecordFile()); |
+ EXPECT_TRUE(AssertNoOrEmptyUseRecordFile()); |
daemon_.ScreenSaverStateChanged("unlocked", 5 * kSecondsPerDay + 100); |
EXPECT_EQ(MetricsDaemon::kScreenSaverStateUnlocked, |
daemon_.screensaver_state_); |
EXPECT_TRUE(daemon_.user_active_); |
EXPECT_EQ(5 * kSecondsPerDay + 100, daemon_.user_active_last_); |
- EXPECT_TRUE(NoOrEmptyUseRecordFile()); |
+ EXPECT_TRUE(AssertNoOrEmptyUseRecordFile()); |
daemon_.ScreenSaverStateChanged("otherstate", 5 * kSecondsPerDay + 300); |
EXPECT_EQ(MetricsDaemon::kUnknownScreenSaverState, |
@@ -444,8 +458,6 @@ TEST_F(MetricsDaemonTest, ScreenSaverStateChanged) { |
EXPECT_FALSE(daemon_.user_active_); |
EXPECT_EQ(5 * kSecondsPerDay + 300, daemon_.user_active_last_); |
EXPECT_PRED_FORMAT2(AssertDailyUseRecord, /* day */ 5, /* seconds */ 200); |
- |
- EXPECT_TRUE(NoMetricGenerated()); |
} |
TEST_F(MetricsDaemonTest, SessionStateChanged) { |
@@ -453,14 +465,14 @@ TEST_F(MetricsDaemonTest, SessionStateChanged) { |
EXPECT_FALSE(daemon_.user_active_); |
EXPECT_EQ(0, daemon_.user_active_last_); |
EXPECT_EQ(0, daemon_.daily_use_day_last_); |
- EXPECT_TRUE(NoOrEmptyUseRecordFile()); |
+ EXPECT_TRUE(AssertNoOrEmptyUseRecordFile()); |
daemon_.SessionStateChanged("started", 15 * kSecondsPerDay + 20); |
EXPECT_EQ(MetricsDaemon::kSessionStateStarted, daemon_.session_state_); |
EXPECT_TRUE(daemon_.user_active_); |
EXPECT_EQ(15 * kSecondsPerDay + 20, daemon_.user_active_last_); |
EXPECT_EQ(15, daemon_.daily_use_day_last_); |
- EXPECT_TRUE(NoOrEmptyUseRecordFile()); |
+ EXPECT_TRUE(AssertNoOrEmptyUseRecordFile()); |
daemon_.SessionStateChanged("stopped", 15 * kSecondsPerDay + 150); |
EXPECT_EQ(MetricsDaemon::kSessionStateStopped, daemon_.session_state_); |
@@ -473,27 +485,25 @@ TEST_F(MetricsDaemonTest, SessionStateChanged) { |
EXPECT_FALSE(daemon_.user_active_); |
EXPECT_EQ(15 * kSecondsPerDay + 300, daemon_.user_active_last_); |
EXPECT_PRED_FORMAT2(AssertDailyUseRecord, /* day */ 15, /* seconds */ 130); |
- |
- EXPECT_TRUE(NoMetricGenerated()); |
} |
-TEST_F(MetricsDaemonTest, SetUserActiveState) { |
+TEST_F(MetricsDaemonTest, SetUserActiveStateSendOnLogin) { |
EXPECT_FALSE(daemon_.user_active_); |
EXPECT_EQ(0, daemon_.user_active_last_); |
EXPECT_EQ(0, daemon_.daily_use_day_last_); |
- EXPECT_TRUE(NoOrEmptyUseRecordFile()); |
+ EXPECT_TRUE(AssertNoOrEmptyUseRecordFile()); |
daemon_.SetUserActiveState(/* active */ false, 5 * kSecondsPerDay + 10); |
EXPECT_FALSE(daemon_.user_active_); |
EXPECT_EQ(5 * kSecondsPerDay + 10, daemon_.user_active_last_); |
EXPECT_EQ(5, daemon_.daily_use_day_last_); |
- EXPECT_TRUE(NoOrEmptyUseRecordFile()); |
+ EXPECT_TRUE(AssertNoOrEmptyUseRecordFile()); |
daemon_.SetUserActiveState(/* active */ true, 6 * kSecondsPerDay + 20); |
EXPECT_TRUE(daemon_.user_active_); |
EXPECT_EQ(6 * kSecondsPerDay + 20, daemon_.user_active_last_); |
EXPECT_EQ(6, daemon_.daily_use_day_last_); |
- EXPECT_TRUE(NoOrEmptyUseRecordFile()); |
+ EXPECT_TRUE(AssertNoOrEmptyUseRecordFile()); |
daemon_.SetUserActiveState(/* active */ true, 6 * kSecondsPerDay + 120); |
EXPECT_TRUE(daemon_.user_active_); |
@@ -507,17 +517,26 @@ TEST_F(MetricsDaemonTest, SetUserActiveState) { |
EXPECT_EQ(6, daemon_.daily_use_day_last_); |
EXPECT_PRED_FORMAT2(AssertDailyUseRecord, /* day */ 6, /* seconds */ 200); |
- EXPECT_TRUE(NoMetricGenerated()); |
+ ExpectDailyUseTimeMetric(/* sample */ 3); |
+ daemon_.SetUserActiveState(/* active */ true, 8 * kSecondsPerDay - 300); |
+ EXPECT_TRUE(daemon_.user_active_); |
+ EXPECT_EQ(8 * kSecondsPerDay - 300, daemon_.user_active_last_); |
+ EXPECT_EQ(7, daemon_.daily_use_day_last_); |
+ EXPECT_TRUE(AssertNoOrEmptyUseRecordFile()); |
+} |
+ |
+TEST_F(MetricsDaemonTest, SetUserActiveStateSendOnMonitor) { |
+ EXPECT_FALSE(daemon_.user_active_); |
+ EXPECT_EQ(0, daemon_.user_active_last_); |
+ EXPECT_EQ(0, daemon_.daily_use_day_last_); |
+ EXPECT_TRUE(AssertNoOrEmptyUseRecordFile()); |
- LogReset(); |
daemon_.SetUserActiveState(/* active */ true, 8 * kSecondsPerDay - 300); |
EXPECT_TRUE(daemon_.user_active_); |
EXPECT_EQ(8 * kSecondsPerDay - 300, daemon_.user_active_last_); |
EXPECT_EQ(7, daemon_.daily_use_day_last_); |
- EXPECT_TRUE(NoOrEmptyUseRecordFile()); |
- EXPECT_TRUE(AssertDailyUseTimeMetric(/* sample */ 3)); |
+ EXPECT_TRUE(AssertNoOrEmptyUseRecordFile()); |
- LogReset(); |
daemon_.SetUserActiveState(/* active */ false, 8 * kSecondsPerDay + 300); |
EXPECT_FALSE(daemon_.user_active_); |
EXPECT_EQ(8 * kSecondsPerDay + 300, daemon_.user_active_last_); |
@@ -530,15 +549,12 @@ TEST_F(MetricsDaemonTest, SetUserActiveState) { |
EXPECT_EQ(8, daemon_.daily_use_day_last_); |
EXPECT_PRED_FORMAT2(AssertDailyUseRecord, /* day */ 8, /* seconds */ 600); |
- EXPECT_TRUE(NoMetricGenerated()); |
- |
- LogReset(); |
+ ExpectDailyUseTimeMetric(/* sample */ 10); |
daemon_.SetUserActiveState(/* active */ true, 9 * kSecondsPerDay + 400); |
EXPECT_TRUE(daemon_.user_active_); |
EXPECT_EQ(9 * kSecondsPerDay + 400, daemon_.user_active_last_); |
EXPECT_EQ(9, daemon_.daily_use_day_last_); |
EXPECT_PRED_FORMAT2(AssertDailyUseRecord, /* day */ 9, /* seconds */ 800); |
- EXPECT_TRUE(AssertDailyUseTimeMetric(/* sample */ 10)); |
} |
int main(int argc, char **argv) { |