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

Unified Diff: chromecast/metrics/cast_metrics_unittest.cc

Issue 522853002: Chromecast fix: MetricsStateManager segfaults if callbacks are empty. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: include unit test file 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
« no previous file with comments | « chromecast/metrics/cast_metrics_service_client.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromecast/metrics/cast_metrics_unittest.cc
diff --git a/chromecast/metrics/cast_metrics_unittest.cc b/chromecast/metrics/cast_metrics_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..54bbdecee7cc9941971fc9d58b66bb08165620a3
--- /dev/null
+++ b/chromecast/metrics/cast_metrics_unittest.cc
@@ -0,0 +1,34 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/memory/scoped_ptr.h"
+#include "base/message_loop/message_loop.h"
+#include "base/prefs/testing_pref_service.h"
+#include "chromecast/metrics/cast_metrics_service_client.h"
Alexei Svitkine (slow) 2014/08/29 17:58:29 Nit: Chromium convention is now for this to be the
gunsch 2014/08/29 18:26:05 Done.
gunsch 2014/08/29 18:26:47 Actually, had to put this back. It seems for unit
Alexei Svitkine (slow) 2014/08/29 18:43:15 Odd. Which presubmit? It certainly doesn't for ot
+#include "components/metrics/metrics_service.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace chromecast {
+
+class CastMetricsTest : public testing::Test {
+ protected:
+ virtual void SetUp() OVERRIDE {
+ message_loop_.reset(new base::MessageLoop());
+ prefs_.reset(new TestingPrefServiceSimple());
+ ::metrics::MetricsService::RegisterPrefs(prefs_->registry());
+ }
+
+ virtual void TearDown() OVERRIDE {
+ }
+
Alexei Svitkine (slow) 2014/08/29 17:58:29 Nit: Not sure you need to override this.
gunsch 2014/08/29 18:26:04 Done.
+ scoped_ptr<base::MessageLoop> message_loop_;
Alexei Svitkine (slow) 2014/08/29 17:58:29 Nit: Put a private: section above these and add DI
gunsch 2014/08/29 18:26:05 Done.
+ scoped_ptr<TestingPrefServiceSimple> prefs_;
+};
+
+TEST_F(CastMetricsTest, CreateMetricsServiceClient) {
+ // Create and expect this to not crash.
+ metrics::CastMetricsServiceClient::Create(prefs_.get(), NULL);
+}
+
+} // namespace chromecast
« no previous file with comments | « chromecast/metrics/cast_metrics_service_client.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698