| 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/test/base/testing_profile.h" | 13 #include "chrome/test/base/testing_profile.h" |
| 14 #include "content/public/browser/notification_service.h" | 14 #include "content/public/browser/notification_service.h" |
| 15 #include "content/public/browser/site_instance.h" | 15 #include "content/public/browser/site_instance.h" |
| 16 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
| 17 #include "content/public/test/test_utils.h" | 17 #include "content/public/test/test_utils.h" |
| 18 #include "testing/gtest_mac.h" | 18 #include "testing/gtest_mac.h" |
| 19 #include "ui/base/accelerators/platform_accelerator_cocoa.h" | 19 #include "ui/base/accelerators/platform_accelerator_cocoa.h" |
| 20 #import "ui/base/cocoa/controls/hyperlink_text_view.h" |
| 20 | 21 |
| 21 using content::SiteInstance; | 22 using content::SiteInstance; |
| 22 using content::WebContents; | 23 using content::WebContents; |
| 23 | 24 |
| 24 @interface ExclusiveAccessBubbleWindowController (JustForTesting) | 25 @interface ExclusiveAccessBubbleWindowController (JustForTesting) |
| 25 // Already defined. | 26 // Already defined. |
| 26 + (NSString*)keyCommandString; | 27 + (NSString*)keyCommandString; |
| 27 + (NSString*)keyCombinationForAccelerator: | 28 + (NSString*)keyCombinationForAccelerator: |
| 28 (const ui::PlatformAcceleratorCocoa&)item; | 29 (const ui::PlatformAcceleratorCocoa&)item; |
| 29 @end | 30 @end |
| 30 | 31 |
| 31 @interface ExclusiveAccessBubbleWindowController (ExposedForTesting) | 32 @interface ExclusiveAccessBubbleWindowController (ExposedForTesting) |
| 32 - (NSTextField*)exitLabelPlaceholder; | 33 - (NSTextField*)exitLabelPlaceholder; |
| 33 - (NSTextView*)exitLabel; | 34 - (NSTextView*)exitLabel; |
| 34 @end | 35 @end |
| 35 | 36 |
| 36 @implementation ExclusiveAccessBubbleWindowController (ExposedForTesting) | 37 @implementation ExclusiveAccessBubbleWindowController (ExposedForTesting) |
| 37 - (NSTextField*)exitLabelPlaceholder { | 38 - (NSTextField*)exitLabelPlaceholder { |
| 38 return exitLabelPlaceholder_; | 39 return exitLabelPlaceholder_; |
| 39 } | 40 } |
| 40 | 41 |
| 41 - (NSTextView*)exitLabel { | 42 - (HyperlinkTextView*)exitLabel { |
| 42 return exitLabel_; | 43 return exitLabel_; |
| 43 } | 44 } |
| 44 @end | 45 @end |
| 45 | 46 |
| 46 class ExclusiveAccessBubbleWindowControllerTest : public CocoaProfileTest { | 47 class ExclusiveAccessBubbleWindowControllerTest : public CocoaProfileTest { |
| 47 public: | 48 public: |
| 48 void SetUp() override { | 49 void SetUp() override { |
| 49 CocoaProfileTest::SetUp(); | 50 CocoaProfileTest::SetUp(); |
| 50 ASSERT_TRUE(profile()); | 51 ASSERT_TRUE(profile()); |
| 51 | 52 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 ui::PlatformAcceleratorCocoa cmd_F(@"F", NSCommandKeyMask); | 123 ui::PlatformAcceleratorCocoa cmd_F(@"F", NSCommandKeyMask); |
| 123 ui::PlatformAcceleratorCocoa cmd_shift_f(@"f", | 124 ui::PlatformAcceleratorCocoa cmd_shift_f(@"f", |
| 124 NSCommandKeyMask | NSShiftKeyMask); | 125 NSCommandKeyMask | NSShiftKeyMask); |
| 125 NSString* cmd_F_text = [ExclusiveAccessBubbleWindowController | 126 NSString* cmd_F_text = [ExclusiveAccessBubbleWindowController |
| 126 keyCombinationForAccelerator:cmd_F]; | 127 keyCombinationForAccelerator:cmd_F]; |
| 127 NSString* cmd_shift_f_text = [ExclusiveAccessBubbleWindowController | 128 NSString* cmd_shift_f_text = [ExclusiveAccessBubbleWindowController |
| 128 keyCombinationForAccelerator:cmd_shift_f]; | 129 keyCombinationForAccelerator:cmd_shift_f]; |
| 129 EXPECT_NSEQ(cmd_shift_f_text, cmd_F_text); | 130 EXPECT_NSEQ(cmd_shift_f_text, cmd_F_text); |
| 130 EXPECT_NSEQ(@"\u2318\u21E7F", cmd_shift_f_text); | 131 EXPECT_NSEQ(@"\u2318\u21E7F", cmd_shift_f_text); |
| 131 } | 132 } |
| OLD | NEW |