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

Side by Side Diff: ui/compositor/layer_unittest.cc

Issue 2857853004: Make animation longer in flaky ReportMetrics test (Closed)
Patch Set: 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 (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 2198 matching lines...) Expand 10 before | Expand all | Expand 10 after
2209 2209
2210 private: 2210 private:
2211 bool report_called_ = false; 2211 bool report_called_ = false;
2212 int value_ = -1; 2212 int value_ = -1;
2213 2213
2214 DISALLOW_COPY_AND_ASSIGN(TestMetricsReporter); 2214 DISALLOW_COPY_AND_ASSIGN(TestMetricsReporter);
2215 }; 2215 };
2216 2216
2217 // Starts an animation and tests that incrementing compositor frame count can 2217 // Starts an animation and tests that incrementing compositor frame count can
2218 // be used to report animation smoothness metrics. 2218 // be used to report animation smoothness metrics.
2219 // Flaky test crbug.com/709080 2219 TEST_F(LayerWithRealCompositorTest, ReportMetrics) {
2220 TEST_F(LayerWithRealCompositorTest, DISABLED_ReportMetrics) {
2221 std::unique_ptr<Layer> root(CreateLayer(LAYER_SOLID_COLOR)); 2220 std::unique_ptr<Layer> root(CreateLayer(LAYER_SOLID_COLOR));
2222 GetCompositor()->SetRootLayer(root.get()); 2221 GetCompositor()->SetRootLayer(root.get());
2223 LayerAnimator* animator = root->GetAnimator(); 2222 LayerAnimator* animator = root->GetAnimator();
2224 std::unique_ptr<ui::LayerAnimationElement> animation_element = 2223 std::unique_ptr<ui::LayerAnimationElement> animation_element =
2225 ui::LayerAnimationElement::CreateColorElement( 2224 ui::LayerAnimationElement::CreateColorElement(
2226 SK_ColorRED, base::TimeDelta::FromMilliseconds(100)); 2225 SK_ColorRED, base::TimeDelta::FromMilliseconds(1000));
2227 ui::LayerAnimationSequence* animation_sequence = 2226 ui::LayerAnimationSequence* animation_sequence =
2228 new ui::LayerAnimationSequence(std::move(animation_element)); 2227 new ui::LayerAnimationSequence(std::move(animation_element));
2229 TestMetricsReporter reporter; 2228 TestMetricsReporter reporter;
2230 animation_sequence->SetAnimationMetricsReporter(&reporter); 2229 animation_sequence->SetAnimationMetricsReporter(&reporter);
2231 animator->StartAnimation(animation_sequence); 2230 animator->StartAnimation(animation_sequence);
2232 while (!reporter.report_called()) 2231 while (!reporter.report_called())
2233 WaitForSwap(); 2232 WaitForSwap();
2234 ResetCompositor(); 2233 ResetCompositor();
2235 // Even though most of the time 100% smooth animations are expected, on the 2234 // Even though most of the time 100% smooth animations are expected, on the
2236 // test bots this cannot be guaranteed. Therefore simply check that some 2235 // test bots this cannot be guaranteed. Therefore simply check that some
2237 // value was reported. 2236 // value was reported.
2238 EXPECT_GT(reporter.value(), 0); 2237 EXPECT_GT(reporter.value(), 0);
2239 } 2238 }
2240 2239
2241 TEST(LayerDebugInfoTest, LayerNameDoesNotClobber) { 2240 TEST(LayerDebugInfoTest, LayerNameDoesNotClobber) {
2242 Layer layer(LAYER_NOT_DRAWN); 2241 Layer layer(LAYER_NOT_DRAWN);
2243 layer.set_name("foo"); 2242 layer.set_name("foo");
2244 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> debug_info = 2243 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> debug_info =
2245 layer.TakeDebugInfo(nullptr); 2244 layer.TakeDebugInfo(nullptr);
2246 std::string trace_format("bar,"); 2245 std::string trace_format("bar,");
2247 debug_info->AppendAsTraceFormat(&trace_format); 2246 debug_info->AppendAsTraceFormat(&trace_format);
2248 std::string expected("bar,{\"layer_name\":\"foo\"}"); 2247 std::string expected("bar,{\"layer_name\":\"foo\"}");
2249 EXPECT_EQ(expected, trace_format); 2248 EXPECT_EQ(expected, trace_format);
2250 } 2249 }
2251 2250
2252 } // namespace ui 2251 } // namespace ui
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