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

Side by Side Diff: ash/wm/workspace_controller_unittest.cc

Issue 291843012: compositor: Tick the UI animations from cc, instead of from timer callbacks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ash/wm/workspace_controller.h" 5 #include "ash/wm/workspace_controller.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/root_window_controller.h" 10 #include "ash/root_window_controller.h"
(...skipping 15 matching lines...) Expand all
26 #include "ui/aura/client/aura_constants.h" 26 #include "ui/aura/client/aura_constants.h"
27 #include "ui/aura/test/event_generator.h" 27 #include "ui/aura/test/event_generator.h"
28 #include "ui/aura/test/test_window_delegate.h" 28 #include "ui/aura/test/test_window_delegate.h"
29 #include "ui/aura/test/test_windows.h" 29 #include "ui/aura/test/test_windows.h"
30 #include "ui/aura/window.h" 30 #include "ui/aura/window.h"
31 #include "ui/aura/window_event_dispatcher.h" 31 #include "ui/aura/window_event_dispatcher.h"
32 #include "ui/base/hit_test.h" 32 #include "ui/base/hit_test.h"
33 #include "ui/base/ui_base_types.h" 33 #include "ui/base/ui_base_types.h"
34 #include "ui/compositor/layer.h" 34 #include "ui/compositor/layer.h"
35 #include "ui/compositor/scoped_animation_duration_scale_mode.h" 35 #include "ui/compositor/scoped_animation_duration_scale_mode.h"
36 #include "ui/compositor/test/layer_animator_collection_test_controller.h"
36 #include "ui/events/event_utils.h" 37 #include "ui/events/event_utils.h"
37 #include "ui/gfx/screen.h" 38 #include "ui/gfx/screen.h"
38 #include "ui/views/widget/widget.h" 39 #include "ui/views/widget/widget.h"
39 #include "ui/wm/core/window_animations.h" 40 #include "ui/wm/core/window_animations.h"
40 #include "ui/wm/core/window_util.h" 41 #include "ui/wm/core/window_util.h"
41 42
42 using aura::Window; 43 using aura::Window;
43 44
44 namespace ash { 45 namespace ash {
45 46
(...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 EXPECT_TRUE(window1->layer()->GetAnimator()->is_animating()); 1232 EXPECT_TRUE(window1->layer()->GetAnimator()->is_animating());
1232 EXPECT_TRUE(window2->layer()->GetAnimator()->is_animating()); 1233 EXPECT_TRUE(window2->layer()->GetAnimator()->is_animating());
1233 1234
1234 window1->layer()->GetAnimator()->StopAnimating(); 1235 window1->layer()->GetAnimator()->StopAnimating();
1235 window2->layer()->GetAnimator()->StopAnimating(); 1236 window2->layer()->GetAnimator()->StopAnimating();
1236 // |window1| should be flush right and |window2| flush left. 1237 // |window1| should be flush right and |window2| flush left.
1237 EXPECT_EQ(base::IntToString( 1238 EXPECT_EQ(base::IntToString(
1238 desktop_area.width() - window1->bounds().width()) + 1239 desktop_area.width() - window1->bounds().width()) +
1239 ",32 640x320", window1->bounds().ToString()); 1240 ",32 640x320", window1->bounds().ToString());
1240 EXPECT_EQ("0,48 256x512", window2->bounds().ToString()); 1241 EXPECT_EQ("0,48 256x512", window2->bounds().ToString());
1242 ui::LayerAnimatorCollectionTestController collection_controller(
1243 window1->layer()->GetCompositor()->layer_animator_collection());
1244 collection_controller.StopAllAnimators();
1241 } 1245 }
1242 1246
1243 // This tests simulates a browser and an app and verifies the ordering of the 1247 // This tests simulates a browser and an app and verifies the ordering of the
1244 // windows and layers doesn't get out of sync as various operations occur. Its 1248 // windows and layers doesn't get out of sync as various operations occur. Its
1245 // really testing code in FocusController, but easier to simulate here. Just as 1249 // really testing code in FocusController, but easier to simulate here. Just as
1246 // with a real browser the browser here has a transient child window 1250 // with a real browser the browser here has a transient child window
1247 // (corresponds to the status bubble). 1251 // (corresponds to the status bubble).
1248 TEST_F(WorkspaceControllerTest, VerifyLayerOrdering) { 1252 TEST_F(WorkspaceControllerTest, VerifyLayerOrdering) {
1249 scoped_ptr<Window> browser(aura::test::CreateTestWindowWithDelegate( 1253 scoped_ptr<Window> browser(aura::test::CreateTestWindowWithDelegate(
1250 NULL, ui::wm::WINDOW_TYPE_NORMAL, gfx::Rect(5, 6, 7, 8), NULL)); 1254 NULL, ui::wm::WINDOW_TYPE_NORMAL, gfx::Rect(5, 6, 7, 8), NULL));
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
1629 ui::EventTimeForNow()); 1633 ui::EventTimeForNow());
1630 target = targeter->FindTargetForEvent(root, &touch); 1634 target = targeter->FindTargetForEvent(root, &touch);
1631 if (points[i].is_target_hit) 1635 if (points[i].is_target_hit)
1632 EXPECT_EQ(window.get(), target); 1636 EXPECT_EQ(window.get(), target);
1633 else 1637 else
1634 EXPECT_NE(window.get(), target); 1638 EXPECT_NE(window.get(), target);
1635 } 1639 }
1636 } 1640 }
1637 1641
1638 } // namespace ash 1642 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698