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

Side by Side Diff: chrome/browser/ui/ash/shelf_browsertest.cc

Issue 1743493002: Cleanup ash shelf accessor functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert ash/shelf/shelf_widget.cc for browser_tests crash... Created 4 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/launcher/chrome_launcher_controller.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 "ash/root_window_controller.h" 5 #include "ash/shelf/shelf.h"
6 #include "ash/shelf/shelf_layout_manager.h" 6 #include "ash/shelf/shelf_layout_manager.h"
7 #include "ash/shell.h"
8 #include "ash/wm/workspace_controller.h"
9 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/ui/browser.h" 8 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/ui/browser_window.h" 9 #include "chrome/browser/ui/browser_window.h"
12 #include "chrome/browser/ui/status_bubble.h" 10 #include "chrome/browser/ui/status_bubble.h"
13 #include "chrome/test/base/in_process_browser_test.h" 11 #include "chrome/test/base/in_process_browser_test.h"
14 12
15 typedef InProcessBrowserTest ShelfBrowserTest; 13 typedef InProcessBrowserTest ShelfBrowserTest;
16 14
17 // Confirm that a status bubble doesn't cause the shelf to darken. 15 // Confirm that a status bubble doesn't cause the shelf to darken.
18 IN_PROC_BROWSER_TEST_F(ShelfBrowserTest, StatusBubble) { 16 IN_PROC_BROWSER_TEST_F(ShelfBrowserTest, StatusBubble) {
19 ash::ShelfLayoutManager* shelf = 17 ash::ShelfLayoutManager* shelf_layout_manager =
20 ash::RootWindowController::ForShelf( 18 ash::Shelf::ForWindow(browser()->window()->GetNativeWindow())
21 browser()->window()->GetNativeWindow())->GetShelfLayoutManager(); 19 ->shelf_layout_manager();
22 EXPECT_TRUE(shelf->IsVisible()); 20 EXPECT_TRUE(shelf_layout_manager->IsVisible());
23 21
24 // Ensure that the browser abuts the shelf. 22 // Ensure that the browser abuts the shelf.
25 const gfx::Rect old_bounds = browser()->window()->GetBounds(); 23 gfx::Rect bounds = browser()->window()->GetBounds();
26 const gfx::Rect new_bounds( 24 bounds.set_height(shelf_layout_manager->GetIdealBounds().y() - bounds.y());
27 old_bounds.x(), 25 browser()->window()->SetBounds(bounds);
28 old_bounds.y(), 26 EXPECT_FALSE(shelf_layout_manager->window_overlaps_shelf());
29 old_bounds.width(),
30 shelf->GetIdealBounds().y() - old_bounds.y());
31 browser()->window()->SetBounds(new_bounds);
32 EXPECT_FALSE(shelf->window_overlaps_shelf());
33 27
34 // Show status, which will overlap the shelf by a pixel. 28 // Show status, which may overlap the shelf by a pixel.
35 browser()->window()->GetStatusBubble()->SetStatus( 29 browser()->window()->GetStatusBubble()->SetStatus(
36 base::UTF8ToUTF16("Dummy Status Text")); 30 base::UTF8ToUTF16("Dummy Status Text"));
37 shelf->UpdateVisibilityState(); 31 shelf_layout_manager->UpdateVisibilityState();
38 32
39 // Ensure that status doesn't cause overlap. 33 // Ensure that status doesn't cause overlap.
40 EXPECT_FALSE(shelf->window_overlaps_shelf()); 34 EXPECT_FALSE(shelf_layout_manager->window_overlaps_shelf());
35
36 // Ensure that moving the browser slightly down does cause overlap.
37 bounds.Offset(0, 1);
38 browser()->window()->SetBounds(bounds);
39 EXPECT_TRUE(shelf_layout_manager->window_overlaps_shelf());
41 } 40 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698