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_window_controller.h" | 10 #include "chrome/browser/ui/cocoa/browser_window_controller.h" |
11 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 11 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
12 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 12 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
13 #include "chrome/grit/generated_resources.h" | 13 #include "chrome/grit/generated_resources.h" |
14 #include "chrome/test/base/testing_profile.h" | 14 #include "chrome/test/base/testing_profile.h" |
15 #include "content/public/browser/notification_service.h" | 15 #include "content/public/browser/notification_service.h" |
16 #include "content/public/browser/site_instance.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 "content/public/test/test_utils.h" | 18 #include "content/public/test/test_utils.h" |
19 #include "testing/gtest_mac.h" | 19 #include "testing/gtest_mac.h" |
20 #include "ui/base/accelerators/platform_accelerator_cocoa.h" | 20 #include "ui/base/accelerators/platform_accelerator_cocoa.h" |
21 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
22 #include "ui/base/l10n/l10n_util_mac.h" | 22 #include "ui/base/l10n/l10n_util_mac.h" |
| 23 #import "ui/base/cocoa/controls/hyperlink_text_view.h" |
23 | 24 |
24 using content::SiteInstance; | 25 using content::SiteInstance; |
25 using content::WebContents; | 26 using content::WebContents; |
26 | 27 |
27 @interface ExclusiveAccessBubbleWindowController (JustForTesting) | 28 @interface ExclusiveAccessBubbleWindowController (JustForTesting) |
28 // Already defined. | 29 // Already defined. |
29 + (NSString*)keyCommandString; | 30 + (NSString*)keyCommandString; |
30 + (NSString*)keyCombinationForAccelerator: | 31 + (NSString*)keyCombinationForAccelerator: |
31 (const ui::PlatformAcceleratorCocoa&)item; | 32 (const ui::PlatformAcceleratorCocoa&)item; |
32 - (void)initializeLabelAndButton; | 33 - (void)initializeLabelAndButton; |
33 @end | 34 @end |
34 | 35 |
35 @interface ExclusiveAccessBubbleWindowController (ExposedForTesting) | 36 @interface ExclusiveAccessBubbleWindowController (ExposedForTesting) |
36 - (NSTextField*)exitLabelPlaceholder; | 37 - (NSTextField*)exitLabelPlaceholder; |
37 - (NSTextView*)exitLabel; | 38 - (NSTextView*)exitLabel; |
38 - (NSString*)denyButtonText; | 39 - (NSString*)denyButtonText; |
39 @end | 40 @end |
40 | 41 |
41 @implementation ExclusiveAccessBubbleWindowController (ExposedForTesting) | 42 @implementation ExclusiveAccessBubbleWindowController (ExposedForTesting) |
42 - (NSTextField*)exitLabelPlaceholder { | 43 - (NSTextField*)exitLabelPlaceholder { |
43 return exitLabelPlaceholder_; | 44 return exitLabelPlaceholder_; |
44 } | 45 } |
45 | 46 |
46 - (NSTextView*)exitLabel { | 47 - (HyperlinkTextView*)exitLabel { |
47 return exitLabel_; | 48 return exitLabel_; |
48 } | 49 } |
49 | 50 |
50 - (NSString*)denyButtonText { | 51 - (NSString*)denyButtonText { |
51 return [denyButton_ title]; | 52 return [denyButton_ title]; |
52 } | 53 } |
53 @end | 54 @end |
54 | 55 |
55 class ExclusiveAccessBubbleWindowControllerTest : public CocoaProfileTest { | 56 class ExclusiveAccessBubbleWindowControllerTest : public CocoaProfileTest { |
56 public: | 57 public: |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 initWithOwner:nil | 156 initWithOwner:nil |
156 browser:browser() | 157 browser:browser() |
157 url:GURL() | 158 url:GURL() |
158 bubbleType:EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_MOUSELOCK_BUTTONS]); | 159 bubbleType:EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_MOUSELOCK_BUTTONS]); |
159 [controller_ initializeLabelAndButton]; | 160 [controller_ initializeLabelAndButton]; |
160 NSString* fullscreen_mouselock_deny_button_text = | 161 NSString* fullscreen_mouselock_deny_button_text = |
161 [controller_ denyButtonText]; | 162 [controller_ denyButtonText]; |
162 EXPECT_NSEQ(l10n_util::GetNSString(IDS_FULLSCREEN_EXIT), | 163 EXPECT_NSEQ(l10n_util::GetNSString(IDS_FULLSCREEN_EXIT), |
163 fullscreen_mouselock_deny_button_text); | 164 fullscreen_mouselock_deny_button_text); |
164 } | 165 } |
OLD | NEW |