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" | |
16 #include "content/public/browser/notification_service.h" | 15 #include "content/public/browser/notification_service.h" |
| 16 #include "content/public/browser/site_instance.h" |
17 #include "content/public/browser/web_contents.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::SiteInstance; |
21 using content::WebContents; | 22 using content::WebContents; |
22 | 23 |
23 @interface FullscreenExitBubbleController(JustForTesting) | 24 @interface FullscreenExitBubbleController(JustForTesting) |
24 // Already defined. | 25 // Already defined. |
25 + (NSString*)keyCommandString; | 26 + (NSString*)keyCommandString; |
26 + (NSString*)keyCombinationForAccelerator:(const ui::AcceleratorCocoa&)item; | 27 + (NSString*)keyCombinationForAccelerator:(const ui::AcceleratorCocoa&)item; |
27 @end | 28 @end |
28 | 29 |
29 @interface FullscreenExitBubbleController(ExposedForTesting) | 30 @interface FullscreenExitBubbleController(ExposedForTesting) |
30 - (NSTextField*)exitLabelPlaceholder; | 31 - (NSTextField*)exitLabelPlaceholder; |
31 - (NSTextView*)exitLabel; | 32 - (NSTextView*)exitLabel; |
32 @end | 33 @end |
33 | 34 |
34 @implementation FullscreenExitBubbleController(ExposedForTesting) | 35 @implementation FullscreenExitBubbleController(ExposedForTesting) |
35 - (NSTextField*)exitLabelPlaceholder { | 36 - (NSTextField*)exitLabelPlaceholder { |
36 return exitLabelPlaceholder_; | 37 return exitLabelPlaceholder_; |
37 } | 38 } |
38 | 39 |
39 - (NSTextView*)exitLabel { | 40 - (NSTextView*)exitLabel { |
40 return exitLabel_; | 41 return exitLabel_; |
41 } | 42 } |
42 @end | 43 @end |
43 | 44 |
44 class FullscreenExitBubbleControllerTest : public CocoaProfileTest { | 45 class FullscreenExitBubbleControllerTest : public CocoaProfileTest { |
45 public: | 46 public: |
46 virtual void SetUp() { | 47 virtual void SetUp() { |
47 CocoaProfileTest::SetUp(); | 48 CocoaProfileTest::SetUp(); |
48 ASSERT_TRUE(profile()); | 49 ASSERT_TRUE(profile()); |
49 | 50 |
50 site_instance_ = SiteInstance::CreateSiteInstance(profile()); | 51 site_instance_ = SiteInstance::Create(profile()); |
51 controller_.reset( | 52 controller_.reset( |
52 [[FullscreenExitBubbleController alloc] initWithOwner:nil | 53 [[FullscreenExitBubbleController alloc] initWithOwner:nil |
53 browser:browser() | 54 browser:browser() |
54 url:GURL() | 55 url:GURL() |
55 bubbleType:FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION]); | 56 bubbleType:FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION]); |
56 EXPECT_TRUE([controller_ window]); | 57 EXPECT_TRUE([controller_ window]); |
57 } | 58 } |
58 | 59 |
59 virtual void TearDown() { | 60 virtual void TearDown() { |
60 [controller_ close]; | 61 [controller_ close]; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 TEST_F(FullscreenExitBubbleControllerTest, ShortcutText) { | 117 TEST_F(FullscreenExitBubbleControllerTest, ShortcutText) { |
117 ui::AcceleratorCocoa cmd_F(@"F", NSCommandKeyMask); | 118 ui::AcceleratorCocoa cmd_F(@"F", NSCommandKeyMask); |
118 ui::AcceleratorCocoa cmd_shift_f(@"f", NSCommandKeyMask|NSShiftKeyMask); | 119 ui::AcceleratorCocoa cmd_shift_f(@"f", NSCommandKeyMask|NSShiftKeyMask); |
119 NSString* cmd_F_text = [FullscreenExitBubbleController | 120 NSString* cmd_F_text = [FullscreenExitBubbleController |
120 keyCombinationForAccelerator:cmd_F]; | 121 keyCombinationForAccelerator:cmd_F]; |
121 NSString* cmd_shift_f_text = [FullscreenExitBubbleController | 122 NSString* cmd_shift_f_text = [FullscreenExitBubbleController |
122 keyCombinationForAccelerator:cmd_shift_f]; | 123 keyCombinationForAccelerator:cmd_shift_f]; |
123 EXPECT_NSEQ(cmd_shift_f_text, cmd_F_text); | 124 EXPECT_NSEQ(cmd_shift_f_text, cmd_F_text); |
124 EXPECT_NSEQ(@"\u2318\u21E7F", cmd_shift_f_text); | 125 EXPECT_NSEQ(@"\u2318\u21E7F", cmd_shift_f_text); |
125 } | 126 } |
OLD | NEW |