Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1331)

Unified Diff: metrics_daemon_test.cc

Issue 2698002: Update metrics daemon to use new power manager signals for locking (4 of 7). (Closed) Base URL: ssh://git@chromiumos-git/metrics.git
Patch Set: Update to master Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « metrics_daemon.cc ('k') | screensaver_states.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: metrics_daemon_test.cc
diff --git a/metrics_daemon_test.cc b/metrics_daemon_test.cc
index 31f079d451b77bcd7382dfec4b7b8b296d50ecd5..49acd3164ad992d8a39ddd3970c4972b94692a1f 100644
--- a/metrics_daemon_test.cc
+++ b/metrics_daemon_test.cc
@@ -286,15 +286,6 @@ TEST_F(MetricsDaemonTest, LookupPowerState) {
daemon_.LookupPowerState("somestate"));
}
-TEST_F(MetricsDaemonTest, LookupScreenSaverState) {
- EXPECT_EQ(MetricsDaemon::kScreenSaverStateLocked,
- daemon_.LookupScreenSaverState("locked"));
- EXPECT_EQ(MetricsDaemon::kScreenSaverStateUnlocked,
- daemon_.LookupScreenSaverState("unlocked"));
- EXPECT_EQ(MetricsDaemon::kUnknownScreenSaverState,
- daemon_.LookupScreenSaverState("somestate"));
-}
-
TEST_F(MetricsDaemonTest, LookupSessionState) {
EXPECT_EQ(MetricsDaemon::kSessionStateStarted,
daemon_.LookupSessionState("started"));
@@ -322,7 +313,7 @@ TEST_F(MetricsDaemonTest, MessageFilter) {
DeleteDBusMessage(msg);
msg = NewDBusSignalString("/",
- "org.chromium.Power.Manager",
+ "org.chromium.PowerManager",
"PowerStateChanged",
"on");
EXPECT_EQ(MetricsDaemon::kUnknownPowerState, daemon_.power_state_);
@@ -332,14 +323,12 @@ TEST_F(MetricsDaemonTest, MessageFilter) {
DeleteDBusMessage(msg);
msg = NewDBusSignalString("/",
- "org.chromium.ScreenSaver.Manager",
- "LockStateChanged",
- "unlocked");
- EXPECT_EQ(MetricsDaemon::kUnknownScreenSaverState,
- daemon_.screensaver_state_);
+ "org.chromium.PowerManager",
+ "ScreenIsUnlocked",
+ "");
+ EXPECT_FALSE(daemon_.user_active_);
res = MetricsDaemon::MessageFilter(/* connection */ NULL, msg, &daemon_);
- EXPECT_EQ(MetricsDaemon::kScreenSaverStateUnlocked,
- daemon_.screensaver_state_);
+ EXPECT_TRUE(daemon_.user_active_);
EXPECT_EQ(DBUS_HANDLER_RESULT_HANDLED, res);
DeleteDBusMessage(msg);
@@ -433,36 +422,6 @@ TEST_F(MetricsDaemonTest, PowerStateChanged) {
EXPECT_PRED_FORMAT2(AssertDailyUseRecord, /* day */ 7, /* seconds */ 30);
}
-TEST_F(MetricsDaemonTest, ScreenSaverStateChanged) {
- EXPECT_EQ(MetricsDaemon::kUnknownScreenSaverState,
- daemon_.screensaver_state_);
-
- daemon_.ScreenSaverStateChanged("locked",
- TestTime(5 * kSecondsPerDay + 10));
- EXPECT_EQ(MetricsDaemon::kScreenSaverStateLocked,
- daemon_.screensaver_state_);
- EXPECT_FALSE(daemon_.user_active_);
- EXPECT_EQ(TestTime(5 * kSecondsPerDay + 10), daemon_.user_active_last_);
- EXPECT_EQ(5, daemon_.daily_use_day_last_);
- EXPECT_TRUE(AssertNoOrEmptyUseRecordFile());
-
- daemon_.ScreenSaverStateChanged("unlocked",
- TestTime(5 * kSecondsPerDay + 100));
- EXPECT_EQ(MetricsDaemon::kScreenSaverStateUnlocked,
- daemon_.screensaver_state_);
- EXPECT_TRUE(daemon_.user_active_);
- EXPECT_EQ(TestTime(5 * kSecondsPerDay + 100), daemon_.user_active_last_);
- EXPECT_TRUE(AssertNoOrEmptyUseRecordFile());
-
- daemon_.ScreenSaverStateChanged("otherstate",
- TestTime(5 * kSecondsPerDay + 300));
- EXPECT_EQ(MetricsDaemon::kUnknownScreenSaverState,
- daemon_.screensaver_state_);
- EXPECT_FALSE(daemon_.user_active_);
- EXPECT_EQ(TestTime(5 * kSecondsPerDay + 300), daemon_.user_active_last_);
- EXPECT_PRED_FORMAT2(AssertDailyUseRecord, /* day */ 5, /* seconds */ 200);
-}
-
TEST_F(MetricsDaemonTest, SendMetric) {
ExpectMetric("Dummy.Metric", 3, 1, 100, 50);
daemon_.SendMetric("Dummy.Metric", /* sample */ 3,
« no previous file with comments | « metrics_daemon.cc ('k') | screensaver_states.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698