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

Side by Side Diff: chrome/browser/ui/views/immersive_mode_controller_browsertest.cc

Issue 12313118: Refactor: Shelf Widget (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: safer shutdown (status_area_widget_) Created 7 years, 9 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
« no previous file with comments | « chrome/browser/ui/ash/shelf_browsertest.cc ('k') | no next file » | 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 "chrome/browser/ui/views/immersive_mode_controller.h" 5 #include "chrome/browser/ui/views/immersive_mode_controller.h"
6 6
7 #include "chrome/app/chrome_command_ids.h" 7 #include "chrome/app/chrome_command_ids.h"
8 #include "chrome/browser/ui/browser_commands.h" 8 #include "chrome/browser/ui/browser_commands.h"
9 #include "chrome/browser/ui/views/frame/browser_view.h" 9 #include "chrome/browser/ui/views/frame/browser_view.h"
10 #include "chrome/browser/ui/views/tabs/tab.h" 10 #include "chrome/browser/ui/views/tabs/tab.h"
11 #include "chrome/browser/ui/views/tabs/tab_strip.h" 11 #include "chrome/browser/ui/views/tabs/tab_strip.h"
12 #include "chrome/test/base/in_process_browser_test.h" 12 #include "chrome/test/base/in_process_browser_test.h"
13 #include "ui/compositor/layer_animator.h" 13 #include "ui/compositor/layer_animator.h"
14 #include "ui/gfx/rect.h" 14 #include "ui/gfx/rect.h"
15 #include "ui/views/view.h" 15 #include "ui/views/view.h"
16 16
17 #if defined(USE_ASH) 17 #if defined(USE_ASH)
18 #include "ash/root_window_controller.h" 18 #include "ash/root_window_controller.h"
19 #include "ash/shelf_types.h" 19 #include "ash/shelf/shelf_layout_manager.h"
20 #include "ash/shelf/shelf_types.h"
20 #include "ash/shell.h" 21 #include "ash/shell.h"
21 #include "ash/wm/shelf_layout_manager.h"
22 #include "ash/wm/window_properties.h" 22 #include "ash/wm/window_properties.h"
23 #endif 23 #endif
24 24
25 namespace { 25 namespace {
26 26
27 // Returns the bounds of |view| in widget coordinates. 27 // Returns the bounds of |view| in widget coordinates.
28 gfx::Rect GetRectInWidget(views::View* view) { 28 gfx::Rect GetRectInWidget(views::View* view) {
29 return view->ConvertRectToWidget(view->GetLocalBounds()); 29 return view->ConvertRectToWidget(view->GetLocalBounds());
30 } 30 }
31 31
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 // Shelf-specific immersive mode tests. 208 // Shelf-specific immersive mode tests.
209 IN_PROC_BROWSER_TEST_F(ImmersiveModeControllerTest, ImmersiveShelf) { 209 IN_PROC_BROWSER_TEST_F(ImmersiveModeControllerTest, ImmersiveShelf) {
210 ui::LayerAnimator::set_disable_animations_for_test(true); 210 ui::LayerAnimator::set_disable_animations_for_test(true);
211 211
212 BrowserView* browser_view = static_cast<BrowserView*>(browser()->window()); 212 BrowserView* browser_view = static_cast<BrowserView*>(browser()->window());
213 ImmersiveModeController* immersive_controller = 213 ImmersiveModeController* immersive_controller =
214 browser_view->immersive_mode_controller(); 214 browser_view->immersive_mode_controller();
215 215
216 // Shelf is visible when the test starts. 216 // Shelf is visible when the test starts.
217 ash::internal::ShelfLayoutManager* shelf = 217 ash::internal::ShelfLayoutManager* shelf =
218 ash::Shell::GetPrimaryRootWindowController()->shelf(); 218 ash::Shell::GetPrimaryRootWindowController()->GetShelfLayoutManager();
219 ASSERT_EQ(ash::SHELF_VISIBLE, shelf->visibility_state()); 219 ASSERT_EQ(ash::SHELF_VISIBLE, shelf->visibility_state());
220 220
221 // Turning immersive mode on sets the shelf to auto-hide. 221 // Turning immersive mode on sets the shelf to auto-hide.
222 immersive_controller->SetEnabledForTest(true); 222 immersive_controller->SetEnabledForTest(true);
223 chrome::ToggleFullscreenMode(browser()); 223 chrome::ToggleFullscreenMode(browser());
224 ASSERT_TRUE(browser_view->IsFullscreen()); 224 ASSERT_TRUE(browser_view->IsFullscreen());
225 EXPECT_EQ(ash::SHELF_AUTO_HIDE, shelf->visibility_state()); 225 EXPECT_EQ(ash::SHELF_AUTO_HIDE, shelf->visibility_state());
226 226
227 // Disabling immersive mode puts it back. 227 // Disabling immersive mode puts it back.
228 immersive_controller->SetEnabledForTest(false); 228 immersive_controller->SetEnabledForTest(false);
(...skipping 20 matching lines...) Expand all
249 // Setting the window property directly toggles immersive mode. 249 // Setting the window property directly toggles immersive mode.
250 // TODO(jamescook): Is this functionality still needed? 250 // TODO(jamescook): Is this functionality still needed?
251 aura::Window* window = browser_view->GetWidget()->GetNativeWindow(); 251 aura::Window* window = browser_view->GetWidget()->GetNativeWindow();
252 window->SetProperty(ash::internal::kImmersiveModeKey, true); 252 window->SetProperty(ash::internal::kImmersiveModeKey, true);
253 EXPECT_TRUE(immersive_controller->enabled()); 253 EXPECT_TRUE(immersive_controller->enabled());
254 window->SetProperty(ash::internal::kImmersiveModeKey, false); 254 window->SetProperty(ash::internal::kImmersiveModeKey, false);
255 EXPECT_FALSE(immersive_controller->enabled()); 255 EXPECT_FALSE(immersive_controller->enabled());
256 } 256 }
257 257
258 #endif // defined(OS_CHROMEOS) 258 #endif // defined(OS_CHROMEOS)
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/shelf_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698