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

Side by Side Diff: chrome/browser/ui/views/frame/immersive_mode_controller_ash_unittest.cc

Issue 32943006: [Refactor] Replace kFullscreenUsesMinimalChromeKey with WindowState::hide_shelf_when_fullscreen() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 "chrome/browser/ui/views/frame/immersive_mode_controller_ash.h" 5 #include "chrome/browser/ui/views/frame/immersive_mode_controller_ash.h"
6 6
7 #include "ash/display/display_manager.h" 7 #include "ash/display/display_manager.h"
8 #include "ash/screen_ash.h"
8 #include "ash/shell.h" 9 #include "ash/shell.h"
9 #include "ash/test/ash_test_base.h" 10 #include "ash/test/ash_test_base.h"
10 #include "chrome/app/chrome_command_ids.h" 11 #include "chrome/app/chrome_command_ids.h"
11 #include "chrome/browser/ui/browser_commands.h" 12 #include "chrome/browser/ui/browser_commands.h"
12 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" 13 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h"
13 #include "chrome/browser/ui/fullscreen/fullscreen_controller_test.h" 14 #include "chrome/browser/ui/fullscreen/fullscreen_controller_test.h"
14 #include "chrome/browser/ui/immersive_fullscreen_configuration.h" 15 #include "chrome/browser/ui/immersive_fullscreen_configuration.h"
15 #include "chrome/browser/ui/views/frame/browser_view.h" 16 #include "chrome/browser/ui/views/frame/browser_view.h"
16 #include "chrome/browser/ui/views/frame/test_with_browser_view.h" 17 #include "chrome/browser/ui/views/frame/test_with_browser_view.h"
17 #include "chrome/browser/ui/views/frame/top_container_view.h" 18 #include "chrome/browser/ui/views/frame/top_container_view.h"
18 #include "chrome/browser/ui/views/tabs/tab_strip.h" 19 #include "chrome/browser/ui/views/tabs/tab_strip.h"
19 #include "chrome/browser/ui/views/toolbar_view.h" 20 #include "chrome/browser/ui/views/toolbar_view.h"
21 #include "ui/aura/client/aura_constants.h"
20 #include "ui/aura/client/cursor_client.h" 22 #include "ui/aura/client/cursor_client.h"
21 #include "ui/aura/env.h" 23 #include "ui/aura/env.h"
22 #include "ui/aura/root_window.h" 24 #include "ui/aura/root_window.h"
23 #include "ui/aura/test/event_generator.h" 25 #include "ui/aura/test/event_generator.h"
24 #include "ui/aura/window.h" 26 #include "ui/aura/window.h"
27 #include "ui/base/ui_base_types.h"
25 #include "ui/gfx/animation/slide_animation.h" 28 #include "ui/gfx/animation/slide_animation.h"
26 #include "ui/views/bubble/bubble_delegate.h" 29 #include "ui/views/bubble/bubble_delegate.h"
27 #include "ui/views/controls/webview/webview.h" 30 #include "ui/views/controls/webview/webview.h"
28 31
29 // For now, immersive fullscreen is Chrome OS only. 32 // For now, immersive fullscreen is Chrome OS only.
30 #if defined(OS_CHROMEOS) 33 #if defined(OS_CHROMEOS)
31 34
32 ///////////////////////////////////////////////////////////////////////////// 35 /////////////////////////////////////////////////////////////////////////////
33 36
34 class MockImmersiveModeControllerDelegate 37 class MockImmersiveModeControllerDelegate
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 91
89 ImmersiveFullscreenConfiguration::EnableImmersiveFullscreenForTest(); 92 ImmersiveFullscreenConfiguration::EnableImmersiveFullscreenForTest();
90 ASSERT_TRUE(ImmersiveFullscreenConfiguration::UseImmersiveFullscreen()); 93 ASSERT_TRUE(ImmersiveFullscreenConfiguration::UseImmersiveFullscreen());
91 94
92 controller_.reset(new ImmersiveModeControllerAsh); 95 controller_.reset(new ImmersiveModeControllerAsh);
93 delegate_.reset(new MockImmersiveModeControllerDelegate); 96 delegate_.reset(new MockImmersiveModeControllerDelegate);
94 97
95 widget_ = new views::Widget(); 98 widget_ = new views::Widget();
96 views::Widget::InitParams params; 99 views::Widget::InitParams params;
97 params.context = CurrentContext(); 100 params.context = CurrentContext();
98 params.bounds = gfx::Rect(0, 0, 500, 500);
99 widget_->Init(params); 101 widget_->Init(params);
100 widget_->Show(); 102 widget_->Show();
101 103
104 widget_->GetNativeWindow()->SetProperty(aura::client::kShowStateKey,
105 ui::SHOW_STATE_FULLSCREEN);
106
102 top_container_ = new views::View(); 107 top_container_ = new views::View();
103 top_container_->SetBounds(0, 0, 500, 100); 108 top_container_->SetBounds(
109 0, 0, widget_->GetWindowBoundsInScreen().width(), 100);
104 top_container_->set_focusable(true); 110 top_container_->set_focusable(true);
105 111
106 widget_->GetContentsView()->AddChildView(top_container_); 112 widget_->GetContentsView()->AddChildView(top_container_);
107 113
108 controller_->Init(delegate_.get(), widget_, top_container_); 114 controller_->Init(delegate_.get(), widget_, top_container_);
109 SetAnimationsDisabled(true); 115 SetAnimationsDisabled(true);
110 116
111 // The mouse is moved so that it is not over |top_container_| by 117 // The mouse is moved so that it is not over |top_container_| by
112 // AshTestBase. 118 // AshTestBase.
113 } 119 }
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 controller()->SetEnabled(false); 249 controller()->SetEnabled(false);
244 EXPECT_FALSE(controller()->IsEnabled()); 250 EXPECT_FALSE(controller()->IsEnabled());
245 EXPECT_FALSE(controller()->IsRevealed()); 251 EXPECT_FALSE(controller()->IsRevealed());
246 EXPECT_FALSE(controller()->ShouldHideTopViews()); 252 EXPECT_FALSE(controller()->ShouldHideTopViews());
247 EXPECT_FALSE(delegate()->immersive_style()); 253 EXPECT_FALSE(delegate()->immersive_style());
248 } 254 }
249 255
250 // Test mouse event processing for top-of-screen reveal triggering. 256 // Test mouse event processing for top-of-screen reveal triggering.
251 TEST_F(ImmersiveModeControllerAshTest, OnMouseEvent) { 257 TEST_F(ImmersiveModeControllerAshTest, OnMouseEvent) {
252 // Set up initial state. 258 // Set up initial state.
259 UpdateDisplay("800x600,800x600");
260 ash::DisplayLayout display_layout(ash::DisplayLayout::RIGHT, 0);
261 ash::Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays(
262 display_layout);
263
264 // Set up initial state.
253 controller()->SetEnabled(true); 265 controller()->SetEnabled(true);
254 ASSERT_TRUE(controller()->IsEnabled()); 266 ASSERT_TRUE(controller()->IsEnabled());
255 ASSERT_FALSE(controller()->IsRevealed()); 267 ASSERT_FALSE(controller()->IsRevealed());
256 268
257 aura::test::EventGenerator& event_generator(GetEventGenerator()); 269 aura::test::EventGenerator& event_generator(GetEventGenerator());
258 270
259 gfx::Rect top_container_bounds_in_screen = 271 gfx::Rect top_container_bounds_in_screen =
260 top_container()->GetBoundsInScreen(); 272 top_container()->GetBoundsInScreen();
261 // A position along the top edge of TopContainerView in screen coordinates. 273 // A position along the top edge of TopContainerView in screen coordinates.
262 gfx::Point top_edge_pos(top_container_bounds_in_screen.x() + 100, 274 gfx::Point top_edge_pos(top_container_bounds_in_screen.x() + 100,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 EXPECT_TRUE(top_edge_hover_timer_running()); 306 EXPECT_TRUE(top_edge_hover_timer_running());
295 EXPECT_EQ(top_edge_pos.x(), mouse_x_when_hit_top()); 307 EXPECT_EQ(top_edge_pos.x(), mouse_x_when_hit_top());
296 308
297 // Large move right restarts the timer (so it is still running) and considers 309 // Large move right restarts the timer (so it is still running) and considers
298 // this a new hit at the top. 310 // this a new hit at the top.
299 event_generator.MoveMouseTo(top_edge_pos.x() + 100, top_edge_pos.y()); 311 event_generator.MoveMouseTo(top_edge_pos.x() + 100, top_edge_pos.y());
300 EXPECT_TRUE(top_edge_hover_timer_running()); 312 EXPECT_TRUE(top_edge_hover_timer_running());
301 EXPECT_EQ(top_edge_pos.x() + 100, mouse_x_when_hit_top()); 313 EXPECT_EQ(top_edge_pos.x() + 100, mouse_x_when_hit_top());
302 314
303 // Moving off the top edge horizontally stops the timer. 315 // Moving off the top edge horizontally stops the timer.
304 EXPECT_GT(CurrentContext()->bounds().width(), top_container()->width()); 316 event_generator.MoveMouseTo(top_container_bounds_in_screen.right() + 1,
305 event_generator.MoveMouseTo(top_container_bounds_in_screen.right(),
306 top_container_bounds_in_screen.y()); 317 top_container_bounds_in_screen.y());
307 EXPECT_FALSE(top_edge_hover_timer_running()); 318 EXPECT_FALSE(top_edge_hover_timer_running());
308 319
309 // Once revealed, a move just a little below the top container doesn't end a 320 // Once revealed, a move just a little below the top container doesn't end a
310 // reveal. 321 // reveal.
311 AttemptReveal(MODALITY_MOUSE); 322 AttemptReveal(MODALITY_MOUSE);
312 event_generator.MoveMouseTo(top_container_bounds_in_screen.x(), 323 event_generator.MoveMouseTo(top_container_bounds_in_screen.x(),
313 top_container_bounds_in_screen.bottom() + 1); 324 top_container_bounds_in_screen.bottom() + 1);
314 EXPECT_TRUE(controller()->IsRevealed()); 325 EXPECT_TRUE(controller()->IsRevealed());
315 326
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 979
969 browser_view()->GetWidget()->Restore(); 980 browser_view()->GetWidget()->Restore();
970 // Exiting immersive fullscreen occurs as a result of a task posted to the 981 // Exiting immersive fullscreen occurs as a result of a task posted to the
971 // message loop. 982 // message loop.
972 content::RunAllPendingInMessageLoop(); 983 content::RunAllPendingInMessageLoop();
973 984
974 EXPECT_FALSE(controller()->IsEnabled()); 985 EXPECT_FALSE(controller()->IsEnabled());
975 } 986 }
976 987
977 #endif // defined(OS_CHROMEOS) 988 #endif // defined(OS_CHROMEOS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698