| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 class BookmarkBarControllerTestBase : public CocoaProfileTest { | 268 class BookmarkBarControllerTestBase : public CocoaProfileTest { |
| 267 public: | 269 public: |
| 268 scoped_nsobject<NSView> parent_view_; | 270 scoped_nsobject<NSView> parent_view_; |
| 269 scoped_nsobject<ViewResizerPong> resizeDelegate_; | 271 scoped_nsobject<ViewResizerPong> resizeDelegate_; |
| 270 | 272 |
| 271 virtual void SetUp() { | 273 virtual void SetUp() { |
| 272 CocoaProfileTest::SetUp(); | 274 CocoaProfileTest::SetUp(); |
| 273 ASSERT_TRUE(profile()); | 275 ASSERT_TRUE(profile()); |
| 274 | 276 |
| 275 FilePath extension_dir; | 277 FilePath extension_dir; |
| 276 profile()->CreateExtensionService(CommandLine::ForCurrentProcess(), | 278 static_cast<TestExtensionSystem*>( |
| 277 extension_dir, false); | 279 ExtensionSystemFactory::GetForProfile(profile()))-> |
| 280 CreateExtensionService( |
| 281 CommandLine::ForCurrentProcess(), |
| 282 extension_dir, false); |
| 278 resizeDelegate_.reset([[ViewResizerPong alloc] init]); | 283 resizeDelegate_.reset([[ViewResizerPong alloc] init]); |
| 279 NSRect parent_frame = NSMakeRect(0, 0, 800, 50); | 284 NSRect parent_frame = NSMakeRect(0, 0, 800, 50); |
| 280 parent_view_.reset([[NSView alloc] initWithFrame:parent_frame]); | 285 parent_view_.reset([[NSView alloc] initWithFrame:parent_frame]); |
| 281 [parent_view_ setHidden:YES]; | 286 [parent_view_ setHidden:YES]; |
| 282 } | 287 } |
| 283 | 288 |
| 284 void InstallAndToggleBar(BookmarkBarController* bar) { | 289 void InstallAndToggleBar(BookmarkBarController* bar) { |
| 285 // Force loading of the nib. | 290 // Force loading of the nib. |
| 286 [bar view]; | 291 [bar view]; |
| 287 // Awkwardness to look like we've been installed. | 292 // Awkwardness to look like we've been installed. |
| (...skipping 1894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2182 "2f3b ] 4b "); | 2187 "2f3b ] 4b "); |
| 2183 actual = model_test_utils::ModelStringFromNode(root); | 2188 actual = model_test_utils::ModelStringFromNode(root); |
| 2184 EXPECT_EQ(expected, actual); | 2189 EXPECT_EQ(expected, actual); |
| 2185 | 2190 |
| 2186 // Verify that the other bookmark folder can't be deleted. | 2191 // Verify that the other bookmark folder can't be deleted. |
| 2187 BookmarkButton *otherButton = [bar_ otherBookmarksButton]; | 2192 BookmarkButton *otherButton = [bar_ otherBookmarksButton]; |
| 2188 EXPECT_FALSE([bar_ canDragBookmarkButtonToTrash:otherButton]); | 2193 EXPECT_FALSE([bar_ canDragBookmarkButtonToTrash:otherButton]); |
| 2189 } | 2194 } |
| 2190 | 2195 |
| 2191 } // namespace | 2196 } // namespace |
| OLD | NEW |