| OLD | NEW | 
|    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/FrameHost.h" |    6 #include "core/frame/FrameHost.h" | 
|    7 #include "core/frame/UseCounter.h" |    7 #include "core/frame/UseCounter.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 "testing/gtest/include/gtest/gtest.h" |   10 #include "testing/gtest/include/gtest/gtest.h" | 
|   11  |   11  | 
|   12 namespace { |   12 namespace { | 
|   13 // Note that the new histogram names will change once the semantics stabilize; |   13 // Note that the new histogram names will change once the semantics stabilize; | 
|   14 const char* const kFeaturesHistogramName = "WebCore.UseCounter_TEST.Features"; |   14 const char* const kFeaturesHistogramName = "WebCore.UseCounter_TEST.Features"; | 
|   15 const char* const kCSSHistogramName = "WebCore.UseCounter_TEST.CSSProperties"; |   15 const char* const kCSSHistogramName = "WebCore.UseCounter_TEST.CSSProperties"; | 
|   16 const char* const kSVGFeaturesHistogramName = |   16 const char* const kSVGFeaturesHistogramName = | 
|   17     "WebCore.UseCounter_TEST.SVGImage.Features"; |   17     "WebCore.UseCounter_TEST.SVGImage.Features"; | 
|   18 const char* const kSVGCSSHistogramName = |   18 const char* const kSVGCSSHistogramName = | 
|   19     "WebCore.UseCounter_TEST.SVGImage.CSSProperties"; |   19     "WebCore.UseCounter_TEST.SVGImage.CSSProperties"; | 
|   20 const char* const kLegacyFeaturesHistogramName = "WebCore.FeatureObserver"; |   20 const char* const kLegacyFeaturesHistogramName = "WebCore.FeatureObserver"; | 
|   21 const char* const kLegacyCSSHistogramName = |   21 const char* const kLegacyCSSHistogramName = | 
|   22     "WebCore.FeatureObserver.CSSProperties"; |   22     "WebCore.FeatureObserver.CSSProperties"; | 
|   23 } |   23 } | 
|   24  |   24  | 
|   25 namespace blink { |   25 namespace blink { | 
|   26  |   26  | 
|   27 TEST(UseCounterTest, RecordingFeatures) { |   27 // Failing on Android: crbug.com/667913 | 
 |   28 #if OS(ANDROID) | 
 |   29 #define MAYBE_RecordingFeatures DISABLED_RecordingFeatures | 
 |   30 #else | 
 |   31 #define MAYBE_RecordingFeatures RecordingFeatures | 
 |   32 #endif | 
 |   33 TEST(UseCounterTest, MAYBE_RecordingFeatures) { | 
|   28   UseCounter useCounter; |   34   UseCounter useCounter; | 
|   29   HistogramTester histogramTester; |   35   HistogramTester histogramTester; | 
|   30  |   36  | 
|   31   // Test recording a single (arbitrary) counter |   37   // Test recording a single (arbitrary) counter | 
|   32   EXPECT_FALSE(useCounter.hasRecordedMeasurement(UseCounter::Fetch)); |   38   EXPECT_FALSE(useCounter.hasRecordedMeasurement(UseCounter::Fetch)); | 
|   33   useCounter.recordMeasurement(UseCounter::Fetch); |   39   useCounter.recordMeasurement(UseCounter::Fetch); | 
|   34   EXPECT_TRUE(useCounter.hasRecordedMeasurement(UseCounter::Fetch)); |   40   EXPECT_TRUE(useCounter.hasRecordedMeasurement(UseCounter::Fetch)); | 
|   35   histogramTester.expectUniqueSample(kFeaturesHistogramName, UseCounter::Fetch, |   41   histogramTester.expectUniqueSample(kFeaturesHistogramName, UseCounter::Fetch, | 
|   36                                      1); |   42                                      1); | 
|   37   histogramTester.expectTotalCount(kLegacyFeaturesHistogramName, 0); |   43   histogramTester.expectTotalCount(kLegacyFeaturesHistogramName, 0); | 
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  338  |  344  | 
|  339   m_deprecation.unmuteForInspector(); |  345   m_deprecation.unmuteForInspector(); | 
|  340   Deprecation::warnOnDeprecatedProperties(frame(), property); |  346   Deprecation::warnOnDeprecatedProperties(frame(), property); | 
|  341   // TODO: use the actually deprecated property to get a deprecation message. |  347   // TODO: use the actually deprecated property to get a deprecation message. | 
|  342   EXPECT_FALSE(m_deprecation.isSuppressed(property)); |  348   EXPECT_FALSE(m_deprecation.isSuppressed(property)); | 
|  343   Deprecation::countDeprecation(frame(), feature); |  349   Deprecation::countDeprecation(frame(), feature); | 
|  344   EXPECT_TRUE(m_useCounter.hasRecordedMeasurement(feature)); |  350   EXPECT_TRUE(m_useCounter.hasRecordedMeasurement(feature)); | 
|  345 } |  351 } | 
|  346  |  352  | 
|  347 }  // namespace blink |  353 }  // namespace blink | 
| OLD | NEW |