| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/mac/scoped_nsobject.h" | 9 #include "base/mac/scoped_nsobject.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 | 340 |
| 341 class BookmarkBarControllerTest : public BookmarkBarControllerTestBase { | 341 class BookmarkBarControllerTest : public BookmarkBarControllerTestBase { |
| 342 public: | 342 public: |
| 343 base::scoped_nsobject<BookmarkBarControllerNoOpen> bar_; | 343 base::scoped_nsobject<BookmarkBarControllerNoOpen> bar_; |
| 344 | 344 |
| 345 virtual void SetUp() override { | 345 virtual void SetUp() override { |
| 346 BookmarkBarControllerTestBase::SetUp(); | 346 BookmarkBarControllerTestBase::SetUp(); |
| 347 ASSERT_TRUE(browser()); | 347 ASSERT_TRUE(browser()); |
| 348 AddCommandLineSwitches(); | 348 AddCommandLineSwitches(); |
| 349 | 349 |
| 350 bar_.reset( | 350 // In OSX 10.10, the owner of a nib file is retain/autoreleased during the |
| 351 [[BookmarkBarControllerNoOpen alloc] | 351 // initialization of the nib. Wrapping the constructor in an |
| 352 // autoreleasepool ensures that tests can control the destruction timing of |
| 353 // |bar_|. |
| 354 @autoreleasepool { |
| 355 bar_.reset([[BookmarkBarControllerNoOpen alloc] |
| 352 initWithBrowser:browser() | 356 initWithBrowser:browser() |
| 353 initialWidth:NSWidth([parent_view_ frame]) | 357 initialWidth:NSWidth([parent_view_ frame]) |
| 354 delegate:nil | 358 delegate:nil |
| 355 resizeDelegate:resizeDelegate_.get()]); | 359 resizeDelegate:resizeDelegate_.get()]); |
| 360 } |
| 356 | 361 |
| 357 InstallAndToggleBar(bar_.get()); | 362 InstallAndToggleBar(bar_.get()); |
| 358 } | 363 } |
| 359 | 364 |
| 360 virtual void AddCommandLineSwitches() {} | 365 virtual void AddCommandLineSwitches() {} |
| 361 | 366 |
| 362 BookmarkBarControllerNoOpen* noOpenBar() { | 367 BookmarkBarControllerNoOpen* noOpenBar() { |
| 363 return (BookmarkBarControllerNoOpen*)bar_.get(); | 368 return (BookmarkBarControllerNoOpen*)bar_.get(); |
| 364 } | 369 } |
| 365 }; | 370 }; |
| (...skipping 1763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2129 "2f3b ] 4b "); | 2134 "2f3b ] 4b "); |
| 2130 actual = test::ModelStringFromNode(root); | 2135 actual = test::ModelStringFromNode(root); |
| 2131 EXPECT_EQ(expected, actual); | 2136 EXPECT_EQ(expected, actual); |
| 2132 | 2137 |
| 2133 // Verify that the other bookmark folder can't be deleted. | 2138 // Verify that the other bookmark folder can't be deleted. |
| 2134 BookmarkButton *otherButton = [bar_ otherBookmarksButton]; | 2139 BookmarkButton *otherButton = [bar_ otherBookmarksButton]; |
| 2135 EXPECT_FALSE([bar_ canDragBookmarkButtonToTrash:otherButton]); | 2140 EXPECT_FALSE([bar_ canDragBookmarkButtonToTrash:otherButton]); |
| 2136 } | 2141 } |
| 2137 | 2142 |
| 2138 } // namespace | 2143 } // namespace |
| OLD | NEW |