| 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/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_window_controller.h" | 10 #include "chrome/browser/ui/cocoa/browser_window_controller.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 EXPECT_FALSE([bwc fullscreenExitBubbleController]); | 102 EXPECT_FALSE([bwc fullscreenExitBubbleController]); |
| 103 EXPECT_FALSE(browser()->window()->IsFullscreen()); | 103 EXPECT_FALSE(browser()->window()->IsFullscreen()); |
| 104 CloseBrowserWindow(); | 104 CloseBrowserWindow(); |
| 105 } | 105 } |
| 106 | 106 |
| 107 TEST_F(FullscreenExitBubbleControllerTest, LabelWasReplaced) { | 107 TEST_F(FullscreenExitBubbleControllerTest, LabelWasReplaced) { |
| 108 EXPECT_FALSE([controller_ exitLabelPlaceholder]); | 108 EXPECT_FALSE([controller_ exitLabelPlaceholder]); |
| 109 EXPECT_TRUE([controller_ exitLabel]); | 109 EXPECT_TRUE([controller_ exitLabel]); |
| 110 } | 110 } |
| 111 | 111 |
| 112 TEST_F(FullscreenExitBubbleControllerTest, LabelContainsShortcut) { | |
| 113 NSString* shortcut = [FullscreenExitBubbleController keyCommandString]; | |
| 114 EXPECT_GT([shortcut length], 0U); | |
| 115 | |
| 116 NSString* message = [[[controller_ exitLabel] textStorage] string]; | |
| 117 | |
| 118 NSRange range = [message rangeOfString:shortcut]; | |
| 119 EXPECT_NE(NSNotFound, range.location); | |
| 120 } | |
| 121 | |
| 122 TEST_F(FullscreenExitBubbleControllerTest, ShortcutText) { | 112 TEST_F(FullscreenExitBubbleControllerTest, ShortcutText) { |
| 123 ui::AcceleratorCocoa cmd_F(@"F", NSCommandKeyMask); | 113 ui::AcceleratorCocoa cmd_F(@"F", NSCommandKeyMask); |
| 124 ui::AcceleratorCocoa cmd_shift_f(@"f", NSCommandKeyMask|NSShiftKeyMask); | 114 ui::AcceleratorCocoa cmd_shift_f(@"f", NSCommandKeyMask|NSShiftKeyMask); |
| 125 NSString* cmd_F_text = [FullscreenExitBubbleController | 115 NSString* cmd_F_text = [FullscreenExitBubbleController |
| 126 keyCombinationForAccelerator:cmd_F]; | 116 keyCombinationForAccelerator:cmd_F]; |
| 127 NSString* cmd_shift_f_text = [FullscreenExitBubbleController | 117 NSString* cmd_shift_f_text = [FullscreenExitBubbleController |
| 128 keyCombinationForAccelerator:cmd_shift_f]; | 118 keyCombinationForAccelerator:cmd_shift_f]; |
| 129 EXPECT_NSEQ(cmd_shift_f_text, cmd_F_text); | 119 EXPECT_NSEQ(cmd_shift_f_text, cmd_F_text); |
| 130 EXPECT_NSEQ(@"\u2318\u21E7F", cmd_shift_f_text); | 120 EXPECT_NSEQ(@"\u2318\u21E7F", cmd_shift_f_text); |
| 131 } | 121 } |
| OLD | NEW |