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/shell.h" | 5 #include "ash/shell.h" |
6 #include "ash/wm/shelf_layout_manager.h" | 6 #include "ash/wm/shelf_layout_manager.h" |
7 #include "ash/wm/workspace_controller.h" | 7 #include "ash/wm/workspace_controller.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/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::Shell* shell = ash::Shell::GetInstance(); | 18 ash::Shell* shell = ash::Shell::GetInstance(); |
19 ash::internal::ShelfLayoutManager* shelf = shell->shelf(); | 19 ash::internal::ShelfLayoutManager* shelf = shell->shelf(); |
20 EXPECT_TRUE(shelf->IsVisible()); | 20 EXPECT_TRUE(shelf->IsVisible()); |
21 | 21 |
22 // Ensure that the browser abuts the shelf. | 22 // Ensure that the browser abuts the shelf. |
23 ash::Shell::TestApi(shell).workspace_controller()->SetGridSize(1); | |
24 const gfx::Rect old_bounds = browser()->window()->GetBounds(); | 23 const gfx::Rect old_bounds = browser()->window()->GetBounds(); |
25 const gfx::Rect new_bounds( | 24 const gfx::Rect new_bounds( |
26 old_bounds.x(), | 25 old_bounds.x(), |
27 old_bounds.y(), | 26 old_bounds.y(), |
28 old_bounds.width(), | 27 old_bounds.width(), |
29 shelf->GetIdealBounds().y() - old_bounds.y()); | 28 shelf->GetIdealBounds().y() - old_bounds.y()); |
30 browser()->window()->SetBounds(new_bounds); | 29 browser()->window()->SetBounds(new_bounds); |
31 EXPECT_FALSE(shelf->window_overlaps_shelf()); | 30 EXPECT_FALSE(shelf->window_overlaps_shelf()); |
32 | 31 |
33 // Show status, which will overlap the shelf by a pixel. | 32 // Show status, which will overlap the shelf by a pixel. |
34 browser()->window()->GetStatusBubble()->SetStatus( | 33 browser()->window()->GetStatusBubble()->SetStatus( |
35 UTF8ToUTF16("Dummy Status Text")); | 34 UTF8ToUTF16("Dummy Status Text")); |
36 shelf->UpdateVisibilityState(); | 35 shelf->UpdateVisibilityState(); |
37 | 36 |
38 // Ensure that status doesn't cause overlap. | 37 // Ensure that status doesn't cause overlap. |
39 EXPECT_FALSE(shelf->window_overlaps_shelf()); | 38 EXPECT_FALSE(shelf->window_overlaps_shelf()); |
40 } | 39 } |
OLD | NEW |