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

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

Issue 18576005: [Mac] Adds a flag to force 10.6-style fullscreen for testing. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove broken DCHECK. Created 7 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
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/mac/mac_util.h" 5 #include "base/mac/mac_util.h"
6 #include "base/mac/scoped_nsobject.h" 6 #include "base/mac/scoped_nsobject.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "chrome/browser/fullscreen.h"
9 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" 10 #include "chrome/browser/ui/bookmarks/bookmark_utils.h"
10 #import "chrome/browser/ui/cocoa/browser_window_cocoa.h" 11 #import "chrome/browser/ui/cocoa/browser_window_cocoa.h"
11 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 12 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
12 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" 13 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h"
13 #include "chrome/common/chrome_notification_types.h" 14 #include "chrome/common/chrome_notification_types.h"
14 #include "chrome/common/pref_names.h" 15 #include "chrome/common/pref_names.h"
15 #include "content/public/browser/notification_details.h" 16 #include "content/public/browser/notification_details.h"
16 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
17 #import "third_party/ocmock/OCMock/OCMock.h" 18 #import "third_party/ocmock/OCMock/OCMock.h"
18 #import "third_party/ocmock/gtest_support.h" 19 #import "third_party/ocmock/gtest_support.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 EXPECT_FALSE(bwc->IsFullscreen()); 88 EXPECT_FALSE(bwc->IsFullscreen());
88 bwc->EnterFullscreen(GURL(), FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION); 89 bwc->EnterFullscreen(GURL(), FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION);
89 EXPECT_FALSE(bwc->IsFullscreenWithChrome()); 90 EXPECT_FALSE(bwc->IsFullscreenWithChrome());
90 EXPECT_TRUE(bwc->IsFullscreenWithoutChrome()); 91 EXPECT_TRUE(bwc->IsFullscreenWithoutChrome());
91 bwc->ExitFullscreen(); 92 bwc->ExitFullscreen();
92 EXPECT_FALSE(bwc->IsFullscreen()); 93 EXPECT_FALSE(bwc->IsFullscreen());
93 [fake_controller close]; 94 [fake_controller close];
94 } 95 }
95 96
96 TEST_F(BrowserWindowCocoaTest, TestFullscreenWithChrome) { 97 TEST_F(BrowserWindowCocoaTest, TestFullscreenWithChrome) {
97 if (!base::mac::IsOSLionOrLater()) 98 if (!chrome::mac::SupportsSystemFullscreen())
98 return; 99 return;
99 // Wrap the FakeController in a scoped_nsobject instead of autoreleasing in 100 // Wrap the FakeController in a scoped_nsobject instead of autoreleasing in
100 // windowWillClose: because we never actually open a window in this test (so 101 // windowWillClose: because we never actually open a window in this test (so
101 // windowWillClose: never gets called). 102 // windowWillClose: never gets called).
102 base::scoped_nsobject<FakeController> fake_controller( 103 base::scoped_nsobject<FakeController> fake_controller(
103 [[FakeController alloc] init]); 104 [[FakeController alloc] init]);
104 scoped_ptr<BrowserWindowCocoa> bwc(new BrowserWindowCocoa( 105 scoped_ptr<BrowserWindowCocoa> bwc(new BrowserWindowCocoa(
105 browser(), static_cast<BrowserWindowController*>(fake_controller.get()))); 106 browser(), static_cast<BrowserWindowController*>(fake_controller.get())));
106 107
107 EXPECT_FALSE(bwc->IsFullscreen()); 108 EXPECT_FALSE(bwc->IsFullscreen());
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 [[[window_ stub] andReturn:nil] delegate]; 228 [[[window_ stub] andReturn:nil] delegate];
228 [[[controller_ stub] andReturn:window_] window]; 229 [[[controller_ stub] andReturn:window_] window];
229 [[window_ expect] orderOut:nil]; 230 [[window_ expect] orderOut:nil];
230 [[window_ expect] close]; 231 [[window_ expect] close];
231 CreateAndCloseBrowserWindow(); 232 CreateAndCloseBrowserWindow();
232 EXPECT_OCMOCK_VERIFY(controller_); 233 EXPECT_OCMOCK_VERIFY(controller_);
233 EXPECT_OCMOCK_VERIFY(window_); 234 EXPECT_OCMOCK_VERIFY(window_);
234 } 235 }
235 236
236 // TODO(???): test other methods of BrowserWindowCocoa 237 // TODO(???): test other methods of BrowserWindowCocoa
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698