| OLD | NEW |
| 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 "ash/aura/wm_window_aura.h" | |
| 6 #include "ash/common/shelf/shelf_layout_manager.h" | 5 #include "ash/common/shelf/shelf_layout_manager.h" |
| 7 #include "ash/common/shelf/wm_shelf.h" | 6 #include "ash/common/shelf/wm_shelf.h" |
| 7 #include "ash/common/wm_window.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/browser_window.h" | 10 #include "chrome/browser/ui/browser_window.h" |
| 11 #include "chrome/browser/ui/status_bubble.h" | 11 #include "chrome/browser/ui/status_bubble.h" |
| 12 #include "chrome/test/base/in_process_browser_test.h" | 12 #include "chrome/test/base/in_process_browser_test.h" |
| 13 | 13 |
| 14 typedef InProcessBrowserTest ShelfBrowserTest; | 14 typedef InProcessBrowserTest ShelfBrowserTest; |
| 15 | 15 |
| 16 // Confirm that a status bubble doesn't cause the shelf to darken. | 16 // Confirm that a status bubble doesn't cause the shelf to darken. |
| 17 IN_PROC_BROWSER_TEST_F(ShelfBrowserTest, StatusBubble) { | 17 IN_PROC_BROWSER_TEST_F(ShelfBrowserTest, StatusBubble) { |
| 18 ash::ShelfLayoutManager* shelf_layout_manager = | 18 ash::ShelfLayoutManager* shelf_layout_manager = |
| 19 ash::WmShelf::ForWindow( | 19 ash::WmShelf::ForWindow( |
| 20 ash::WmWindowAura::Get(browser()->window()->GetNativeWindow())) | 20 ash::WmWindow::Get(browser()->window()->GetNativeWindow())) |
| 21 ->shelf_layout_manager(); | 21 ->shelf_layout_manager(); |
| 22 EXPECT_TRUE(shelf_layout_manager->IsVisible()); | 22 EXPECT_TRUE(shelf_layout_manager->IsVisible()); |
| 23 | 23 |
| 24 // Ensure that the browser abuts the shelf. | 24 // Ensure that the browser abuts the shelf. |
| 25 gfx::Rect bounds = browser()->window()->GetBounds(); | 25 gfx::Rect bounds = browser()->window()->GetBounds(); |
| 26 bounds.set_height(shelf_layout_manager->GetIdealBounds().y() - bounds.y()); | 26 bounds.set_height(shelf_layout_manager->GetIdealBounds().y() - bounds.y()); |
| 27 browser()->window()->SetBounds(bounds); | 27 browser()->window()->SetBounds(bounds); |
| 28 EXPECT_FALSE(shelf_layout_manager->window_overlaps_shelf()); | 28 EXPECT_FALSE(shelf_layout_manager->window_overlaps_shelf()); |
| 29 | 29 |
| 30 // Show status, which may overlap the shelf by a pixel. | 30 // Show status, which may overlap the shelf by a pixel. |
| 31 browser()->window()->GetStatusBubble()->SetStatus( | 31 browser()->window()->GetStatusBubble()->SetStatus( |
| 32 base::UTF8ToUTF16("Dummy Status Text")); | 32 base::UTF8ToUTF16("Dummy Status Text")); |
| 33 shelf_layout_manager->UpdateVisibilityState(); | 33 shelf_layout_manager->UpdateVisibilityState(); |
| 34 | 34 |
| 35 // Ensure that status doesn't cause overlap. | 35 // Ensure that status doesn't cause overlap. |
| 36 EXPECT_FALSE(shelf_layout_manager->window_overlaps_shelf()); | 36 EXPECT_FALSE(shelf_layout_manager->window_overlaps_shelf()); |
| 37 | 37 |
| 38 // Ensure that moving the browser slightly down does cause overlap. | 38 // Ensure that moving the browser slightly down does cause overlap. |
| 39 bounds.Offset(0, 1); | 39 bounds.Offset(0, 1); |
| 40 browser()->window()->SetBounds(bounds); | 40 browser()->window()->SetBounds(bounds); |
| 41 EXPECT_TRUE(shelf_layout_manager->window_overlaps_shelf()); | 41 EXPECT_TRUE(shelf_layout_manager->window_overlaps_shelf()); |
| 42 } | 42 } |
| OLD | NEW |