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

Unified Diff: third_party/WebKit/Source/core/frame/UseCounterTest.cpp

Issue 2796283005: Adding UseCounter specific for extensions (Closed)
Patch Set: bug fix Created 3 years, 8 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: third_party/WebKit/Source/core/frame/UseCounterTest.cpp
diff --git a/third_party/WebKit/Source/core/frame/UseCounterTest.cpp b/third_party/WebKit/Source/core/frame/UseCounterTest.cpp
index 864057a4d9610261007da901009f175b4acc5d36..030f8bc4f4efea4cfbd071499133d2c973421dc7 100644
--- a/third_party/WebKit/Source/core/frame/UseCounterTest.cpp
+++ b/third_party/WebKit/Source/core/frame/UseCounterTest.cpp
@@ -16,6 +16,8 @@ const char* const kFeaturesHistogramName = "Blink.UseCounter.Features";
const char* const kCSSHistogramName = "Blink.UseCounter.CSSProperties";
const char* const kAnimatedCSSHistogramName =
"Blink.UseCounter.AnimatedCSSProperties";
+const char* const kExtensionFeaturesHistogramName =
Rick Byers 2017/04/28 15:04:40 nit: please add this to the unaffected_histograms
+ "Blink.UseCounter.Extensions.Features";
const char* const kSVGFeaturesHistogramName =
"Blink.UseCounter.SVGImage.Features";
@@ -238,6 +240,23 @@ TEST(UseCounterTest, SVGImageContextAnimatedCSSProperties) {
1 /* page visit bucket */);
}
+TEST(UseCounterTest, RecordingExtensions) {
+ UseCounter use_counter(UseCounter::kExtensionContext);
+ HistogramBasicTest<UseCounter::Feature>(
+ kExtensionFeaturesHistogramName, kLegacyFeaturesHistogramName,
+ {kSVGFeaturesHistogramName, kFeaturesHistogramName}, UseCounter::kFetch,
+ UseCounter::kFetchBodyStream,
+ [&](UseCounter::Feature feature) -> bool {
+ return use_counter.HasRecordedMeasurement(feature);
+ },
+ [&](UseCounter::Feature feature) {
+ use_counter.RecordMeasurement(feature);
+ },
+ [](UseCounter::Feature feature) -> int { return feature; },
+ [&](KURL kurl) { use_counter.DidCommitLoad(kurl); },
+ "chrome-extension://dummysite", UseCounter::kPageVisits);
+}
+
// Failing on Android: crbug.com/667913
#if OS(ANDROID)
#define MAYBE_InspectorDisablesMeasurement DISABLED_InspectorDisablesMeasurement

Powered by Google App Engine
This is Rietveld 408576698