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

Unified Diff: components/navigation_metrics/navigation_metrics_unittest.cc

Issue 2713273002: Increase test coverage for Navigation.MainFrameSchemeDifferentPage (Closed)
Patch Set: Increase test coverage for Navigation.MainFrameSchemeDifferentPage Created 3 years, 9 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 | « components/navigation_metrics/BUILD.gn ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/navigation_metrics/navigation_metrics_unittest.cc
diff --git a/components/navigation_metrics/navigation_metrics_unittest.cc b/components/navigation_metrics/navigation_metrics_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..de09f6c5a67b196b0bceede1751d958fe7bf0b4d
--- /dev/null
+++ b/components/navigation_metrics/navigation_metrics_unittest.cc
@@ -0,0 +1,42 @@
+// Copyright 2017 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 "components/navigation_metrics/navigation_metrics.h"
+
+#include "base/test/histogram_tester.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "url/gurl.h"
+
+namespace {
+const char* const kTestUrl = "http://www.example.com";
+const char* const kMainFrameScheme = "Navigation.MainFrameScheme";
+const char* const kMainFrameSchemeDifferentPage =
+ "Navigation.MainFrameSchemeDifferentPage";
+
+} // namespace
+
+namespace navigation_metrics {
+
+TEST(NavigationMetrics, MainFrameSchemeDifferentPage) {
+ base::HistogramTester test;
+
+ RecordMainFrameNavigation(GURL(kTestUrl), false, false, false);
+
+ test.ExpectTotalCount(kMainFrameScheme, 1);
+ test.ExpectUniqueSample(kMainFrameScheme, 1 /* http */, 1);
+ test.ExpectTotalCount(kMainFrameSchemeDifferentPage, 1);
+ test.ExpectUniqueSample(kMainFrameSchemeDifferentPage, 1 /* http */, 1);
+}
+
+TEST(NavigationMetrics, MainFrameSchemeSamePage) {
+ base::HistogramTester test;
+
+ RecordMainFrameNavigation(GURL(kTestUrl), true, false, false);
+
+ test.ExpectTotalCount(kMainFrameScheme, 1);
+ test.ExpectUniqueSample(kMainFrameScheme, 1 /* http */, 1);
+ test.ExpectTotalCount(kMainFrameSchemeDifferentPage, 0);
+}
+
+} // namespace navigation_metrics
« no previous file with comments | « components/navigation_metrics/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698