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

Unified Diff: metrics_daemon_test.cc

Issue 3233004: remove TimeToDrop support (Closed) Base URL: ssh://git@chromiumos-git//metrics.git
Patch Set: Created 10 years, 4 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') | no next file » | 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 9ba63e80fac7b8a4370f833fd178eb5a8f035a50..40edf1fe35175564e7647340f69c8a3ba70f774d 100644
--- a/metrics_daemon_test.cc
+++ b/metrics_daemon_test.cc
@@ -38,12 +38,6 @@ class TestTicks : public TimeTicks {
};
// Overloaded for test failure printing purposes.
-static std::ostream& operator<<(std::ostream& o, const TimeTicks& ticks) {
- o << ticks.ToInternalValue() << "us";
- return o;
-};
-
-// Overloaded for test failure printing purposes.
static std::ostream& operator<<(std::ostream& o, const Time& time) {
o << time.ToInternalValue() << "us";
return o;
@@ -114,8 +108,6 @@ class MetricsDaemonTest : public testing::Test {
EXPECT_FALSE(daemon_.user_active_);
EXPECT_TRUE(daemon_.user_active_last_.is_null());
- EXPECT_EQ(MetricsDaemon::kUnknownNetworkState, daemon_.network_state_);
- EXPECT_TRUE(daemon_.network_state_last_.is_null());
EXPECT_EQ(MetricsDaemon::kUnknownPowerState, daemon_.power_state_);
EXPECT_EQ(MetricsDaemon::kUnknownSessionState, daemon_.session_state_);
@@ -190,15 +182,6 @@ class MetricsDaemonTest : public testing::Test {
MetricsDaemon::kMetricDailyUseTimeBuckets);
}
- // 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);
- }
-
// Converts from seconds to a Time object.
Time TestTime(int64 seconds) {
return Time::FromInternalValue(seconds * Time::kMicrosecondsPerSecond);
@@ -280,15 +263,6 @@ TEST_F(MetricsDaemonTest, ReportDailyUse) {
MetricsDaemon::ReportDailyUse(&daemon_, /* tag */ 60, /* count */ -5);
}
-TEST_F(MetricsDaemonTest, LookupNetworkState) {
- EXPECT_EQ(MetricsDaemon::kNetworkStateOnline,
- daemon_.LookupNetworkState("online"));
- EXPECT_EQ(MetricsDaemon::kNetworkStateOffline,
- daemon_.LookupNetworkState("offline"));
- EXPECT_EQ(MetricsDaemon::kUnknownNetworkState,
- daemon_.LookupNetworkState("somestate"));
-}
-
TEST_F(MetricsDaemonTest, LookupPowerState) {
EXPECT_EQ(MetricsDaemon::kPowerStateOn,
daemon_.LookupPowerState("on"));
@@ -343,16 +317,6 @@ TEST_F(MetricsDaemonTest, MessageFilter) {
DeleteDBusMessage(msg);
msg = NewDBusSignalString("/",
- "org.chromium.flimflam.Manager",
- "StateChanged",
- "online");
- EXPECT_EQ(MetricsDaemon::kUnknownNetworkState, daemon_.network_state_);
- res = MetricsDaemon::MessageFilter(/* connection */ NULL, msg, &daemon_);
- EXPECT_EQ(MetricsDaemon::kNetworkStateOnline, daemon_.network_state_);
- EXPECT_EQ(DBUS_HANDLER_RESULT_HANDLED, res);
- DeleteDBusMessage(msg);
-
- msg = NewDBusSignalString("/",
"org.chromium.PowerManager",
"PowerStateChanged",
"on");
@@ -393,50 +357,6 @@ TEST_F(MetricsDaemonTest, MessageFilter) {
DeleteDBusMessage(msg);
}
-TEST_F(MetricsDaemonTest, NetStateChangedSimpleDrop) {
- daemon_.NetStateChanged("online", TestTicks(10));
- EXPECT_EQ(MetricsDaemon::kNetworkStateOnline, daemon_.network_state_);
- EXPECT_EQ(TestTicks(10), daemon_.network_state_last_);
-
- ExpectTimeToNetworkDropMetric(20);
- daemon_.NetStateChanged("offline", TestTicks(30));
- EXPECT_EQ(MetricsDaemon::kNetworkStateOffline, daemon_.network_state_);
- EXPECT_EQ(TestTicks(30), daemon_.network_state_last_);
-}
-
-TEST_F(MetricsDaemonTest, NetStateChangedSuspend) {
- daemon_.NetStateChanged("offline", TestTicks(30));
- EXPECT_EQ(MetricsDaemon::kNetworkStateOffline, daemon_.network_state_);
- EXPECT_EQ(TestTicks(30), daemon_.network_state_last_);
-
- daemon_.NetStateChanged("online", TestTicks(60));
- EXPECT_EQ(MetricsDaemon::kNetworkStateOnline, daemon_.network_state_);
- EXPECT_EQ(TestTicks(60), daemon_.network_state_last_);
-
- daemon_.power_state_ = MetricsDaemon::kPowerStateMem;
- daemon_.NetStateChanged("offline", TestTicks(85));
- EXPECT_EQ(MetricsDaemon::kNetworkStateOffline, daemon_.network_state_);
- EXPECT_EQ(TestTicks(85), daemon_.network_state_last_);
-
- daemon_.NetStateChanged("somestate", TestTicks(90));
- EXPECT_EQ(MetricsDaemon::kUnknownNetworkState, daemon_.network_state_);
- EXPECT_EQ(TestTicks(90), daemon_.network_state_last_);
-
- daemon_.NetStateChanged("offline", TestTicks(95));
- EXPECT_EQ(MetricsDaemon::kNetworkStateOffline, daemon_.network_state_);
- EXPECT_EQ(TestTicks(95), daemon_.network_state_last_);
-
- daemon_.power_state_ = MetricsDaemon::kPowerStateOn;
- daemon_.NetStateChanged("online", TestTicks(105));
- EXPECT_EQ(MetricsDaemon::kNetworkStateOnline, daemon_.network_state_);
- EXPECT_EQ(TestTicks(105), daemon_.network_state_last_);
-
- ExpectTimeToNetworkDropMetric(3);
- daemon_.NetStateChanged("offline", TestTicks(108));
- EXPECT_EQ(MetricsDaemon::kNetworkStateOffline, daemon_.network_state_);
- EXPECT_EQ(TestTicks(108), daemon_.network_state_last_);
-}
-
TEST_F(MetricsDaemonTest, PowerStateChanged) {
ExpectActiveUseUpdate(7, 0);
daemon_.SetUserActiveState(/* active */ true,
« no previous file with comments | « metrics_daemon.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698