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 #import "chrome/browser/ui/cocoa/exclusive_access_bubble_window_controller.h" | 5 #import "chrome/browser/ui/cocoa/exclusive_access_bubble_window_controller.h" |
6 | 6 |
7 #include "chrome/browser/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
9 #include "chrome/browser/ui/browser_window.h" | 9 #include "chrome/browser/ui/browser_window.h" |
10 #include "chrome/browser/ui/cocoa/browser/exclusive_access_controller_views.h" | 10 #include "chrome/browser/ui/cocoa/browser/exclusive_access_controller_views.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 WebContents* web_contents = WebContents::Create( | 80 WebContents* web_contents = WebContents::Create( |
81 content::WebContents::CreateParams(profile(), site_instance_.get())); | 81 content::WebContents::CreateParams(profile(), site_instance_.get())); |
82 browser()->tab_strip_model()->AppendWebContents(web_contents, | 82 browser()->tab_strip_model()->AppendWebContents(web_contents, |
83 /*foreground=*/true); | 83 /*foreground=*/true); |
84 } | 84 } |
85 | 85 |
86 scoped_refptr<SiteInstance> site_instance_; | 86 scoped_refptr<SiteInstance> site_instance_; |
87 base::scoped_nsobject<ExclusiveAccessBubbleWindowController> controller_; | 87 base::scoped_nsobject<ExclusiveAccessBubbleWindowController> controller_; |
88 }; | 88 }; |
89 | 89 |
90 // http://crbug.com/103912 | |
91 TEST_F(ExclusiveAccessBubbleWindowControllerTest, | |
92 DISABLED_DenyExitsFullscreen) { | |
93 NSWindow* window = browser()->window()->GetNativeWindow(); | |
94 BrowserWindowController* bwc = | |
95 [BrowserWindowController browserWindowControllerForWindow:window]; | |
96 | |
97 [bwc showWindow:nil]; | |
98 | |
99 AppendTabToStrip(); | |
100 WebContents* fullscreen_tab = | |
101 browser()->tab_strip_model()->GetActiveWebContents(); | |
102 { | |
103 base::mac::ScopedNSAutoreleasePool pool; | |
104 content::WindowedNotificationObserver fullscreen_observer( | |
105 chrome::NOTIFICATION_FULLSCREEN_CHANGED, | |
106 content::NotificationService::AllSources()); | |
107 browser()->EnterFullscreenModeForTab(fullscreen_tab, GURL()); | |
108 fullscreen_observer.Wait(); | |
109 ASSERT_TRUE(browser()->window()->IsFullscreen()); | |
110 } | |
111 | |
112 ExclusiveAccessController* access_controller = | |
113 [bwc exclusiveAccessController]; | |
114 EXPECT_TRUE(access_controller->cocoa_bubble()); | |
115 { | |
116 content::WindowedNotificationObserver fullscreen_observer( | |
117 chrome::NOTIFICATION_FULLSCREEN_CHANGED, | |
118 content::NotificationService::AllSources()); | |
119 [access_controller->cocoa_bubble() deny:nil]; | |
120 fullscreen_observer.Wait(); | |
121 } | |
122 EXPECT_FALSE(access_controller->cocoa_bubble()); | |
123 EXPECT_FALSE(browser()->window()->IsFullscreen()); | |
124 CloseBrowserWindow(); | |
125 } | |
126 | |
127 TEST_F(ExclusiveAccessBubbleWindowControllerTest, LabelWasReplaced) { | 90 TEST_F(ExclusiveAccessBubbleWindowControllerTest, LabelWasReplaced) { |
128 EXPECT_FALSE([controller_ exitLabelPlaceholder]); | 91 EXPECT_FALSE([controller_ exitLabelPlaceholder]); |
129 EXPECT_TRUE([controller_ exitLabel]); | 92 EXPECT_TRUE([controller_ exitLabel]); |
130 } | 93 } |
131 | 94 |
132 TEST_F(ExclusiveAccessBubbleWindowControllerTest, ShortcutText) { | 95 TEST_F(ExclusiveAccessBubbleWindowControllerTest, ShortcutText) { |
133 ui::PlatformAcceleratorCocoa cmd_F(@"F", NSCommandKeyMask); | 96 ui::PlatformAcceleratorCocoa cmd_F(@"F", NSCommandKeyMask); |
134 ui::PlatformAcceleratorCocoa cmd_shift_f(@"f", | 97 ui::PlatformAcceleratorCocoa cmd_shift_f(@"f", |
135 NSCommandKeyMask | NSShiftKeyMask); | 98 NSCommandKeyMask | NSShiftKeyMask); |
136 NSString* cmd_F_text = [ExclusiveAccessBubbleWindowController | 99 NSString* cmd_F_text = [ExclusiveAccessBubbleWindowController |
(...skipping 23 matching lines...) Expand all Loading... |
160 profile:browser()->profile() | 123 profile:browser()->profile() |
161 url:GURL() | 124 url:GURL() |
162 bubbleType: | 125 bubbleType: |
163 EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_MOUSELOCK_BUTTON
S]); | 126 EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_MOUSELOCK_BUTTON
S]); |
164 [controller_ initializeLabelAndButton]; | 127 [controller_ initializeLabelAndButton]; |
165 NSString* fullscreen_mouselock_deny_button_text = | 128 NSString* fullscreen_mouselock_deny_button_text = |
166 [controller_ denyButtonText]; | 129 [controller_ denyButtonText]; |
167 EXPECT_NSEQ(l10n_util::GetNSString(IDS_FULLSCREEN_EXIT), | 130 EXPECT_NSEQ(l10n_util::GetNSString(IDS_FULLSCREEN_EXIT), |
168 fullscreen_mouselock_deny_button_text); | 131 fullscreen_mouselock_deny_button_text); |
169 } | 132 } |
OLD | NEW |