| 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #include "base/scoped_nsobject.h" | 7 #include "base/scoped_nsobject.h" |
| 8 #import "chrome/browser/cocoa/bookmark_bar_controller.h" | 8 #import "chrome/browser/cocoa/bookmark_bar_controller.h" |
| 9 #include "chrome/browser/cocoa/browser_test_helper.h" | 9 #include "chrome/browser/cocoa/browser_test_helper.h" |
| 10 #import "chrome/browser/cocoa/cocoa_test_helper.h" | 10 #import "chrome/browser/cocoa/cocoa_test_helper.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 scoped_nsobject<NSView> parent_view_; | 52 scoped_nsobject<NSView> parent_view_; |
| 53 BrowserTestHelper helper_; | 53 BrowserTestHelper helper_; |
| 54 scoped_nsobject<BookmarkBarController> bar_; | 54 scoped_nsobject<BookmarkBarController> bar_; |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 TEST_F(BookmarkBarControllerTest, ShowHide) { | 57 TEST_F(BookmarkBarControllerTest, ShowHide) { |
| 58 // Assume hidden by default in a new profile. | 58 // Assume hidden by default in a new profile. |
| 59 EXPECT_FALSE([bar_ isBookmarkBarVisible]); | 59 EXPECT_FALSE([bar_ isBookmarkBarVisible]); |
| 60 EXPECT_TRUE([[bar_ view] isHidden]); | 60 EXPECT_TRUE([[bar_ view] isHidden]); |
| 61 | 61 |
| 62 // Awkwardness to look like we've been installed. |
| 63 [parent_view_ addSubview:[bar_ view]]; |
| 64 NSRect frame = [[[bar_ view] superview] frame]; |
| 65 frame.origin.y = 100; |
| 66 [[[bar_ view] superview] setFrame:frame]; |
| 67 |
| 62 // Show and hide it by toggling. | 68 // Show and hide it by toggling. |
| 63 [bar_ toggleBookmarkBar]; | 69 [bar_ toggleBookmarkBar]; |
| 64 EXPECT_TRUE([bar_ isBookmarkBarVisible]); | 70 EXPECT_TRUE([bar_ isBookmarkBarVisible]); |
| 65 EXPECT_FALSE([[bar_ view] isHidden]); | 71 EXPECT_FALSE([[bar_ view] isHidden]); |
| 66 NSRect content_frame = [content_area_ frame]; | 72 NSRect content_frame = [content_area_ frame]; |
| 67 EXPECT_NE(content_frame.size.height, kContentAreaHeight); | 73 EXPECT_NE(content_frame.size.height, kContentAreaHeight); |
| 68 EXPECT_GT([[bar_ view] frame].size.height, 0); | 74 EXPECT_GT([[bar_ view] frame].size.height, 0); |
| 69 | 75 |
| 70 [bar_ toggleBookmarkBar]; | 76 [bar_ toggleBookmarkBar]; |
| 71 EXPECT_FALSE([bar_ isBookmarkBarVisible]); | 77 EXPECT_FALSE([bar_ isBookmarkBarVisible]); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 // TODO(jrg): addNodesToBar has a LOT of TODOs; when flushed out, write | 169 // TODO(jrg): addNodesToBar has a LOT of TODOs; when flushed out, write |
| 164 // appropriate tests. | 170 // appropriate tests. |
| 165 } | 171 } |
| 166 | 172 |
| 167 // Test drawing, mostly to ensure nothing leaks or crashes. | 173 // Test drawing, mostly to ensure nothing leaks or crashes. |
| 168 TEST_F(BookmarkBarControllerTest, Display) { | 174 TEST_F(BookmarkBarControllerTest, Display) { |
| 169 [[bar_ view] display]; | 175 [[bar_ view] display]; |
| 170 } | 176 } |
| 171 | 177 |
| 172 } // namespace | 178 } // namespace |
| OLD | NEW |