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 "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "chrome/browser/bookmarks/bookmark_utils.h" | 9 #include "chrome/browser/bookmarks/bookmark_utils.h" |
10 #include "chrome/browser/cocoa/browser_test_helper.h" | 10 #include "chrome/browser/cocoa/browser_test_helper.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 scoped_ptr<BrowserWindowCocoaPong> scoped_bwc(bwc); | 83 scoped_ptr<BrowserWindowCocoaPong> scoped_bwc(bwc); |
84 | 84 |
85 bool before = bwc->IsBookmarkBarVisible(); | 85 bool before = bwc->IsBookmarkBarVisible(); |
86 bookmark_utils::ToggleWhenVisible(browser_helper_.profile()); | 86 bookmark_utils::ToggleWhenVisible(browser_helper_.profile()); |
87 EXPECT_NE(before, bwc->IsBookmarkBarVisible()); | 87 EXPECT_NE(before, bwc->IsBookmarkBarVisible()); |
88 | 88 |
89 bookmark_utils::ToggleWhenVisible(browser_helper_.profile()); | 89 bookmark_utils::ToggleWhenVisible(browser_helper_.profile()); |
90 EXPECT_EQ(before, bwc->IsBookmarkBarVisible()); | 90 EXPECT_EQ(before, bwc->IsBookmarkBarVisible()); |
91 } | 91 } |
92 | 92 |
| 93 @interface FakeController : NSWindowController { |
| 94 BOOL fullscreen_; |
| 95 } |
| 96 @end |
| 97 |
| 98 @implementation FakeController |
| 99 - (void)setFullscreen:(BOOL)fullscreen { |
| 100 fullscreen_ = fullscreen; |
| 101 } |
| 102 - (BOOL)isFullscreen { |
| 103 return fullscreen_; |
| 104 } |
| 105 @end |
| 106 |
| 107 TEST_F(BrowserWindowCocoaTest, TestFullscreen) { |
| 108 scoped_nsobject<FakeController> fake_controller_([[FakeController alloc] |
| 109 init]); |
| 110 BrowserWindowCocoaPong *bwc = new BrowserWindowCocoaPong( |
| 111 browser_helper_.browser(), |
| 112 (BrowserWindowController*)fake_controller_.get(), |
| 113 cocoa_helper_.window()); |
| 114 scoped_ptr<BrowserWindowCocoaPong> scoped_bwc(bwc); |
| 115 |
| 116 EXPECT_FALSE(bwc->IsFullscreen()); |
| 117 bwc->SetFullscreen(true); |
| 118 EXPECT_TRUE(bwc->IsFullscreen()); |
| 119 bwc->SetFullscreen(false); |
| 120 EXPECT_FALSE(bwc->IsFullscreen()); |
| 121 } |
| 122 |
93 /* TODO(???): test other methods of BrowserWindowCocoa */ | 123 /* TODO(???): test other methods of BrowserWindowCocoa */ |
OLD | NEW |