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

Side by Side Diff: chrome/browser/ui/cocoa/website_settings/permission_bubble_cocoa_browser_test.mm

Issue 2748443005: Rename website_settings UI folders to permission_bubble. (Closed)
Patch Set: Rebase. Created 3 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
OLDNEW
(Empty)
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.
4
5 #include "chrome/browser/ui/browser.h"
6 #include "chrome/browser/ui/browser_commands_mac.h"
7 #import "chrome/browser/ui/cocoa/website_settings/permission_bubble_cocoa.h"
8 #import "chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.h "
9 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h"
10 #include "chrome/browser/ui/tabs/tab_strip_model.h"
11 #include "chrome/browser/ui/website_settings/permission_bubble_browser_test_util .h"
12 #include "chrome/common/pref_names.h"
13 #include "components/prefs/pref_service.h"
14 #import "testing/gtest_mac.h"
15 #include "ui/base/test/scoped_fake_nswindow_fullscreen.h"
16
17 IN_PROC_BROWSER_TEST_F(PermissionBubbleBrowserTest, HasLocationBarByDefault) {
18 PermissionBubbleCocoa bubble(browser());
19 bubble.SetDelegate(test_delegate());
20 bubble.Show(requests(), accept_states());
21 EXPECT_TRUE([bubble.bubbleController_ hasVisibleLocationBar]);
22 bubble.Hide();
23 }
24
25 IN_PROC_BROWSER_TEST_F(PermissionBubbleBrowserTest,
26 BrowserFullscreenHasLocationBar) {
27 ui::test::ScopedFakeNSWindowFullscreen faker;
28
29 PermissionBubbleCocoa bubble(browser());
30 bubble.SetDelegate(test_delegate());
31 bubble.Show(requests(), accept_states());
32 EXPECT_TRUE([bubble.bubbleController_ hasVisibleLocationBar]);
33
34 FullscreenController* controller =
35 browser()->exclusive_access_manager()->fullscreen_controller();
36 controller->ToggleBrowserFullscreenMode();
37 faker.FinishTransition();
38
39 // The location bar should be visible if the toolbar is set to be visible in
40 // fullscreen mode.
41 PrefService* prefs = browser()->profile()->GetPrefs();
42 bool show_toolbar = prefs->GetBoolean(prefs::kShowFullscreenToolbar);
43 EXPECT_EQ(show_toolbar, [bubble.bubbleController_ hasVisibleLocationBar]);
44
45 // Toggle the value of the preference.
46 chrome::ToggleFullscreenToolbar(browser());
47 EXPECT_EQ(!show_toolbar, [bubble.bubbleController_ hasVisibleLocationBar]);
48
49 // Put the setting back the way it started.
50 chrome::ToggleFullscreenToolbar(browser());
51 controller->ToggleBrowserFullscreenMode();
52 faker.FinishTransition();
53
54 EXPECT_TRUE([bubble.bubbleController_ hasVisibleLocationBar]);
55 bubble.Hide();
56 }
57
58 IN_PROC_BROWSER_TEST_F(PermissionBubbleBrowserTest,
59 TabFullscreenHasLocationBar) {
60 ui::test::ScopedFakeNSWindowFullscreen faker;
61
62 PermissionBubbleCocoa bubble(browser());
63 bubble.SetDelegate(test_delegate());
64 bubble.Show(requests(), accept_states());
65 EXPECT_TRUE([bubble.bubbleController_ hasVisibleLocationBar]);
66
67 FullscreenController* controller =
68 browser()->exclusive_access_manager()->fullscreen_controller();
69 controller->EnterFullscreenModeForTab(
70 browser()->tab_strip_model()->GetActiveWebContents(), GURL());
71 faker.FinishTransition();
72
73 EXPECT_FALSE([bubble.bubbleController_ hasVisibleLocationBar]);
74 controller->ExitFullscreenModeForTab(
75 browser()->tab_strip_model()->GetActiveWebContents());
76 faker.FinishTransition();
77
78 EXPECT_TRUE([bubble.bubbleController_ hasVisibleLocationBar]);
79 bubble.Hide();
80 }
81
82 IN_PROC_BROWSER_TEST_F(PermissionBubbleBrowserTest, AppHasNoLocationBar) {
83 Browser* app_browser = OpenExtensionAppWindow();
84 PermissionBubbleCocoa bubble(app_browser);
85 bubble.SetDelegate(test_delegate());
86 bubble.Show(requests(), accept_states());
87 EXPECT_FALSE([bubble.bubbleController_ hasVisibleLocationBar]);
88 bubble.Hide();
89 }
90
91 // http://crbug.com/470724
92 // Kiosk mode on Mac has a location bar but it shouldn't.
93 IN_PROC_BROWSER_TEST_F(PermissionBubbleKioskBrowserTest,
94 DISABLED_KioskHasNoLocationBar) {
95 PermissionBubbleCocoa bubble(browser());
96 bubble.SetDelegate(test_delegate());
97 bubble.Show(requests(), accept_states());
98 EXPECT_FALSE([bubble.bubbleController_ hasVisibleLocationBar]);
99 bubble.Hide();
100 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698