1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/browser.h"
6 #include "chrome/browser/ui/browser_window.h"
7 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
8 #import "chrome/browser/ui/cocoa/website_settings/permission_bubble_cocoa.h"
9 #import "chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.h"
10 #include "chrome/browser/ui/website_settings/permission_bubble_browser_test_util.h"
11 #import "testing/gtest_mac.h"
12 #import "ui/base/cocoa/fullscreen_window_manager.h"
14 IN_PROC_BROWSER_TEST_F(PermissionBubbleBrowserTest, HasLocationBarByDefault) {
15 PermissionBubbleCocoa bubble(browser());
16 bubble.SetDelegate(test_delegate());
17 bubble.Show(requests(), accept_states());
18 EXPECT_TRUE([bubble.bubbleController_ hasLocationBar]);
22 IN_PROC_BROWSER_TEST_F(PermissionBubbleBrowserTest, FullscreenHasLocationBar) {
23 PermissionBubbleCocoa bubble(browser());
24 bubble.SetDelegate(test_delegate());
25 bubble.Show(requests(), accept_states());
27 NSWindow* window = browser()->window()->GetNativeWindow();
28 base::scoped_nsobject<FullscreenWindowManager> manager(
29 [[FullscreenWindowManager alloc] initWithWindow:window
30 desiredScreen:[NSScreen mainScreen]]);
31 EXPECT_TRUE([bubble.bubbleController_ hasLocationBar]);
32 [manager enterFullscreenMode];
33 EXPECT_TRUE([bubble.bubbleController_ hasLocationBar]);
34 [manager exitFullscreenMode];
35 EXPECT_TRUE([bubble.bubbleController_ hasLocationBar]);
39 IN_PROC_BROWSER_TEST_F(PermissionBubbleBrowserTest, AppHasNoLocationBar) {
40 Browser* app_browser = OpenExtensionAppWindow();
41 PermissionBubbleCocoa bubble(app_browser);
42 bubble.SetDelegate(test_delegate());
43 bubble.Show(requests(), accept_states());
44 EXPECT_FALSE([bubble.bubbleController_ hasLocationBar]);
48 // http://crbug.com/470724
49 // Kiosk mode on Mac has a location bar but it shouldn't.
50 IN_PROC_BROWSER_TEST_F(PermissionBubbleKioskBrowserTest,
51 DISABLED_KioskHasNoLocationBar) {
52 PermissionBubbleCocoa bubble(browser());
53 bubble.SetDelegate(test_delegate());
54 bubble.Show(requests(), accept_states());
55 EXPECT_FALSE([bubble.bubbleController_ hasLocationBar]);