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

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

Issue 12018007: Refactor BrowserWindow fullscreen and presentation on Mac to be consistent with other platforms. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge TOT Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "base/memory/scoped_nsobject.h" 5 #include "base/memory/scoped_nsobject.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" 8 #include "chrome/browser/ui/bookmarks/bookmark_utils.h"
9 #import "chrome/browser/ui/cocoa/browser_window_cocoa.h" 9 #import "chrome/browser/ui/cocoa/browser_window_cocoa.h"
10 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 10 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 - (void)enterFullscreenForURL:(const GURL&)url 56 - (void)enterFullscreenForURL:(const GURL&)url
57 bubbleType:(FullscreenExitBubbleType)bubbleType { 57 bubbleType:(FullscreenExitBubbleType)bubbleType {
58 fullscreen_ = YES; 58 fullscreen_ = YES;
59 } 59 }
60 - (void)exitFullscreen { 60 - (void)exitFullscreen {
61 fullscreen_ = NO; 61 fullscreen_ = NO;
62 } 62 }
63 - (BOOL)isFullscreen { 63 - (BOOL)isFullscreen {
64 return fullscreen_; 64 return fullscreen_;
65 } 65 }
66 - (BOOL)inPresentationMode {
67 return false;
Robert Sesek 2013/01/18 19:41:35 return NO
scheib 2013/01/23 18:13:37 Done.
68 }
66 @end 69 @end
67 70
68 TEST_F(BrowserWindowCocoaTest, TestFullscreen) { 71 TEST_F(BrowserWindowCocoaTest, TestFullscreen) {
69 // Wrap the FakeController in a scoped_nsobject instead of autoreleasing in 72 // Wrap the FakeController in a scoped_nsobject instead of autoreleasing in
70 // windowWillClose: because we never actually open a window in this test (so 73 // windowWillClose: because we never actually open a window in this test (so
71 // windowWillClose: never gets called). 74 // windowWillClose: never gets called).
72 scoped_nsobject<FakeController> fake_controller( 75 scoped_nsobject<FakeController> fake_controller(
73 [[FakeController alloc] init]); 76 [[FakeController alloc] init]);
74 scoped_ptr<BrowserWindowCocoa> bwc(new BrowserWindowCocoa( 77 scoped_ptr<BrowserWindowCocoa> bwc(new BrowserWindowCocoa(
75 browser(), static_cast<BrowserWindowController*>(fake_controller.get()))); 78 browser(), static_cast<BrowserWindowController*>(fake_controller.get())));
76 79
77 EXPECT_FALSE(bwc->IsFullscreen()); 80 EXPECT_FALSE(bwc->IsFullscreenWithChrome());
78 bwc->EnterFullscreen(GURL(), FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION); 81 EXPECT_FALSE(bwc->IsFullscreenWithoutChrome());
79 EXPECT_TRUE(bwc->IsFullscreen()); 82 bwc->EnterFullscreenWithChrome(GURL(),
83 FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION);
84 EXPECT_TRUE(bwc->IsFullscreenWithChrome());
85 EXPECT_FALSE(bwc->IsFullscreenWithoutChrome());
80 bwc->ExitFullscreen(); 86 bwc->ExitFullscreen();
81 EXPECT_FALSE(bwc->IsFullscreen()); 87 EXPECT_FALSE(bwc->IsFullscreenWithChrome());
88 EXPECT_FALSE(bwc->IsFullscreenWithoutChrome());
82 [fake_controller close]; 89 [fake_controller close];
83 } 90 }
84 91
85 // Tests that BrowserWindowCocoa::Close mimics the behavior of 92 // Tests that BrowserWindowCocoa::Close mimics the behavior of
86 // -[NSWindow performClose:]. 93 // -[NSWindow performClose:].
87 class BrowserWindowCocoaCloseTest : public CocoaProfileTest { 94 class BrowserWindowCocoaCloseTest : public CocoaProfileTest {
88 public: 95 public:
89 BrowserWindowCocoaCloseTest() 96 BrowserWindowCocoaCloseTest()
90 : controller_( 97 : controller_(
91 [OCMockObject mockForClass:[BrowserWindowController class]]), 98 [OCMockObject mockForClass:[BrowserWindowController class]]),
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 [[[window_ stub] andReturn:nil] delegate]; 203 [[[window_ stub] andReturn:nil] delegate];
197 [[[controller_ stub] andReturn:window_] window]; 204 [[[controller_ stub] andReturn:window_] window];
198 [[window_ expect] orderOut:nil]; 205 [[window_ expect] orderOut:nil];
199 [[window_ expect] close]; 206 [[window_ expect] close];
200 CreateAndCloseBrowserWindow(); 207 CreateAndCloseBrowserWindow();
201 EXPECT_OCMOCK_VERIFY(controller_); 208 EXPECT_OCMOCK_VERIFY(controller_);
202 EXPECT_OCMOCK_VERIFY(window_); 209 EXPECT_OCMOCK_VERIFY(window_);
203 } 210 }
204 211
205 // TODO(???): test other methods of BrowserWindowCocoa 212 // TODO(???): test other methods of BrowserWindowCocoa
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698