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

Side by Side Diff: ui/views/animation/bounds_animator_unittest.cc

Issue 2086093003: Remove calls to deprecated MessageLoop methods in ui. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
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/views/animation/bounds_animator.h" 5 #include "ui/views/animation/bounds_animator.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/run_loop.h"
8 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
9 #include "ui/gfx/animation/slide_animation.h" 10 #include "ui/gfx/animation/slide_animation.h"
10 #include "ui/gfx/animation/test_animation_delegate.h" 11 #include "ui/gfx/animation/test_animation_delegate.h"
11 #include "ui/views/view.h" 12 #include "ui/views/view.h"
12 13
13 using gfx::Animation; 14 using gfx::Animation;
14 using gfx::SlideAnimation; 15 using gfx::SlideAnimation;
15 using gfx::TestAnimationDelegate; 16 using gfx::TestAnimationDelegate;
16 17
17 namespace views { 18 namespace views {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 animator()->AnimateViewTo(child(), target_bounds); 116 animator()->AnimateViewTo(child(), target_bounds);
116 animator()->SetAnimationDelegate( 117 animator()->SetAnimationDelegate(
117 child(), 118 child(),
118 std::unique_ptr<gfx::AnimationDelegate>(new TestAnimationDelegate())); 119 std::unique_ptr<gfx::AnimationDelegate>(new TestAnimationDelegate()));
119 120
120 // The animator should be animating now. 121 // The animator should be animating now.
121 EXPECT_TRUE(animator()->IsAnimating()); 122 EXPECT_TRUE(animator()->IsAnimating());
122 123
123 // Run the message loop; the delegate exits the loop when the animation is 124 // Run the message loop; the delegate exits the loop when the animation is
124 // done. 125 // done.
125 base::MessageLoop::current()->Run(); 126 base::RunLoop().Run();
126 127
127 // Make sure the bounds match of the view that was animated match. 128 // Make sure the bounds match of the view that was animated match.
128 EXPECT_EQ(target_bounds, child()->bounds()); 129 EXPECT_EQ(target_bounds, child()->bounds());
129 130
130 // The parent should have been told to repaint as the animation progressed. 131 // The parent should have been told to repaint as the animation progressed.
131 // The resulting rect is the union of the original and target bounds. 132 // The resulting rect is the union of the original and target bounds.
132 EXPECT_EQ(gfx::UnionRects(target_bounds, initial_bounds), 133 EXPECT_EQ(gfx::UnionRects(target_bounds, initial_bounds),
133 parent()->dirty_rect()); 134 parent()->dirty_rect());
134 } 135 }
135 136
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 176
176 // Shouldn't be animating now. 177 // Shouldn't be animating now.
177 EXPECT_FALSE(animator()->IsAnimating()); 178 EXPECT_FALSE(animator()->IsAnimating());
178 179
179 // Stopping should both cancel the delegate and delete it. 180 // Stopping should both cancel the delegate and delete it.
180 EXPECT_TRUE(OwnedDelegate::GetAndClearDeleted()); 181 EXPECT_TRUE(OwnedDelegate::GetAndClearDeleted());
181 EXPECT_TRUE(OwnedDelegate::GetAndClearCanceled()); 182 EXPECT_TRUE(OwnedDelegate::GetAndClearCanceled());
182 } 183 }
183 184
184 } // namespace views 185 } // namespace views
OLDNEW
« no previous file with comments | « ui/gfx/animation/animation_unittest.cc ('k') | ui/views/controls/menu/menu_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698