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

Unified Diff: chrome/browser/metrics/plugin_metrics_provider_unittest.cc

Issue 441013002: Eliminate MetricsProvider::RecordCurrentState() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
Index: chrome/browser/metrics/plugin_metrics_provider_unittest.cc
diff --git a/chrome/browser/metrics/plugin_metrics_provider_unittest.cc b/chrome/browser/metrics/plugin_metrics_provider_unittest.cc
index dc961918faef9174469fa3a9df5fbfc382d1a409..acf8e54a9d7e6e401f23bdb48f7a3aebadce9526 100644
--- a/chrome/browser/metrics/plugin_metrics_provider_unittest.cc
+++ b/chrome/browser/metrics/plugin_metrics_provider_unittest.cc
@@ -10,6 +10,7 @@
#include "base/prefs/pref_service.h"
#include "base/prefs/scoped_user_pref_update.h"
#include "base/prefs/testing_pref_service.h"
+#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/common/pref_names.h"
#include "components/metrics/proto/system_profile.pb.h"
@@ -100,3 +101,20 @@ TEST(PluginMetricsProviderTest, Plugins) {
EXPECT_EQ(3, stability.plugin_stability(0).instance_count());
EXPECT_EQ(4, stability.plugin_stability(0).loading_error_count());
}
+
+TEST(PluginMetricsProviderTest, CheckDelayedTask) {
+ content::TestBrowserThreadBundle thread_bundle;
+
+ TestingPrefServiceSimple prefs;
+ PluginMetricsProvider::RegisterPrefs(prefs.registry());
+ PluginMetricsProvider provider(&prefs);
+
+ int delay_sec = 1;
+ EXPECT_EQ(true, provider.DelayedRecordCurrentState(delay_sec));
Alexei Svitkine (slow) 2014/08/05 20:13:12 Nit: use EXPECT_TRUE and EXPECT_FALSE
gayane -on leave until 09-2017 2014/08/05 21:24:56 Done.
+ EXPECT_EQ(false, provider.DelayedRecordCurrentState(delay_sec));
+
+ sleep(delay_sec);
Alexei Svitkine (slow) 2014/08/05 20:13:12 Use base::PlatformThread::Sleep() instead.
gayane -on leave until 09-2017 2014/08/05 21:24:55 Done.
+ base::RunLoop().RunUntilIdle();
+
+ EXPECT_EQ(true, provider.DelayedRecordCurrentState(delay_sec));
+}

Powered by Google App Engine
This is Rietveld 408576698