| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/compositor/layer.h" | 5 #include "ui/compositor/layer.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 2184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2195 report_called_ = true; | 2195 report_called_ = true; |
| 2196 } | 2196 } |
| 2197 | 2197 |
| 2198 private: | 2198 private: |
| 2199 bool report_called_ = false; | 2199 bool report_called_ = false; |
| 2200 int value_ = -1; | 2200 int value_ = -1; |
| 2201 | 2201 |
| 2202 DISALLOW_COPY_AND_ASSIGN(TestMetricsReporter); | 2202 DISALLOW_COPY_AND_ASSIGN(TestMetricsReporter); |
| 2203 }; | 2203 }; |
| 2204 | 2204 |
| 2205 // https://crbug.com/709080 |
| 2206 #if defined(OS_WIN) |
| 2207 #define MAYBE_ReportMetrics DISABLED_ReportMetrics |
| 2208 #else |
| 2209 #define MAYBE_ReportMetrics ReportMetrics |
| 2210 #endif |
| 2205 // Starts an animation and tests that incrementing compositor frame count can | 2211 // Starts an animation and tests that incrementing compositor frame count can |
| 2206 // be used to report animation smoothness metrics. | 2212 // be used to report animation smoothness metrics. |
| 2207 TEST_F(LayerWithRealCompositorTest, ReportMetrics) { | 2213 TEST_F(LayerWithRealCompositorTest, MAYBE_ReportMetrics) { |
| 2208 std::unique_ptr<Layer> root(CreateLayer(LAYER_SOLID_COLOR)); | 2214 std::unique_ptr<Layer> root(CreateLayer(LAYER_SOLID_COLOR)); |
| 2209 GetCompositor()->SetRootLayer(root.get()); | 2215 GetCompositor()->SetRootLayer(root.get()); |
| 2210 LayerAnimator* animator = root->GetAnimator(); | 2216 LayerAnimator* animator = root->GetAnimator(); |
| 2211 std::unique_ptr<ui::LayerAnimationElement> animation_element = | 2217 std::unique_ptr<ui::LayerAnimationElement> animation_element = |
| 2212 ui::LayerAnimationElement::CreateColorElement( | 2218 ui::LayerAnimationElement::CreateColorElement( |
| 2213 SK_ColorRED, base::TimeDelta::FromMilliseconds(100)); | 2219 SK_ColorRED, base::TimeDelta::FromMilliseconds(100)); |
| 2214 ui::LayerAnimationSequence* animation_sequence = | 2220 ui::LayerAnimationSequence* animation_sequence = |
| 2215 new ui::LayerAnimationSequence(std::move(animation_element)); | 2221 new ui::LayerAnimationSequence(std::move(animation_element)); |
| 2216 TestMetricsReporter reporter; | 2222 TestMetricsReporter reporter; |
| 2217 animation_sequence->SetAnimationMetricsReporter(&reporter); | 2223 animation_sequence->SetAnimationMetricsReporter(&reporter); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2230 layer.set_name("foo"); | 2236 layer.set_name("foo"); |
| 2231 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> debug_info = | 2237 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> debug_info = |
| 2232 layer.TakeDebugInfo(nullptr); | 2238 layer.TakeDebugInfo(nullptr); |
| 2233 std::string trace_format("bar,"); | 2239 std::string trace_format("bar,"); |
| 2234 debug_info->AppendAsTraceFormat(&trace_format); | 2240 debug_info->AppendAsTraceFormat(&trace_format); |
| 2235 std::string expected("bar,{\"layer_name\":\"foo\"}"); | 2241 std::string expected("bar,{\"layer_name\":\"foo\"}"); |
| 2236 EXPECT_EQ(expected, trace_format); | 2242 EXPECT_EQ(expected, trace_format); |
| 2237 } | 2243 } |
| 2238 | 2244 |
| 2239 } // namespace ui | 2245 } // namespace ui |
| OLD | NEW |