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_model_factory.h" | 15 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
16 #include "chrome/browser/bookmarks/bookmark_utils.h" | 16 #include "chrome/browser/bookmarks/bookmark_utils.h" |
17 #include "chrome/browser/extensions/test_extension_system.h" | 17 #include "chrome/browser/extensions/test_extension_system.h" |
18 #import "chrome/browser/ui/cocoa/animation_utils.h" | 18 #import "chrome/browser/ui/cocoa/animation_utils.h" |
19 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" | 19 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" |
20 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" | 20 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" |
21 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_window.h" | 21 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_window.h" |
22 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_unittest_helper.h" | 22 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_unittest_helper.h" |
23 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_view.h" | 23 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_view.h" |
24 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" | 24 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" |
25 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.h" | 25 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.h" |
26 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 26 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
27 #import "chrome/browser/ui/cocoa/view_resizer_pong.h" | 27 #import "chrome/browser/ui/cocoa/view_resizer_pong.h" |
28 #include "chrome/common/pref_names.h" | |
28 #include "chrome/test/base/model_test_utils.h" | 29 #include "chrome/test/base/model_test_utils.h" |
29 #include "testing/gtest/include/gtest/gtest.h" | 30 #include "testing/gtest/include/gtest/gtest.h" |
30 #import "testing/gtest_mac.h" | 31 #import "testing/gtest_mac.h" |
31 #include "testing/platform_test.h" | 32 #include "testing/platform_test.h" |
32 #include "third_party/ocmock/gtest_support.h" | 33 #include "third_party/ocmock/gtest_support.h" |
33 #import "third_party/ocmock/OCMock/OCMock.h" | 34 #import "third_party/ocmock/OCMock/OCMock.h" |
34 #include "ui/base/test/cocoa_test_event_utils.h" | 35 #include "ui/base/test/cocoa_test_event_utils.h" |
35 #include "ui/base/theme_provider.h" | 36 #include "ui/base/theme_provider.h" |
36 #include "ui/gfx/image/image_skia.h" | 37 #include "ui/gfx/image/image_skia.h" |
37 | 38 |
(...skipping 1472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1510 EXPECT_EQ(40.0, NSWidth([view frame])); | 1511 EXPECT_EQ(40.0, NSWidth([view frame])); |
1511 EXPECT_FALSE([view isHidden]); | 1512 EXPECT_FALSE([view isHidden]); |
1512 [bar_ shrinkOrHideView:view forMaxX:31.0]; | 1513 [bar_ shrinkOrHideView:view forMaxX:31.0]; |
1513 EXPECT_EQ(31.0, NSWidth([view frame])); | 1514 EXPECT_EQ(31.0, NSWidth([view frame])); |
1514 EXPECT_FALSE([view isHidden]); | 1515 EXPECT_FALSE([view isHidden]); |
1515 [bar_ shrinkOrHideView:view forMaxX:29.0]; | 1516 [bar_ shrinkOrHideView:view forMaxX:29.0]; |
1516 EXPECT_TRUE([view isHidden]); | 1517 EXPECT_TRUE([view isHidden]); |
1517 } | 1518 } |
1518 | 1519 |
1519 TEST_F(BookmarkBarControllerTest, LastBookmarkResizeBehavior) { | 1520 TEST_F(BookmarkBarControllerTest, LastBookmarkResizeBehavior) { |
1521 // This test assumes the Apps button is not displayed. | |
1522 profile()->GetPrefs()->SetBoolean( | |
1523 prefs::kShowAppsShortcutInBookmarkBar, false); | |
Alexei Svitkine (slow)
2013/03/11 21:06:43
Please clean up after the test - don't just set a
beaudoin
2013/03/11 21:29:56
Looks like this was not needed after all.
Done.
| |
1520 BookmarkModel& model(*BookmarkModelFactory::GetForProfile(profile())); | 1524 BookmarkModel& model(*BookmarkModelFactory::GetForProfile(profile())); |
1521 const BookmarkNode* root = model.bookmark_bar_node(); | 1525 const BookmarkNode* root = model.bookmark_bar_node(); |
1522 const std::string model_string("1b 2f:[ 2f1b 2f2b ] 3b "); | 1526 const std::string model_string("1b 2f:[ 2f1b 2f2b ] 3b "); |
1523 model_test_utils::AddNodesFromModelString(model, root, model_string); | 1527 model_test_utils::AddNodesFromModelString(model, root, model_string); |
1524 [bar_ frameDidChange]; | 1528 [bar_ frameDidChange]; |
1525 | 1529 |
1526 CGFloat viewWidths[] = { 123.0, 151.0, 152.0, 153.0, 154.0, 155.0, 200.0, | 1530 CGFloat viewWidths[] = { 123.0, 151.0, 152.0, 153.0, 154.0, 155.0, 200.0, |
1527 155.0, 154.0, 153.0, 152.0, 151.0 }; | 1531 155.0, 154.0, 153.0, 152.0, 151.0 }; |
1528 BOOL offTheSideButtonIsHiddenResults[] = { NO, NO, NO, YES, YES, YES, YES, | 1532 BOOL offTheSideButtonIsHiddenResults[] = { NO, NO, NO, YES, YES, YES, YES, |
1529 YES, YES, YES, NO, NO, NO }; | 1533 YES, YES, YES, NO, NO, NO }; |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2002 "2f3b ] 4b "); | 2006 "2f3b ] 4b "); |
2003 actual = model_test_utils::ModelStringFromNode(root); | 2007 actual = model_test_utils::ModelStringFromNode(root); |
2004 EXPECT_EQ(expected, actual); | 2008 EXPECT_EQ(expected, actual); |
2005 | 2009 |
2006 // Verify that the other bookmark folder can't be deleted. | 2010 // Verify that the other bookmark folder can't be deleted. |
2007 BookmarkButton *otherButton = [bar_ otherBookmarksButton]; | 2011 BookmarkButton *otherButton = [bar_ otherBookmarksButton]; |
2008 EXPECT_FALSE([bar_ canDragBookmarkButtonToTrash:otherButton]); | 2012 EXPECT_FALSE([bar_ canDragBookmarkButtonToTrash:otherButton]); |
2009 } | 2013 } |
2010 | 2014 |
2011 } // namespace | 2015 } // namespace |
OLD | NEW |