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

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

Issue 10702029: Move tab functions off Browser into browser_tabstrip and browser_tabrestore. (Closed) Base URL: svn://svn.chromium.org/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_window.h" 10 #include "chrome/browser/ui/browser_window.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/common/chrome_notification_types.h" 14 #include "chrome/common/chrome_notification_types.h"
14 #include "chrome/test/base/ui_test_utils.h" 15 #include "chrome/test/base/ui_test_utils.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 "ipc/ipc_message.h" 19 #include "ipc/ipc_message.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 EXPECT_TRUE([controller_ window]); 59 EXPECT_TRUE([controller_ window]);
59 } 60 }
60 61
61 virtual void TearDown() { 62 virtual void TearDown() {
62 [controller_ close]; 63 [controller_ close];
63 controller_.reset(); 64 controller_.reset();
64 CocoaProfileTest::TearDown(); 65 CocoaProfileTest::TearDown();
65 } 66 }
66 67
67 void AppendTabToStrip() { 68 void AppendTabToStrip() {
68 TabContents* tab_contents = Browser::TabContentsFactory( 69 TabContents* tab_contents = chrome::TabContentsFactory(
69 profile(), site_instance_, MSG_ROUTING_NONE, 70 profile(), site_instance_, MSG_ROUTING_NONE, NULL, NULL);
70 NULL, NULL);
71 browser()->tab_strip_model()->AppendTabContents( 71 browser()->tab_strip_model()->AppendTabContents(
72 tab_contents, /*foreground=*/true); 72 tab_contents, /*foreground=*/true);
73 } 73 }
74 74
75 scoped_refptr<SiteInstance> site_instance_; 75 scoped_refptr<SiteInstance> site_instance_;
76 scoped_nsobject<FullscreenExitBubbleController> controller_; 76 scoped_nsobject<FullscreenExitBubbleController> controller_;
77 }; 77 };
78 78
79 TEST_F(FullscreenExitBubbleControllerTest, DenyExitsFullscreen) { 79 TEST_F(FullscreenExitBubbleControllerTest, DenyExitsFullscreen) {
80 CreateBrowserWindow(); 80 CreateBrowserWindow();
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 = browser()->GetActiveWebContents(); 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 ui_test_utils::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
(...skipping 19 matching lines...) Expand all
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

Powered by Google App Engine
This is Rietveld 408576698