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

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

Issue 2868783002: Move requests from Show() argument to PermissionPrompt::Delegate (Closed)
Patch Set: tweak comment Created 3 years, 7 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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 "chrome/browser/ui/browser.h" 5 #include "chrome/browser/ui/browser.h"
6 #include "chrome/browser/ui/browser_commands_mac.h" 6 #include "chrome/browser/ui/browser_commands_mac.h"
7 #import "chrome/browser/ui/cocoa/permission_bubble/permission_bubble_cocoa.h" 7 #import "chrome/browser/ui/cocoa/permission_bubble/permission_bubble_cocoa.h"
8 #import "chrome/browser/ui/cocoa/permission_bubble/permission_bubble_controller. h" 8 #import "chrome/browser/ui/cocoa/permission_bubble/permission_bubble_controller. h"
9 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" 9 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h"
10 #include "chrome/browser/ui/permission_bubble/permission_bubble_browser_test_uti l.h" 10 #include "chrome/browser/ui/permission_bubble/permission_bubble_browser_test_uti l.h"
11 #include "chrome/browser/ui/tabs/tab_strip_model.h" 11 #include "chrome/browser/ui/tabs/tab_strip_model.h"
12 #include "chrome/common/pref_names.h" 12 #include "chrome/common/pref_names.h"
13 #include "components/prefs/pref_service.h" 13 #include "components/prefs/pref_service.h"
14 #import "testing/gtest_mac.h" 14 #import "testing/gtest_mac.h"
15 #include "ui/base/test/scoped_fake_nswindow_fullscreen.h" 15 #include "ui/base/test/scoped_fake_nswindow_fullscreen.h"
16 16
17 IN_PROC_BROWSER_TEST_F(PermissionBubbleBrowserTest, HasLocationBarByDefault) { 17 IN_PROC_BROWSER_TEST_F(PermissionBubbleBrowserTest, HasLocationBarByDefault) {
18 PermissionBubbleCocoa bubble(browser()); 18 PermissionBubbleCocoa bubble(browser());
19 bubble.SetDelegate(test_delegate()); 19 bubble.SetDelegate(test_delegate());
20 bubble.Show(requests(), accept_states()); 20 bubble.Show();
21 EXPECT_TRUE([bubble.bubbleController_ hasVisibleLocationBar]); 21 EXPECT_TRUE([bubble.bubbleController_ hasVisibleLocationBar]);
22 bubble.Hide(); 22 bubble.Hide();
23 } 23 }
24 24
25 IN_PROC_BROWSER_TEST_F(PermissionBubbleBrowserTest, 25 IN_PROC_BROWSER_TEST_F(PermissionBubbleBrowserTest,
26 BrowserFullscreenHasLocationBar) { 26 BrowserFullscreenHasLocationBar) {
27 ui::test::ScopedFakeNSWindowFullscreen faker; 27 ui::test::ScopedFakeNSWindowFullscreen faker;
28 28
29 PermissionBubbleCocoa bubble(browser()); 29 PermissionBubbleCocoa bubble(browser());
30 bubble.SetDelegate(test_delegate()); 30 bubble.SetDelegate(test_delegate());
31 bubble.Show(requests(), accept_states()); 31 bubble.Show();
32 EXPECT_TRUE([bubble.bubbleController_ hasVisibleLocationBar]); 32 EXPECT_TRUE([bubble.bubbleController_ hasVisibleLocationBar]);
33 33
34 FullscreenController* controller = 34 FullscreenController* controller =
35 browser()->exclusive_access_manager()->fullscreen_controller(); 35 browser()->exclusive_access_manager()->fullscreen_controller();
36 controller->ToggleBrowserFullscreenMode(); 36 controller->ToggleBrowserFullscreenMode();
37 faker.FinishTransition(); 37 faker.FinishTransition();
38 38
39 // The location bar should be visible if the toolbar is set to be visible in 39 // The location bar should be visible if the toolbar is set to be visible in
40 // fullscreen mode. 40 // fullscreen mode.
41 PrefService* prefs = browser()->profile()->GetPrefs(); 41 PrefService* prefs = browser()->profile()->GetPrefs();
(...skipping 12 matching lines...) Expand all
54 EXPECT_TRUE([bubble.bubbleController_ hasVisibleLocationBar]); 54 EXPECT_TRUE([bubble.bubbleController_ hasVisibleLocationBar]);
55 bubble.Hide(); 55 bubble.Hide();
56 } 56 }
57 57
58 IN_PROC_BROWSER_TEST_F(PermissionBubbleBrowserTest, 58 IN_PROC_BROWSER_TEST_F(PermissionBubbleBrowserTest,
59 TabFullscreenHasLocationBar) { 59 TabFullscreenHasLocationBar) {
60 ui::test::ScopedFakeNSWindowFullscreen faker; 60 ui::test::ScopedFakeNSWindowFullscreen faker;
61 61
62 PermissionBubbleCocoa bubble(browser()); 62 PermissionBubbleCocoa bubble(browser());
63 bubble.SetDelegate(test_delegate()); 63 bubble.SetDelegate(test_delegate());
64 bubble.Show(requests(), accept_states()); 64 bubble.Show();
65 EXPECT_TRUE([bubble.bubbleController_ hasVisibleLocationBar]); 65 EXPECT_TRUE([bubble.bubbleController_ hasVisibleLocationBar]);
66 66
67 FullscreenController* controller = 67 FullscreenController* controller =
68 browser()->exclusive_access_manager()->fullscreen_controller(); 68 browser()->exclusive_access_manager()->fullscreen_controller();
69 controller->EnterFullscreenModeForTab( 69 controller->EnterFullscreenModeForTab(
70 browser()->tab_strip_model()->GetActiveWebContents(), GURL()); 70 browser()->tab_strip_model()->GetActiveWebContents(), GURL());
71 faker.FinishTransition(); 71 faker.FinishTransition();
72 72
73 EXPECT_FALSE([bubble.bubbleController_ hasVisibleLocationBar]); 73 EXPECT_FALSE([bubble.bubbleController_ hasVisibleLocationBar]);
74 controller->ExitFullscreenModeForTab( 74 controller->ExitFullscreenModeForTab(
75 browser()->tab_strip_model()->GetActiveWebContents()); 75 browser()->tab_strip_model()->GetActiveWebContents());
76 faker.FinishTransition(); 76 faker.FinishTransition();
77 77
78 EXPECT_TRUE([bubble.bubbleController_ hasVisibleLocationBar]); 78 EXPECT_TRUE([bubble.bubbleController_ hasVisibleLocationBar]);
79 bubble.Hide(); 79 bubble.Hide();
80 } 80 }
81 81
82 IN_PROC_BROWSER_TEST_F(PermissionBubbleBrowserTest, AppHasNoLocationBar) { 82 IN_PROC_BROWSER_TEST_F(PermissionBubbleBrowserTest, AppHasNoLocationBar) {
83 Browser* app_browser = OpenExtensionAppWindow(); 83 Browser* app_browser = OpenExtensionAppWindow();
84 PermissionBubbleCocoa bubble(app_browser); 84 PermissionBubbleCocoa bubble(app_browser);
85 bubble.SetDelegate(test_delegate()); 85 bubble.SetDelegate(test_delegate());
86 bubble.Show(requests(), accept_states()); 86 bubble.Show();
87 EXPECT_FALSE([bubble.bubbleController_ hasVisibleLocationBar]); 87 EXPECT_FALSE([bubble.bubbleController_ hasVisibleLocationBar]);
88 bubble.Hide(); 88 bubble.Hide();
89 } 89 }
90 90
91 // http://crbug.com/470724 91 // http://crbug.com/470724
92 // Kiosk mode on Mac has a location bar but it shouldn't. 92 // Kiosk mode on Mac has a location bar but it shouldn't.
93 IN_PROC_BROWSER_TEST_F(PermissionBubbleKioskBrowserTest, 93 IN_PROC_BROWSER_TEST_F(PermissionBubbleKioskBrowserTest,
94 DISABLED_KioskHasNoLocationBar) { 94 DISABLED_KioskHasNoLocationBar) {
95 PermissionBubbleCocoa bubble(browser()); 95 PermissionBubbleCocoa bubble(browser());
96 bubble.SetDelegate(test_delegate()); 96 bubble.SetDelegate(test_delegate());
97 bubble.Show(requests(), accept_states()); 97 bubble.Show();
98 EXPECT_FALSE([bubble.bubbleController_ hasVisibleLocationBar]); 98 EXPECT_FALSE([bubble.bubbleController_ hasVisibleLocationBar]);
99 bubble.Hide(); 99 bubble.Hide();
100 } 100 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698