OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/scoped_nsobject.h" | 5 #include "base/scoped_nsobject.h" |
6 #include "base/scoped_nsautorelease_pool.h" | 6 #include "base/scoped_nsautorelease_pool.h" |
7 #include "base/scoped_ptr.h" | 7 #include "base/scoped_ptr.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/cocoa/browser_test_helper.h" | 9 #include "chrome/browser/cocoa/browser_test_helper.h" |
10 #include "chrome/browser/cocoa/browser_window_controller.h" | 10 #include "chrome/browser/cocoa/browser_window_controller.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 ASSERT_TRUE(prefs->GetDictionary(prefs::kBrowserWindowPlacement) == NULL); | 43 ASSERT_TRUE(prefs->GetDictionary(prefs::kBrowserWindowPlacement) == NULL); |
44 | 44 |
45 // Ask the window to save its position, then check that a preference | 45 // Ask the window to save its position, then check that a preference |
46 // exists. We're technically passing in a pointer to the user prefs | 46 // exists. We're technically passing in a pointer to the user prefs |
47 // and not the local state prefs, but a PrefService* is a | 47 // and not the local state prefs, but a PrefService* is a |
48 // PrefService*, and this is a unittest. | 48 // PrefService*, and this is a unittest. |
49 [controller_ saveWindowPositionToPrefs:prefs]; | 49 [controller_ saveWindowPositionToPrefs:prefs]; |
50 EXPECT_TRUE(prefs->GetDictionary(prefs::kBrowserWindowPlacement) != NULL); | 50 EXPECT_TRUE(prefs->GetDictionary(prefs::kBrowserWindowPlacement) != NULL); |
51 } | 51 } |
52 | 52 |
| 53 @interface BrowserWindowControllerFakeFullscreen : BrowserWindowController { |
| 54 } |
| 55 @end |
| 56 @implementation BrowserWindowControllerFakeFullscreen |
| 57 // This isn't needed to pass the test, but does prevent an actual |
| 58 // fullscreen from happening. |
| 59 - (NSWindow*)fullscreenWindow { |
| 60 return nil; |
| 61 } |
| 62 @end |
| 63 |
| 64 TEST_F(BrowserWindowControllerTest, TestFullscreen) { |
| 65 // Note use of "controller", not "controller_" |
| 66 scoped_nsobject<BrowserWindowController> controller; |
| 67 controller.reset([[BrowserWindowControllerFakeFullscreen alloc] |
| 68 initWithBrowser:browser_helper_.browser() |
| 69 takeOwnership:NO]); |
| 70 EXPECT_FALSE([controller isFullscreen]); |
| 71 [controller setFullscreen:YES]; |
| 72 EXPECT_TRUE([controller isFullscreen]); |
| 73 [controller setFullscreen:NO]; |
| 74 EXPECT_FALSE([controller isFullscreen]); |
| 75 |
| 76 // Confirm the real fullscreen command doesn't return nil |
| 77 EXPECT_TRUE([controller_ fullscreenWindow]); |
| 78 } |
| 79 |
53 /* TODO(???): test other methods of BrowserWindowController */ | 80 /* TODO(???): test other methods of BrowserWindowController */ |
OLD | NEW |