OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/fullscreen_exit_bubble_controller.h" | 5 #import "chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller.h" |
6 | 6 |
7 #include "base/mac/mac_util.h" | 7 #include "base/mac/mac_util.h" |
8 #include "chrome/browser/tabs/tab_strip_model.h" | 8 #include "chrome/browser/tabs/tab_strip_model.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/browser_window.h" | 10 #include "chrome/browser/ui/browser_window.h" |
11 #include "chrome/browser/ui/cocoa/browser_window_controller.h" | 11 #include "chrome/browser/ui/cocoa/browser_window_controller.h" |
12 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 12 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
13 #include "chrome/common/chrome_notification_types.h" | 13 #include "chrome/common/chrome_notification_types.h" |
14 #include "chrome/test/base/ui_test_utils.h" | 14 #include "chrome/test/base/ui_test_utils.h" |
15 #include "content/browser/site_instance.h" | 15 #include "content/browser/site_instance.h" |
16 #include "content/browser/tab_contents/tab_contents.h" | |
17 #include "content/public/browser/notification_service.h" | 16 #include "content/public/browser/notification_service.h" |
| 17 #include "content/public/browser/web_contents.h" |
18 #include "testing/gtest_mac.h" | 18 #include "testing/gtest_mac.h" |
19 #include "ui/base/accelerators/accelerator_cocoa.h" | 19 #include "ui/base/accelerators/accelerator_cocoa.h" |
20 | 20 |
| 21 using content::WebContents; |
| 22 |
21 @interface FullscreenExitBubbleController(JustForTesting) | 23 @interface FullscreenExitBubbleController(JustForTesting) |
22 // Already defined. | 24 // Already defined. |
23 + (NSString*)keyCommandString; | 25 + (NSString*)keyCommandString; |
24 + (NSString*)keyCombinationForAccelerator:(const ui::AcceleratorCocoa&)item; | 26 + (NSString*)keyCombinationForAccelerator:(const ui::AcceleratorCocoa&)item; |
25 @end | 27 @end |
26 | 28 |
27 @interface FullscreenExitBubbleController(ExposedForTesting) | 29 @interface FullscreenExitBubbleController(ExposedForTesting) |
28 - (NSTextField*)exitLabelPlaceholder; | 30 - (NSTextField*)exitLabelPlaceholder; |
29 - (NSTextView*)exitLabel; | 31 - (NSTextView*)exitLabel; |
30 @end | 32 @end |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 scoped_refptr<SiteInstance> site_instance_; | 73 scoped_refptr<SiteInstance> site_instance_; |
72 scoped_nsobject<FullscreenExitBubbleController> controller_; | 74 scoped_nsobject<FullscreenExitBubbleController> controller_; |
73 }; | 75 }; |
74 | 76 |
75 TEST_F(FullscreenExitBubbleControllerTest, DenyExitsFullscreen) { | 77 TEST_F(FullscreenExitBubbleControllerTest, DenyExitsFullscreen) { |
76 if (base::mac::IsOSLionOrLater()) | 78 if (base::mac::IsOSLionOrLater()) |
77 FAIL() << "This test crashes on Lion; http://crbug.com/103906"; | 79 FAIL() << "This test crashes on Lion; http://crbug.com/103906"; |
78 | 80 |
79 CreateBrowserWindow(); | 81 CreateBrowserWindow(); |
80 AppendTabToStrip(); | 82 AppendTabToStrip(); |
81 TabContents* fullscreen_tab = browser()->GetSelectedTabContents(); | 83 WebContents* fullscreen_tab = browser()->GetSelectedWebContents(); |
82 { | 84 { |
83 base::mac::ScopedNSAutoreleasePool pool; | 85 base::mac::ScopedNSAutoreleasePool pool; |
84 ui_test_utils::WindowedNotificationObserver fullscreen_observer( | 86 ui_test_utils::WindowedNotificationObserver fullscreen_observer( |
85 chrome::NOTIFICATION_FULLSCREEN_CHANGED, | 87 chrome::NOTIFICATION_FULLSCREEN_CHANGED, |
86 content::NotificationService::AllSources()); | 88 content::NotificationService::AllSources()); |
87 browser()->ToggleFullscreenModeForTab(fullscreen_tab, true); | 89 browser()->ToggleFullscreenModeForTab(fullscreen_tab, true); |
88 fullscreen_observer.Wait(); | 90 fullscreen_observer.Wait(); |
89 ASSERT_TRUE(browser()->window()->IsFullscreen()); | 91 ASSERT_TRUE(browser()->window()->IsFullscreen()); |
90 } | 92 } |
91 | 93 |
(...skipping 22 matching lines...) Expand all Loading... |
114 TEST_F(FullscreenExitBubbleControllerTest, ShortcutText) { | 116 TEST_F(FullscreenExitBubbleControllerTest, ShortcutText) { |
115 ui::AcceleratorCocoa cmd_F(@"F", NSCommandKeyMask); | 117 ui::AcceleratorCocoa cmd_F(@"F", NSCommandKeyMask); |
116 ui::AcceleratorCocoa cmd_shift_f(@"f", NSCommandKeyMask|NSShiftKeyMask); | 118 ui::AcceleratorCocoa cmd_shift_f(@"f", NSCommandKeyMask|NSShiftKeyMask); |
117 NSString* cmd_F_text = [FullscreenExitBubbleController | 119 NSString* cmd_F_text = [FullscreenExitBubbleController |
118 keyCombinationForAccelerator:cmd_F]; | 120 keyCombinationForAccelerator:cmd_F]; |
119 NSString* cmd_shift_f_text = [FullscreenExitBubbleController | 121 NSString* cmd_shift_f_text = [FullscreenExitBubbleController |
120 keyCombinationForAccelerator:cmd_shift_f]; | 122 keyCombinationForAccelerator:cmd_shift_f]; |
121 EXPECT_NSEQ(cmd_shift_f_text, cmd_F_text); | 123 EXPECT_NSEQ(cmd_shift_f_text, cmd_F_text); |
122 EXPECT_NSEQ(@"\u2318\u21E7F", cmd_shift_f_text); | 124 EXPECT_NSEQ(@"\u2318\u21E7F", cmd_shift_f_text); |
123 } | 125 } |
OLD | NEW |