Chromium Code Reviews| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 70 EXPECT_FALSE([controller isFullscreen]); | 70 EXPECT_FALSE([controller isFullscreen]); |
| 71 [controller setFullscreen:YES]; | 71 [controller setFullscreen:YES]; |
| 72 EXPECT_TRUE([controller isFullscreen]); | 72 EXPECT_TRUE([controller isFullscreen]); |
| 73 [controller setFullscreen:NO]; | 73 [controller setFullscreen:NO]; |
| 74 EXPECT_FALSE([controller isFullscreen]); | 74 EXPECT_FALSE([controller isFullscreen]); |
| 75 | 75 |
| 76 // Confirm the real fullscreen command doesn't return nil | 76 // Confirm the real fullscreen command doesn't return nil |
| 77 EXPECT_TRUE([controller_ fullscreenWindow]); | 77 EXPECT_TRUE([controller_ fullscreenWindow]); |
| 78 } | 78 } |
| 79 | 79 |
| 80 TEST_F(BrowserWindowControllerTest, TestNormal) { | |
| 81 // Make sure a normal BrowserWindowController is, uh, normal. | |
| 82 EXPECT_TRUE([controller_ isNormalWindow]); | |
| 83 | |
| 84 // And make sure a controller for a pop-up window is not normal. | |
| 85 scoped_ptr<Browser> popup_browser(Browser::CreateForPopup( | |
| 86 browser_helper_.profile())); | |
| 87 controller_.reset([[BrowserWindowController alloc] | |
| 88 initWithBrowser:popup_browser.get() | |
| 89 takeOwnership:NO]); | |
| 90 EXPECT_FALSE([controller_ isNormalWindow]); | |
| 91 | |
| 92 // The created BrowserWindowController gets autoreleased, so make | |
| 93 // sure we don't also release it. | |
| 94 // (Confirmed with valgrind). | |
| 95 controller_.release(); | |
|
pink (ping after 24hrs)
2009/07/01 12:53:00
why is this necessary? won't it do that when the t
John Grabowski
2009/07/02 20:28:25
Somehow the controller gets autoreleased. I can c
| |
| 96 } | |
| 97 | |
| 80 /* TODO(???): test other methods of BrowserWindowController */ | 98 /* TODO(???): test other methods of BrowserWindowController */ |
| OLD | NEW |