Index: ui/views/widget/native_widget_aura_unittest.cc |
diff --git a/ui/views/widget/native_widget_aura_unittest.cc b/ui/views/widget/native_widget_aura_unittest.cc |
index 159e82f9443534c5b2ea4884daeaa1d2a76a2753..c53ce4d5186fb733f6ddf30cbbd747f8f1fbef64 100644 |
--- a/ui/views/widget/native_widget_aura_unittest.cc |
+++ b/ui/views/widget/native_widget_aura_unittest.cc |
@@ -100,39 +100,30 @@ |
widget->CloseNow(); |
} |
-class TestLayoutManagerBase : public aura::LayoutManager { |
+// Used by ShowMaximizedDoesntBounceAround. See it for details. |
+class TestLayoutManager : public aura::LayoutManager { |
public: |
- TestLayoutManagerBase() {} |
- virtual ~TestLayoutManagerBase() {} |
- |
- // aura::LayoutManager: |
- virtual void OnWindowResized() OVERRIDE {} |
- virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE {} |
- virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE {} |
- virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE {} |
- virtual void OnChildWindowVisibilityChanged(aura::Window* child, |
- bool visible) OVERRIDE {} |
- virtual void SetChildBounds(aura::Window* child, |
- const gfx::Rect& requested_bounds) OVERRIDE {} |
- |
- private: |
- DISALLOW_COPY_AND_ASSIGN(TestLayoutManagerBase); |
-}; |
- |
-// Used by ShowMaximizedDoesntBounceAround. See it for details. |
-class MaximizeLayoutManager : public TestLayoutManagerBase { |
- public: |
- MaximizeLayoutManager() {} |
- virtual ~MaximizeLayoutManager() {} |
- |
- private: |
- // aura::LayoutManager: |
+ TestLayoutManager() {} |
+ |
+ virtual void OnWindowResized() OVERRIDE { |
+ } |
virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE { |
// This simulates what happens when adding a maximized window. |
SetChildBoundsDirect(child, gfx::Rect(0, 0, 300, 300)); |
} |
- |
- DISALLOW_COPY_AND_ASSIGN(MaximizeLayoutManager); |
+ virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE { |
+ } |
+ virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE { |
+ } |
+ virtual void OnChildWindowVisibilityChanged(aura::Window* child, |
+ bool visible) OVERRIDE { |
+ } |
+ virtual void SetChildBounds(aura::Window* child, |
+ const gfx::Rect& requested_bounds) OVERRIDE { |
+ } |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(TestLayoutManager); |
}; |
// This simulates BrowserView, which creates a custom RootView so that |
@@ -169,7 +160,7 @@ |
// leads to noticable flashes. |
TEST_F(NativeWidgetAuraTest, ShowMaximizedDoesntBounceAround) { |
root_window()->SetBounds(gfx::Rect(0, 0, 640, 480)); |
- root_window()->SetLayoutManager(new MaximizeLayoutManager); |
+ root_window()->SetLayoutManager(new TestLayoutManager); |
scoped_ptr<TestWidget> widget(new TestWidget()); |
Widget::InitParams params(Widget::InitParams::TYPE_WINDOW); |
params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
@@ -182,67 +173,6 @@ |
widget->CloseNow(); |
} |
-class PropertyTestLayoutManager : public TestLayoutManagerBase { |
- public: |
- PropertyTestLayoutManager() : added_(false) {} |
- virtual ~PropertyTestLayoutManager() {} |
- |
- bool added() const { return added_; } |
- |
- private: |
- // aura::LayoutManager: |
- virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE { |
- EXPECT_TRUE(child->GetProperty(aura::client::kCanMaximizeKey)); |
- EXPECT_TRUE(child->GetProperty(aura::client::kCanResizeKey)); |
- added_ = true; |
- } |
- |
- bool added_; |
- |
- DISALLOW_COPY_AND_ASSIGN(PropertyTestLayoutManager); |
-}; |
- |
-class PropertyTestWidgetDelegate : public views::WidgetDelegate { |
- public: |
- explicit PropertyTestWidgetDelegate(Widget* widget) : widget_(widget) {} |
- virtual ~PropertyTestWidgetDelegate() {} |
- |
- private: |
- // views::WidgetDelegate: |
- virtual bool CanMaximize() const OVERRIDE { |
- return true; |
- } |
- virtual bool CanResize() const OVERRIDE { |
- return true; |
- } |
- virtual Widget* GetWidget() OVERRIDE { |
- return widget_; |
- } |
- virtual const Widget* GetWidget() const OVERRIDE { |
- return widget_; |
- } |
- |
- Widget* widget_; |
- DISALLOW_COPY_AND_ASSIGN(PropertyTestWidgetDelegate); |
-}; |
- |
-// Verifies that the kCanMaximizeKey/kCanReizeKey have the correct |
-// value when added to the layout manager. |
-TEST_F(NativeWidgetAuraTest, TestPropertiesWhenAddedToLayout) { |
- root_window()->SetBounds(gfx::Rect(0, 0, 640, 480)); |
- PropertyTestLayoutManager* layout_manager = new PropertyTestLayoutManager(); |
- root_window()->SetLayoutManager(layout_manager); |
- scoped_ptr<TestWidget> widget(new TestWidget()); |
- Widget::InitParams params(Widget::InitParams::TYPE_WINDOW); |
- params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
- params.delegate = new PropertyTestWidgetDelegate(widget.get()); |
- params.parent = NULL; |
- params.context = root_window(); |
- widget->Init(params); |
- EXPECT_TRUE(layout_manager->added()); |
- widget->CloseNow(); |
-} |
- |
TEST_F(NativeWidgetAuraTest, GetClientAreaScreenBounds) { |
// Create a widget. |
Widget::InitParams params(Widget::InitParams::TYPE_WINDOW); |
@@ -260,6 +190,8 @@ |
EXPECT_EQ(400, client_bounds.height()); |
} |
+namespace { |
+ |
// View subclass that tracks whether it has gotten a gesture event. |
class GestureTrackingView : public views::View { |
public: |
@@ -294,6 +226,8 @@ |
DISALLOW_COPY_AND_ASSIGN(GestureTrackingView); |
}; |
+ |
+} // namespace |
// Verifies a capture isn't set on touch press and that the view that gets |
// the press gets the release. |