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

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

Issue 10807047: Create content\public\test\test_utils.h to hold common test classes that are used by unit and brows… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 | Annotate | Revision Log
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/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/ui/browser.h" 8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/browser/ui/browser_tabstrip.h" 9 #include "chrome/browser/ui/browser_tabstrip.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/browser/ui/tabs/tab_strip_model.h" 13 #include "chrome/browser/ui/tabs/tab_strip_model.h"
14 #include "chrome/common/chrome_notification_types.h" 14 #include "chrome/common/chrome_notification_types.h"
15 #include "chrome/test/base/ui_test_utils.h"
16 #include "content/public/browser/notification_service.h" 15 #include "content/public/browser/notification_service.h"
17 #include "content/public/browser/site_instance.h" 16 #include "content/public/browser/site_instance.h"
18 #include "content/public/browser/web_contents.h" 17 #include "content/public/browser/web_contents.h"
18 #include "content/public/test/test_utils.h"
19 #include "ipc/ipc_message.h" 19 #include "ipc/ipc_message.h"
20 #include "testing/gtest_mac.h" 20 #include "testing/gtest_mac.h"
21 #include "ui/base/accelerators/accelerator_cocoa.h" 21 #include "ui/base/accelerators/accelerator_cocoa.h"
22 22
23 using content::SiteInstance; 23 using content::SiteInstance;
24 using content::WebContents; 24 using content::WebContents;
25 25
26 @interface FullscreenExitBubbleController(JustForTesting) 26 @interface FullscreenExitBubbleController(JustForTesting)
27 // Already defined. 27 // Already defined.
28 + (NSString*)keyCommandString; 28 + (NSString*)keyCommandString;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 NSWindow* window = browser()->window()->GetNativeWindow(); 81 NSWindow* window = browser()->window()->GetNativeWindow();
82 BrowserWindowController* bwc = [BrowserWindowController 82 BrowserWindowController* bwc = [BrowserWindowController
83 browserWindowControllerForWindow:window]; 83 browserWindowControllerForWindow:window];
84 84
85 [bwc showWindow:nil]; 85 [bwc showWindow:nil];
86 86
87 AppendTabToStrip(); 87 AppendTabToStrip();
88 WebContents* fullscreen_tab = chrome::GetActiveWebContents(browser()); 88 WebContents* fullscreen_tab = chrome::GetActiveWebContents(browser());
89 { 89 {
90 base::mac::ScopedNSAutoreleasePool pool; 90 base::mac::ScopedNSAutoreleasePool pool;
91 ui_test_utils::WindowedNotificationObserver fullscreen_observer( 91 content::WindowedNotificationObserver fullscreen_observer(
92 chrome::NOTIFICATION_FULLSCREEN_CHANGED, 92 chrome::NOTIFICATION_FULLSCREEN_CHANGED,
93 content::NotificationService::AllSources()); 93 content::NotificationService::AllSources());
94 browser()->ToggleFullscreenModeForTab(fullscreen_tab, true); 94 browser()->ToggleFullscreenModeForTab(fullscreen_tab, true);
95 fullscreen_observer.Wait(); 95 fullscreen_observer.Wait();
96 ASSERT_TRUE(browser()->window()->IsFullscreen()); 96 ASSERT_TRUE(browser()->window()->IsFullscreen());
97 } 97 }
98 98
99 FullscreenExitBubbleController* bubble = [bwc fullscreenExitBubbleController]; 99 FullscreenExitBubbleController* bubble = [bwc fullscreenExitBubbleController];
100 EXPECT_TRUE(bubble); 100 EXPECT_TRUE(bubble);
101 { 101 {
102 ui_test_utils::WindowedNotificationObserver fullscreen_observer( 102 content::WindowedNotificationObserver fullscreen_observer(
103 chrome::NOTIFICATION_FULLSCREEN_CHANGED, 103 chrome::NOTIFICATION_FULLSCREEN_CHANGED,
104 content::NotificationService::AllSources()); 104 content::NotificationService::AllSources());
105 [bubble deny:nil]; 105 [bubble deny:nil];
106 fullscreen_observer.Wait(); 106 fullscreen_observer.Wait();
107 } 107 }
108 EXPECT_FALSE([bwc fullscreenExitBubbleController]); 108 EXPECT_FALSE([bwc fullscreenExitBubbleController]);
109 EXPECT_FALSE(browser()->window()->IsFullscreen()); 109 EXPECT_FALSE(browser()->window()->IsFullscreen());
110 CloseBrowserWindow(); 110 CloseBrowserWindow();
111 } 111 }
112 112
113 TEST_F(FullscreenExitBubbleControllerTest, LabelWasReplaced) { 113 TEST_F(FullscreenExitBubbleControllerTest, LabelWasReplaced) {
114 EXPECT_FALSE([controller_ exitLabelPlaceholder]); 114 EXPECT_FALSE([controller_ exitLabelPlaceholder]);
115 EXPECT_TRUE([controller_ exitLabel]); 115 EXPECT_TRUE([controller_ exitLabel]);
116 } 116 }
117 117
118 TEST_F(FullscreenExitBubbleControllerTest, ShortcutText) { 118 TEST_F(FullscreenExitBubbleControllerTest, ShortcutText) {
119 ui::AcceleratorCocoa cmd_F(@"F", NSCommandKeyMask); 119 ui::AcceleratorCocoa cmd_F(@"F", NSCommandKeyMask);
120 ui::AcceleratorCocoa cmd_shift_f(@"f", NSCommandKeyMask|NSShiftKeyMask); 120 ui::AcceleratorCocoa cmd_shift_f(@"f", NSCommandKeyMask|NSShiftKeyMask);
121 NSString* cmd_F_text = [FullscreenExitBubbleController 121 NSString* cmd_F_text = [FullscreenExitBubbleController
122 keyCombinationForAccelerator:cmd_F]; 122 keyCombinationForAccelerator:cmd_F];
123 NSString* cmd_shift_f_text = [FullscreenExitBubbleController 123 NSString* cmd_shift_f_text = [FullscreenExitBubbleController
124 keyCombinationForAccelerator:cmd_shift_f]; 124 keyCombinationForAccelerator:cmd_shift_f];
125 EXPECT_NSEQ(cmd_shift_f_text, cmd_F_text); 125 EXPECT_NSEQ(cmd_shift_f_text, cmd_F_text);
126 EXPECT_NSEQ(@"\u2318\u21E7F", cmd_shift_f_text); 126 EXPECT_NSEQ(@"\u2318\u21E7F", cmd_shift_f_text);
127 } 127 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller_unittest.mm ('k') | chrome/browser/ui/find_bar/find_bar_host_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698