| Index: chrome/browser/ui/views/frame/immersive_mode_controller_ash_unittest.cc
|
| diff --git a/chrome/browser/ui/views/frame/immersive_mode_controller_ash_unittest.cc b/chrome/browser/ui/views/frame/immersive_mode_controller_ash_unittest.cc
|
| index c09c9e13470469f86951ea30eafc811a03d7cdb9..a9ea1a52c39e927eb67d13334cd398c64bd8a137 100644
|
| --- a/chrome/browser/ui/views/frame/immersive_mode_controller_ash_unittest.cc
|
| +++ b/chrome/browser/ui/views/frame/immersive_mode_controller_ash_unittest.cc
|
| @@ -5,6 +5,7 @@
|
| #include "chrome/browser/ui/views/frame/immersive_mode_controller_ash.h"
|
|
|
| #include "ash/display/display_controller.h"
|
| +#include "ash/screen_ash.h"
|
| #include "ash/shell.h"
|
| #include "ash/test/ash_test_base.h"
|
| #include "chrome/app/chrome_command_ids.h"
|
| @@ -48,9 +49,6 @@ class MockImmersiveModeControllerDelegate
|
| virtual void SetImmersiveStyle(bool immersive) OVERRIDE {
|
| immersive_style_ = immersive;
|
| }
|
| - virtual content::WebContents* GetWebContents() OVERRIDE {
|
| - return NULL;
|
| - }
|
|
|
| private:
|
| bool immersive_style_;
|
| @@ -58,6 +56,21 @@ class MockImmersiveModeControllerDelegate
|
| DISALLOW_COPY_AND_ASSIGN(MockImmersiveModeControllerDelegate);
|
| };
|
|
|
| +// View which consumes all touch events.
|
| +class TouchEventConsumerView : public views::View {
|
| + public:
|
| + TouchEventConsumerView() {
|
| + }
|
| + virtual ~TouchEventConsumerView() {
|
| + }
|
| +
|
| + virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE {
|
| + event->SetHandled();
|
| + }
|
| + private:
|
| + DISALLOW_COPY_AND_ASSIGN(TouchEventConsumerView);
|
| +};
|
| +
|
| /////////////////////////////////////////////////////////////////////////////
|
|
|
| class ImmersiveModeControllerAshTest : public ash::test::AshTestBase {
|
| @@ -975,4 +988,50 @@ TEST_F(ImmersiveModeControllerAshTestWithBrowserView, ExitUponRestore) {
|
| EXPECT_FALSE(controller()->IsEnabled());
|
| }
|
|
|
| +// Test that it is still possible to reveal and hide the top-of-window views
|
| +// via a gesture when a child window consumes touch events.
|
| +TEST_F(ImmersiveModeControllerAshTestWithBrowserView,
|
| + RevealViaGestureChildWindowConsumesTouchEvents) {
|
| + views::Widget* browser_widget = browser_view()->GetWidget();
|
| +
|
| + // Create a child widget which consumes all touch events.
|
| + views::Widget::InitParams child_params(
|
| + views::Widget::InitParams::TYPE_CONTROL);
|
| + child_params.ownership =
|
| + views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
|
| + child_params.parent = browser_widget->GetNativeView();
|
| + child_params.bounds =
|
| + gfx::Rect(browser_widget->GetWindowBoundsInScreen().size());
|
| + scoped_ptr<views::Widget> child_widget(new views::Widget());
|
| + child_widget->Init(child_params);
|
| + child_widget->SetContentsView(new TouchEventConsumerView());
|
| + child_widget->Show();
|
| +
|
| + ASSERT_FALSE(controller()->IsEnabled());
|
| + chrome::ToggleFullscreenMode(browser());
|
| + ASSERT_TRUE(controller()->IsEnabled());
|
| + EXPECT_FALSE(controller()->IsRevealed());
|
| +
|
| + gfx::Rect top_container_bounds_in_root =
|
| + ash::ScreenAsh::ConvertRectFromScreen(
|
| + browser_widget->GetNativeView()->GetRootWindow(),
|
| + browser_view()->top_container()->GetBoundsInScreen());
|
| +
|
| + gfx::Point top(top_container_bounds_in_root.origin());
|
| + gfx::Point bottom = top + gfx::Vector2d(0, 100);
|
| + aura::test::EventGenerator generator(
|
| + browser_widget->GetNativeView()->GetRootWindow());
|
| + generator.GestureScrollSequence(top,
|
| + bottom,
|
| + base::TimeDelta::FromMilliseconds(10),
|
| + 3);
|
| + EXPECT_TRUE(controller()->IsRevealed());
|
| +
|
| + generator.GestureScrollSequence(bottom,
|
| + top,
|
| + base::TimeDelta::FromMilliseconds(10),
|
| + 3);
|
| + EXPECT_FALSE(controller()->IsRevealed());
|
| +}
|
| +
|
| #endif // defined(OS_CHROMEOS)
|
|
|