| 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/memory/scoped_nsobject.h" | 9 #include "base/memory/scoped_nsobject.h" |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "base/sys_string_conversions.h" | 12 #include "base/sys_string_conversions.h" |
| 13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 14 #include "chrome/browser/bookmarks/bookmark_model.h" | 14 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 15 #include "chrome/browser/bookmarks/bookmark_utils.h" | 15 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 16 #include "chrome/browser/extensions/extension_system_factory.h" |
| 17 #include "chrome/browser/extensions/test_extension_system.h" |
| 16 #import "chrome/browser/ui/cocoa/animation_utils.h" | 18 #import "chrome/browser/ui/cocoa/animation_utils.h" |
| 17 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" | 19 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" |
| 18 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" | 20 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" |
| 19 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_window.h" | 21 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_window.h" |
| 20 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_unittest_helper.h" | 22 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_unittest_helper.h" |
| 21 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_view.h" | 23 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_view.h" |
| 22 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" | 24 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" |
| 23 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.h" | 25 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.h" |
| 24 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu.h" | 26 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu.h" |
| 25 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 27 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 class BookmarkBarControllerTestBase : public CocoaProfileTest { | 267 class BookmarkBarControllerTestBase : public CocoaProfileTest { |
| 266 public: | 268 public: |
| 267 scoped_nsobject<NSView> parent_view_; | 269 scoped_nsobject<NSView> parent_view_; |
| 268 scoped_nsobject<ViewResizerPong> resizeDelegate_; | 270 scoped_nsobject<ViewResizerPong> resizeDelegate_; |
| 269 | 271 |
| 270 virtual void SetUp() { | 272 virtual void SetUp() { |
| 271 CocoaProfileTest::SetUp(); | 273 CocoaProfileTest::SetUp(); |
| 272 ASSERT_TRUE(profile()); | 274 ASSERT_TRUE(profile()); |
| 273 | 275 |
| 274 FilePath extension_dir; | 276 FilePath extension_dir; |
| 275 profile()->CreateExtensionService(CommandLine::ForCurrentProcess(), | 277 static_cast<TestExtensionSystem*>( |
| 276 extension_dir, false); | 278 ExtensionSystemFactory::GetForProfile(profile()))-> |
| 279 CreateExtensionService( |
| 280 CommandLine::ForCurrentProcess(), |
| 281 extension_dir, false); |
| 277 resizeDelegate_.reset([[ViewResizerPong alloc] init]); | 282 resizeDelegate_.reset([[ViewResizerPong alloc] init]); |
| 278 NSRect parent_frame = NSMakeRect(0, 0, 800, 50); | 283 NSRect parent_frame = NSMakeRect(0, 0, 800, 50); |
| 279 parent_view_.reset([[NSView alloc] initWithFrame:parent_frame]); | 284 parent_view_.reset([[NSView alloc] initWithFrame:parent_frame]); |
| 280 [parent_view_ setHidden:YES]; | 285 [parent_view_ setHidden:YES]; |
| 281 } | 286 } |
| 282 | 287 |
| 283 void InstallAndToggleBar(BookmarkBarController* bar) { | 288 void InstallAndToggleBar(BookmarkBarController* bar) { |
| 284 // Force loading of the nib. | 289 // Force loading of the nib. |
| 285 [bar view]; | 290 [bar view]; |
| 286 // Awkwardness to look like we've been installed. | 291 // Awkwardness to look like we've been installed. |
| (...skipping 1894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2181 "2f3b ] 4b "); | 2186 "2f3b ] 4b "); |
| 2182 actual = model_test_utils::ModelStringFromNode(root); | 2187 actual = model_test_utils::ModelStringFromNode(root); |
| 2183 EXPECT_EQ(expected, actual); | 2188 EXPECT_EQ(expected, actual); |
| 2184 | 2189 |
| 2185 // Verify that the other bookmark folder can't be deleted. | 2190 // Verify that the other bookmark folder can't be deleted. |
| 2186 BookmarkButton *otherButton = [bar_ otherBookmarksButton]; | 2191 BookmarkButton *otherButton = [bar_ otherBookmarksButton]; |
| 2187 EXPECT_FALSE([bar_ canDragBookmarkButtonToTrash:otherButton]); | 2192 EXPECT_FALSE([bar_ canDragBookmarkButtonToTrash:otherButton]); |
| 2188 } | 2193 } |
| 2189 | 2194 |
| 2190 } // namespace | 2195 } // namespace |
| OLD | NEW |