Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(392)

Side by Side Diff: chrome/browser/ui/cocoa/exclusive_access_bubble_window_controller_unittest.mm

Issue 856253002: Bug fix for the pointer lock string problem (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove debugging printouts Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/test/base/testing_profile.h" 14 #include "chrome/test/base/testing_profile.h"
14 #include "content/public/browser/notification_service.h" 15 #include "content/public/browser/notification_service.h"
15 #include "content/public/browser/site_instance.h" 16 #include "content/public/browser/site_instance.h"
16 #include "content/public/browser/web_contents.h" 17 #include "content/public/browser/web_contents.h"
17 #include "content/public/test/test_utils.h" 18 #include "content/public/test/test_utils.h"
18 #include "testing/gtest_mac.h" 19 #include "testing/gtest_mac.h"
19 #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"
22 #include "ui/base/l10n/l10n_util_mac.h"
20 23
21 using content::SiteInstance; 24 using content::SiteInstance;
22 using content::WebContents; 25 using content::WebContents;
23 26
24 @interface ExclusiveAccessBubbleWindowController (JustForTesting) 27 @interface ExclusiveAccessBubbleWindowController (JustForTesting)
25 // Already defined. 28 // Already defined.
26 + (NSString*)keyCommandString; 29 + (NSString*)keyCommandString;
27 + (NSString*)keyCombinationForAccelerator: 30 + (NSString*)keyCombinationForAccelerator:
28 (const ui::PlatformAcceleratorCocoa&)item; 31 (const ui::PlatformAcceleratorCocoa&)item;
32 - (void)initializeLabel;
29 @end 33 @end
30 34
31 @interface ExclusiveAccessBubbleWindowController (ExposedForTesting) 35 @interface ExclusiveAccessBubbleWindowController (ExposedForTesting)
32 - (NSTextField*)exitLabelPlaceholder; 36 - (NSTextField*)exitLabelPlaceholder;
33 - (NSTextView*)exitLabel; 37 - (NSTextView*)exitLabel;
38 - (NSString*)denyButtonText;
34 @end 39 @end
35 40
36 @implementation ExclusiveAccessBubbleWindowController (ExposedForTesting) 41 @implementation ExclusiveAccessBubbleWindowController (ExposedForTesting)
37 - (NSTextField*)exitLabelPlaceholder { 42 - (NSTextField*)exitLabelPlaceholder {
38 return exitLabelPlaceholder_; 43 return exitLabelPlaceholder_;
39 } 44 }
40 45
41 - (NSTextView*)exitLabel { 46 - (NSTextView*)exitLabel {
42 return exitLabel_; 47 return exitLabel_;
43 } 48 }
49
50 - (NSString*)denyButtonText {
51 return [denyButton_ title];
52 }
44 @end 53 @end
45 54
46 class ExclusiveAccessBubbleWindowControllerTest : public CocoaProfileTest { 55 class ExclusiveAccessBubbleWindowControllerTest : public CocoaProfileTest {
47 public: 56 public:
48 void SetUp() override { 57 void SetUp() override {
49 CocoaProfileTest::SetUp(); 58 CocoaProfileTest::SetUp();
50 ASSERT_TRUE(profile()); 59 ASSERT_TRUE(profile());
51 60
52 site_instance_ = SiteInstance::Create(profile()); 61 site_instance_ = SiteInstance::Create(profile());
53 controller_.reset([[ExclusiveAccessBubbleWindowController alloc] 62 controller_.reset([[ExclusiveAccessBubbleWindowController alloc]
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 ui::PlatformAcceleratorCocoa cmd_F(@"F", NSCommandKeyMask); 131 ui::PlatformAcceleratorCocoa cmd_F(@"F", NSCommandKeyMask);
123 ui::PlatformAcceleratorCocoa cmd_shift_f(@"f", 132 ui::PlatformAcceleratorCocoa cmd_shift_f(@"f",
124 NSCommandKeyMask | NSShiftKeyMask); 133 NSCommandKeyMask | NSShiftKeyMask);
125 NSString* cmd_F_text = [ExclusiveAccessBubbleWindowController 134 NSString* cmd_F_text = [ExclusiveAccessBubbleWindowController
126 keyCombinationForAccelerator:cmd_F]; 135 keyCombinationForAccelerator:cmd_F];
127 NSString* cmd_shift_f_text = [ExclusiveAccessBubbleWindowController 136 NSString* cmd_shift_f_text = [ExclusiveAccessBubbleWindowController
128 keyCombinationForAccelerator:cmd_shift_f]; 137 keyCombinationForAccelerator:cmd_shift_f];
129 EXPECT_NSEQ(cmd_shift_f_text, cmd_F_text); 138 EXPECT_NSEQ(cmd_shift_f_text, cmd_F_text);
130 EXPECT_NSEQ(@"\u2318\u21E7F", cmd_shift_f_text); 139 EXPECT_NSEQ(@"\u2318\u21E7F", cmd_shift_f_text);
131 } 140 }
141
142 // http://crbug.com/139944
143 TEST_F(ExclusiveAccessBubbleWindowControllerTest, DenyButtonText) {
144 controller_.reset([[ExclusiveAccessBubbleWindowController alloc]
145 initWithOwner:nil
146 browser:browser()
147 url:GURL()
148 bubbleType:EXCLUSIVE_ACCESS_BUBBLE_TYPE_MOUSELOCK_BUTTONS]);
149 [controller_ initializeLabel];
150 NSString* mouselock_deny_button_text = [controller_ denyButtonText];
151 EXPECT_NSEQ(l10n_util::GetNSString(IDS_FULLSCREEN_DENY),
152 mouselock_deny_button_text);
153
154 controller_.reset([[ExclusiveAccessBubbleWindowController alloc]
155 initWithOwner:nil
156 browser:browser()
157 url:GURL()
158 bubbleType:EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_MOUSELOCK_BUTTONS]);
159 [controller_ initializeLabel];
160 NSString* fullscreen_mouselock_deny_button_text =
161 [controller_ denyButtonText];
162 EXPECT_NSEQ(l10n_util::GetNSString(IDS_FULLSCREEN_EXIT),
163 fullscreen_mouselock_deny_button_text);
164 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698