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

Side by Side Diff: third_party/WebKit/Source/core/frame/UseCounterTest.cpp

Issue 2847173002: Re-enable UseCounterTests on Android (Closed)
Patch Set: Update rebase Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/frame/Deprecation.h" 5 #include "core/frame/Deprecation.h"
6 #include "core/frame/UseCounter.h" 6 #include "core/frame/UseCounter.h"
7 #include "core/page/Page.h" 7 #include "core/page/Page.h"
8 #include "core/testing/DummyPageHolder.h" 8 #include "core/testing/DummyPageHolder.h"
9 #include "platform/testing/HistogramTester.h" 9 #include "platform/testing/HistogramTester.h"
10 #include "platform/testing/URLTestHelpers.h" 10 #include "platform/testing/URLTestHelpers.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 histogram_map(second_item), 1); 107 histogram_map(second_item), 1);
108 histogram_tester.ExpectBucketCount(legacy_histogram, page_visit_bucket, 2); 108 histogram_tester.ExpectBucketCount(legacy_histogram, page_visit_bucket, 2);
109 histogram_tester.ExpectTotalCount(legacy_histogram, 5); 109 histogram_tester.ExpectTotalCount(legacy_histogram, 5);
110 } 110 }
111 111
112 for (size_t i = 0; i < unaffected_histograms.size(); ++i) { 112 for (size_t i = 0; i < unaffected_histograms.size(); ++i) {
113 histogram_tester.ExpectTotalCount(unaffected_histograms[i], 0); 113 histogram_tester.ExpectTotalCount(unaffected_histograms[i], 0);
114 } 114 }
115 } 115 }
116 116
117 // Failing on Android: crbug.com/667913 117 TEST(UseCounterTest, RecordingFeatures) {
118 #if OS(ANDROID)
119 #define MAYBE_RecordingFeatures DISABLED_RecordingFeatures
120 #else
121 #define MAYBE_RecordingFeatures RecordingFeatures
122 #endif
123 TEST(UseCounterTest, MAYBE_RecordingFeatures) {
124 UseCounter use_counter; 118 UseCounter use_counter;
125 HistogramBasicTest<UseCounter::Feature>( 119 HistogramBasicTest<UseCounter::Feature>(
126 kFeaturesHistogramName, kLegacyFeaturesHistogramName, 120 kFeaturesHistogramName, kLegacyFeaturesHistogramName,
127 {kSVGFeaturesHistogramName, kSVGCSSHistogramName, 121 {kSVGFeaturesHistogramName, kSVGCSSHistogramName,
128 kSVGAnimatedCSSHistogramName}, 122 kSVGAnimatedCSSHistogramName},
129 UseCounter::kFetch, UseCounter::kFetchBodyStream, 123 UseCounter::kFetch, UseCounter::kFetchBodyStream,
130 [&](UseCounter::Feature feature) -> bool { 124 [&](UseCounter::Feature feature) -> bool {
131 return use_counter.HasRecordedMeasurement(feature); 125 return use_counter.HasRecordedMeasurement(feature);
132 }, 126 },
133 [&](UseCounter::Feature feature) { 127 [&](UseCounter::Feature feature) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 return use_counter.IsCountedAnimatedCSS(property); 162 return use_counter.IsCountedAnimatedCSS(property);
169 }, 163 },
170 [&](CSSPropertyID property) { use_counter.CountAnimatedCSS(property); }, 164 [&](CSSPropertyID property) { use_counter.CountAnimatedCSS(property); },
171 [](CSSPropertyID property) -> int { 165 [](CSSPropertyID property) -> int {
172 return UseCounter::MapCSSPropertyIdToCSSSampleIdForHistogram(property); 166 return UseCounter::MapCSSPropertyIdToCSSSampleIdForHistogram(property);
173 }, 167 },
174 [&](KURL kurl) { use_counter.DidCommitLoad(kurl); }, 168 [&](KURL kurl) { use_counter.DidCommitLoad(kurl); },
175 "https://dummysite.com/", 1 /* page visit bucket */); 169 "https://dummysite.com/", 1 /* page visit bucket */);
176 } 170 }
177 171
178 // Failing on Android: crbug.com/667913 172 TEST(UseCounterTest, SVGImageContextFeatures) {
179 #if OS(ANDROID)
180 #define MAYBE_SVGImageContextFeatures DISABLED_SVGImageContextFeatures
181 #else
182 #define MAYBE_SVGImageContextFeatures SVGImageContextFeatures
183 #endif
184 TEST(UseCounterTest, MAYBE_SVGImageContextFeatures) {
185 UseCounter use_counter(UseCounter::kSVGImageContext); 173 UseCounter use_counter(UseCounter::kSVGImageContext);
186 HistogramBasicTest<UseCounter::Feature>( 174 HistogramBasicTest<UseCounter::Feature>(
187 kSVGFeaturesHistogramName, kLegacyFeaturesHistogramName, 175 kSVGFeaturesHistogramName, kLegacyFeaturesHistogramName,
188 {kFeaturesHistogramName, kCSSHistogramName, kAnimatedCSSHistogramName}, 176 {kFeaturesHistogramName, kCSSHistogramName, kAnimatedCSSHistogramName},
189 UseCounter::kSVGSMILAdditiveAnimation, 177 UseCounter::kSVGSMILAdditiveAnimation,
190 UseCounter::kSVGSMILAnimationElementTiming, 178 UseCounter::kSVGSMILAnimationElementTiming,
191 [&](UseCounter::Feature feature) -> bool { 179 [&](UseCounter::Feature feature) -> bool {
192 return use_counter.HasRecordedMeasurement(feature); 180 return use_counter.HasRecordedMeasurement(feature);
193 }, 181 },
194 [&](UseCounter::Feature feature) { 182 [&](UseCounter::Feature feature) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 }, 219 },
232 [&](CSSPropertyID property) { use_counter.CountAnimatedCSS(property); }, 220 [&](CSSPropertyID property) { use_counter.CountAnimatedCSS(property); },
233 [](CSSPropertyID property) -> int { 221 [](CSSPropertyID property) -> int {
234 return UseCounter::MapCSSPropertyIdToCSSSampleIdForHistogram(property); 222 return UseCounter::MapCSSPropertyIdToCSSSampleIdForHistogram(property);
235 }, 223 },
236 [&](KURL kurl) { use_counter.DidCommitLoad(kurl); }, "about:blank", 224 [&](KURL kurl) { use_counter.DidCommitLoad(kurl); }, "about:blank",
237 // In practice SVGs always appear to be loaded with an about:blank URL 225 // In practice SVGs always appear to be loaded with an about:blank URL
238 1 /* page visit bucket */); 226 1 /* page visit bucket */);
239 } 227 }
240 228
241 // Failing on Android: crbug.com/667913 229 TEST(UseCounterTest, InspectorDisablesMeasurement) {
242 #if OS(ANDROID)
243 #define MAYBE_InspectorDisablesMeasurement DISABLED_InspectorDisablesMeasurement
244 #else
245 #define MAYBE_InspectorDisablesMeasurement InspectorDisablesMeasurement
246 #endif
247 TEST(UseCounterTest, MAYBE_InspectorDisablesMeasurement) {
248 UseCounter use_counter; 230 UseCounter use_counter;
249 HistogramTester histogram_tester; 231 HistogramTester histogram_tester;
250 232
251 // The specific feature we use here isn't important. 233 // The specific feature we use here isn't important.
252 UseCounter::Feature feature = UseCounter::Feature::kSVGSMILElementInDocument; 234 UseCounter::Feature feature = UseCounter::Feature::kSVGSMILElementInDocument;
253 CSSPropertyID property = CSSPropertyFontWeight; 235 CSSPropertyID property = CSSPropertyFontWeight;
254 CSSParserMode parser_mode = kHTMLStandardMode; 236 CSSParserMode parser_mode = kHTMLStandardMode;
255 237
256 EXPECT_FALSE(use_counter.HasRecordedMeasurement(feature)); 238 EXPECT_FALSE(use_counter.HasRecordedMeasurement(feature));
257 239
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 visits_count + feature_count); 286 visits_count + feature_count);
305 histogram_tester.ExpectBucketCount(kCSSHistogramName, 1, visits_count); 287 histogram_tester.ExpectBucketCount(kCSSHistogramName, 1, visits_count);
306 histogram_tester.ExpectBucketCount( 288 histogram_tester.ExpectBucketCount(
307 kCSSHistogramName, 289 kCSSHistogramName,
308 UseCounter::MapCSSPropertyIdToCSSSampleIdForHistogram(property), 290 UseCounter::MapCSSPropertyIdToCSSSampleIdForHistogram(property),
309 property_count); 291 property_count);
310 histogram_tester.ExpectTotalCount(kCSSHistogramName, 292 histogram_tester.ExpectTotalCount(kCSSHistogramName,
311 visits_count + property_count); 293 visits_count + property_count);
312 } 294 }
313 295
314 // Failing on Android: crbug.com/667913 296 TEST(UseCounterTest, MutedDocuments) {
315 #if OS(ANDROID)
316 #define MAYBE_MutedDocuments DISABLED_MutedDocuments
317 #else
318 #define MAYBE_MutedDocuments MutedDocuments
319 #endif
320 TEST(UseCounterTest, MAYBE_MutedDocuments) {
321 UseCounter use_counter; 297 UseCounter use_counter;
322 HistogramTester histogram_tester; 298 HistogramTester histogram_tester;
323 299
324 // Counters triggered before any load are always reported. 300 // Counters triggered before any load are always reported.
325 use_counter.RecordMeasurement(UseCounter::kFetch); 301 use_counter.RecordMeasurement(UseCounter::kFetch);
326 use_counter.Count(kHTMLStandardMode, CSSPropertyFontWeight); 302 use_counter.Count(kHTMLStandardMode, CSSPropertyFontWeight);
327 ExpectHistograms(histogram_tester, 0, UseCounter::kFetch, 1, 303 ExpectHistograms(histogram_tester, 0, UseCounter::kFetch, 1,
328 CSSPropertyFontWeight, 1); 304 CSSPropertyFontWeight, 1);
329 305
330 // Loading an internal page doesn't bump PageVisits and metrics not reported. 306 // Loading an internal page doesn't bump PageVisits and metrics not reported.
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 420
445 deprecation_.UnmuteForInspector(); 421 deprecation_.UnmuteForInspector();
446 Deprecation::WarnOnDeprecatedProperties(GetFrame(), property); 422 Deprecation::WarnOnDeprecatedProperties(GetFrame(), property);
447 // TODO: use the actually deprecated property to get a deprecation message. 423 // TODO: use the actually deprecated property to get a deprecation message.
448 EXPECT_FALSE(deprecation_.IsSuppressed(property)); 424 EXPECT_FALSE(deprecation_.IsSuppressed(property));
449 Deprecation::CountDeprecation(GetFrame(), feature); 425 Deprecation::CountDeprecation(GetFrame(), feature);
450 EXPECT_TRUE(use_counter_.HasRecordedMeasurement(feature)); 426 EXPECT_TRUE(use_counter_.HasRecordedMeasurement(feature));
451 } 427 }
452 428
453 } // namespace blink 429 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698