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

Side by Side Diff: ui/views/widget/widget_unittest.cc

Issue 420013002: Introduce NON_ZERO_DURATION for animation unit tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: content_unittests Created 6 years, 4 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
« no previous file with comments | « ui/views/controls/textfield/textfield.cc ('k') | ui/wm/core/visibility_controller_unittest.cc » ('j') | 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 <algorithm> 5 #include <algorithm>
6 #include <set> 6 #include <set>
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 1838 matching lines...) Expand 10 before | Expand all | Expand 10 after
1849 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 1849 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
1850 params.bounds = gfx::Rect(50, 50, 250, 250); 1850 params.bounds = gfx::Rect(50, 50, 250, 250);
1851 widget->Init(params); 1851 widget->Init(params);
1852 AnimationEndObserver animation_observer; 1852 AnimationEndObserver animation_observer;
1853 WidgetBoundsObserver widget_observer; 1853 WidgetBoundsObserver widget_observer;
1854 gfx::Rect bounds(0, 0, 50, 50); 1854 gfx::Rect bounds(0, 0, 50, 50);
1855 { 1855 {
1856 // Normal animations for tests have ZERO_DURATION, make sure we are actually 1856 // Normal animations for tests have ZERO_DURATION, make sure we are actually
1857 // animating the movement. 1857 // animating the movement.
1858 ui::ScopedAnimationDurationScaleMode animation_scale_mode( 1858 ui::ScopedAnimationDurationScaleMode animation_scale_mode(
1859 ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION); 1859 ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
1860 ui::ScopedLayerAnimationSettings animation_settings( 1860 ui::ScopedLayerAnimationSettings animation_settings(
1861 widget->GetLayer()->GetAnimator()); 1861 widget->GetLayer()->GetAnimator());
1862 animation_settings.AddObserver(&animation_observer); 1862 animation_settings.AddObserver(&animation_observer);
1863 widget->AddObserver(&widget_observer); 1863 widget->AddObserver(&widget_observer);
1864 widget->Show(); 1864 widget->Show();
1865 1865
1866 // Animate the bounds change. 1866 // Animate the bounds change.
1867 widget->SetBounds(bounds); 1867 widget->SetBounds(bounds);
1868 widget.reset(); 1868 widget.reset();
1869 EXPECT_FALSE(animation_observer.animation_completed()); 1869 EXPECT_FALSE(animation_observer.animation_completed());
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after
2728 EXPECT_EQ(3, view->GetEventCount(ui::ET_MOUSE_PRESSED)); 2728 EXPECT_EQ(3, view->GetEventCount(ui::ET_MOUSE_PRESSED));
2729 EXPECT_EQ(3, view->GetEventCount(ui::ET_MOUSE_RELEASED)); 2729 EXPECT_EQ(3, view->GetEventCount(ui::ET_MOUSE_RELEASED));
2730 EXPECT_EQ(1, view->GetEventCount(ui::ET_MOUSE_DRAGGED)); 2730 EXPECT_EQ(1, view->GetEventCount(ui::ET_MOUSE_DRAGGED));
2731 EXPECT_EQ(ui::EF_LEFT_MOUSE_BUTTON, view->last_flags()); 2731 EXPECT_EQ(ui::EF_LEFT_MOUSE_BUTTON, view->last_flags());
2732 2732
2733 widget->CloseNow(); 2733 widget->CloseNow();
2734 } 2734 }
2735 2735
2736 } // namespace test 2736 } // namespace test
2737 } // namespace views 2737 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/textfield/textfield.cc ('k') | ui/wm/core/visibility_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698