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

Side by Side Diff: ash/wm/overview/window_selector_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/accessibility_delegate.h" 5 #include "ash/accessibility_delegate.h"
6 #include "ash/drag_drop/drag_drop_controller.h" 6 #include "ash/drag_drop/drag_drop_controller.h"
7 #include "ash/root_window_controller.h" 7 #include "ash/root_window_controller.h"
8 #include "ash/screen_util.h" 8 #include "ash/screen_util.h"
9 #include "ash/shelf/shelf.h" 9 #include "ash/shelf/shelf.h"
10 #include "ash/shelf/shelf_widget.h" 10 #include "ash/shelf/shelf_widget.h"
(...skipping 18 matching lines...) Expand all
29 #include "base/strings/utf_string_conversions.h" 29 #include "base/strings/utf_string_conversions.h"
30 #include "ui/aura/client/aura_constants.h" 30 #include "ui/aura/client/aura_constants.h"
31 #include "ui/aura/client/cursor_client.h" 31 #include "ui/aura/client/cursor_client.h"
32 #include "ui/aura/client/focus_client.h" 32 #include "ui/aura/client/focus_client.h"
33 #include "ui/aura/test/event_generator.h" 33 #include "ui/aura/test/event_generator.h"
34 #include "ui/aura/test/test_window_delegate.h" 34 #include "ui/aura/test/test_window_delegate.h"
35 #include "ui/aura/test/test_windows.h" 35 #include "ui/aura/test/test_windows.h"
36 #include "ui/aura/window.h" 36 #include "ui/aura/window.h"
37 #include "ui/aura/window_event_dispatcher.h" 37 #include "ui/aura/window_event_dispatcher.h"
38 #include "ui/compositor/scoped_animation_duration_scale_mode.h" 38 #include "ui/compositor/scoped_animation_duration_scale_mode.h"
39 #include "ui/compositor/test/layer_animator_collection_test_controller.h"
39 #include "ui/gfx/rect_conversions.h" 40 #include "ui/gfx/rect_conversions.h"
40 #include "ui/gfx/transform.h" 41 #include "ui/gfx/transform.h"
41 #include "ui/views/controls/label.h" 42 #include "ui/views/controls/label.h"
42 #include "ui/views/widget/native_widget_aura.h" 43 #include "ui/views/widget/native_widget_aura.h"
43 #include "ui/wm/core/window_util.h" 44 #include "ui/wm/core/window_util.h"
44 #include "ui/wm/public/activation_delegate.h" 45 #include "ui/wm/public/activation_delegate.h"
45 46
46 namespace ash { 47 namespace ash {
47 namespace { 48 namespace {
48 49
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 EXPECT_TRUE(window1->IsVisible()); 320 EXPECT_TRUE(window1->IsVisible());
320 EXPECT_TRUE(window1->layer()->GetTargetVisibility()); 321 EXPECT_TRUE(window1->layer()->GetTargetVisibility());
321 } 322 }
322 { 323 {
323 ui::ScopedAnimationDurationScaleMode normal_duration_mode( 324 ui::ScopedAnimationDurationScaleMode normal_duration_mode(
324 ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION); 325 ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION);
325 ToggleOverview(); 326 ToggleOverview();
326 EXPECT_FALSE(window1->IsVisible()); 327 EXPECT_FALSE(window1->IsVisible());
327 EXPECT_FALSE(window1->layer()->GetTargetVisibility()); 328 EXPECT_FALSE(window1->layer()->GetTargetVisibility());
328 } 329 }
330
331 // Toggling overview mode initiates animations on |window1|, as well as other
332 // windows used for the overview mode. Make sure the animations are stopped to
333 // avoid leaking the animators.
334 ui::LayerAnimatorCollectionTestController collection_controller(
335 window1->layer()->GetCompositor()->layer_animator_collection());
336 collection_controller.StopAllAnimators();
329 } 337 }
330 338
331 // Tests that a bounds change during overview is corrected for. 339 // Tests that a bounds change during overview is corrected for.
332 TEST_F(WindowSelectorTest, BoundsChangeDuringOverview) { 340 TEST_F(WindowSelectorTest, BoundsChangeDuringOverview) {
333 scoped_ptr<aura::Window> window(CreateWindow(gfx::Rect(0, 0, 400, 400))); 341 scoped_ptr<aura::Window> window(CreateWindow(gfx::Rect(0, 0, 400, 400)));
334 ToggleOverview(); 342 ToggleOverview();
335 gfx::Rect overview_bounds = 343 gfx::Rect overview_bounds =
336 ToEnclosingRect(GetTransformedTargetBounds(window.get())); 344 ToEnclosingRect(GetTransformedTargetBounds(window.get()));
337 window->SetBounds(gfx::Rect(200, 0, 200, 200)); 345 window->SetBounds(gfx::Rect(200, 0, 200, 200));
338 gfx::Rect new_overview_bounds = 346 gfx::Rect new_overview_bounds =
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 UpdateDisplay("600x200/r"); 737 UpdateDisplay("600x200/r");
730 EXPECT_EQ("0,0 200x600", root_window->bounds().ToString()); 738 EXPECT_EQ("0,0 200x600", root_window->bounds().ToString());
731 for (ScopedVector<aura::Window>::iterator iter = windows.begin(); 739 for (ScopedVector<aura::Window>::iterator iter = windows.begin();
732 iter != windows.end(); ++iter) { 740 iter != windows.end(); ++iter) {
733 EXPECT_TRUE(root_window->bounds().Contains( 741 EXPECT_TRUE(root_window->bounds().Contains(
734 ToEnclosingRect(GetTransformedTargetBounds(*iter)))); 742 ToEnclosingRect(GetTransformedTargetBounds(*iter))));
735 } 743 }
736 } 744 }
737 745
738 } // namespace ash 746 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698