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/exclusive_access_controller_views.h" |
10 #include "chrome/browser/ui/cocoa/browser_window_controller.h" | 11 #include "chrome/browser/ui/cocoa/browser_window_controller.h" |
11 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 12 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
12 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 13 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
13 #include "chrome/grit/generated_resources.h" | 14 #include "chrome/grit/generated_resources.h" |
14 #include "chrome/test/base/testing_profile.h" | 15 #include "chrome/test/base/testing_profile.h" |
15 #include "content/public/browser/notification_service.h" | 16 #include "content/public/browser/notification_service.h" |
16 #include "content/public/browser/site_instance.h" | 17 #include "content/public/browser/site_instance.h" |
17 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
18 #include "content/public/test/test_utils.h" | 19 #include "content/public/test/test_utils.h" |
19 #include "testing/gtest_mac.h" | 20 #include "testing/gtest_mac.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 { | 103 { |
103 base::mac::ScopedNSAutoreleasePool pool; | 104 base::mac::ScopedNSAutoreleasePool pool; |
104 content::WindowedNotificationObserver fullscreen_observer( | 105 content::WindowedNotificationObserver fullscreen_observer( |
105 chrome::NOTIFICATION_FULLSCREEN_CHANGED, | 106 chrome::NOTIFICATION_FULLSCREEN_CHANGED, |
106 content::NotificationService::AllSources()); | 107 content::NotificationService::AllSources()); |
107 browser()->EnterFullscreenModeForTab(fullscreen_tab, GURL()); | 108 browser()->EnterFullscreenModeForTab(fullscreen_tab, GURL()); |
108 fullscreen_observer.Wait(); | 109 fullscreen_observer.Wait(); |
109 ASSERT_TRUE(browser()->window()->IsFullscreen()); | 110 ASSERT_TRUE(browser()->window()->IsFullscreen()); |
110 } | 111 } |
111 | 112 |
112 ExclusiveAccessBubbleWindowController* bubble = | 113 ExclusiveAccessController* access_controller = [bwc exclusiveAccessContext]; |
113 [bwc exclusiveAccessBubbleWindowController]; | 114 EXPECT_TRUE(access_controller->cocoa_bubble()); |
114 EXPECT_TRUE(bubble); | |
115 { | 115 { |
116 content::WindowedNotificationObserver fullscreen_observer( | 116 content::WindowedNotificationObserver fullscreen_observer( |
117 chrome::NOTIFICATION_FULLSCREEN_CHANGED, | 117 chrome::NOTIFICATION_FULLSCREEN_CHANGED, |
118 content::NotificationService::AllSources()); | 118 content::NotificationService::AllSources()); |
119 [bubble deny:nil]; | 119 [access_controller->cocoa_bubble() deny:nil]; |
120 fullscreen_observer.Wait(); | 120 fullscreen_observer.Wait(); |
121 } | 121 } |
122 EXPECT_FALSE([bwc exclusiveAccessBubbleWindowController]); | 122 EXPECT_FALSE(access_controller->cocoa_bubble()); |
123 EXPECT_FALSE(browser()->window()->IsFullscreen()); | 123 EXPECT_FALSE(browser()->window()->IsFullscreen()); |
124 CloseBrowserWindow(); | 124 CloseBrowserWindow(); |
125 } | 125 } |
126 | 126 |
127 TEST_F(ExclusiveAccessBubbleWindowControllerTest, LabelWasReplaced) { | 127 TEST_F(ExclusiveAccessBubbleWindowControllerTest, LabelWasReplaced) { |
128 EXPECT_FALSE([controller_ exitLabelPlaceholder]); | 128 EXPECT_FALSE([controller_ exitLabelPlaceholder]); |
129 EXPECT_TRUE([controller_ exitLabel]); | 129 EXPECT_TRUE([controller_ exitLabel]); |
130 } | 130 } |
131 | 131 |
132 TEST_F(ExclusiveAccessBubbleWindowControllerTest, ShortcutText) { | 132 TEST_F(ExclusiveAccessBubbleWindowControllerTest, ShortcutText) { |
(...skipping 27 matching lines...) Expand all Loading... |
160 profile:browser()->profile() | 160 profile:browser()->profile() |
161 url:GURL() | 161 url:GURL() |
162 bubbleType: | 162 bubbleType: |
163 EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_MOUSELOCK_BUTTON
S]); | 163 EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_MOUSELOCK_BUTTON
S]); |
164 [controller_ initializeLabelAndButton]; | 164 [controller_ initializeLabelAndButton]; |
165 NSString* fullscreen_mouselock_deny_button_text = | 165 NSString* fullscreen_mouselock_deny_button_text = |
166 [controller_ denyButtonText]; | 166 [controller_ denyButtonText]; |
167 EXPECT_NSEQ(l10n_util::GetNSString(IDS_FULLSCREEN_EXIT), | 167 EXPECT_NSEQ(l10n_util::GetNSString(IDS_FULLSCREEN_EXIT), |
168 fullscreen_mouselock_deny_button_text); | 168 fullscreen_mouselock_deny_button_text); |
169 } | 169 } |
OLD | NEW |