Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(519)

Side by Side Diff: chrome/browser/cocoa/bookmark_bar_controller_unittest.mm

Issue 3095004: [Mac] Use the new {EXPECT,ASSERT}_NS{EQ,NE} macros where possible. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Fix compile Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "app/theme_provider.h" 7 #include "app/theme_provider.h"
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/scoped_nsobject.h" 9 #include "base/scoped_nsobject.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
11 #include "base/sys_string_conversions.h" 11 #include "base/sys_string_conversions.h"
12 #import "chrome/browser/cocoa/bookmark_bar_constants.h" 12 #import "chrome/browser/cocoa/bookmark_bar_constants.h"
13 #import "chrome/browser/cocoa/bookmark_bar_controller.h" 13 #import "chrome/browser/cocoa/bookmark_bar_controller.h"
14 #import "chrome/browser/cocoa/bookmark_bar_folder_window.h" 14 #import "chrome/browser/cocoa/bookmark_bar_folder_window.h"
15 #import "chrome/browser/cocoa/bookmark_bar_unittest_helper.h" 15 #import "chrome/browser/cocoa/bookmark_bar_unittest_helper.h"
16 #import "chrome/browser/cocoa/bookmark_bar_view.h" 16 #import "chrome/browser/cocoa/bookmark_bar_view.h"
17 #import "chrome/browser/cocoa/bookmark_button.h" 17 #import "chrome/browser/cocoa/bookmark_button.h"
18 #import "chrome/browser/cocoa/bookmark_button_cell.h" 18 #import "chrome/browser/cocoa/bookmark_button_cell.h"
19 #import "chrome/browser/cocoa/bookmark_menu.h" 19 #import "chrome/browser/cocoa/bookmark_menu.h"
20 #include "chrome/browser/cocoa/browser_test_helper.h" 20 #include "chrome/browser/cocoa/browser_test_helper.h"
21 #import "chrome/browser/cocoa/cocoa_test_helper.h" 21 #import "chrome/browser/cocoa/cocoa_test_helper.h"
22 #include "chrome/browser/cocoa/test_event_utils.h" 22 #include "chrome/browser/cocoa/test_event_utils.h"
23 #import "chrome/browser/cocoa/view_resizer_pong.h" 23 #import "chrome/browser/cocoa/view_resizer_pong.h"
24 #include "chrome/common/pref_names.h" 24 #include "chrome/common/pref_names.h"
25 #include "chrome/test/model_test_utils.h" 25 #include "chrome/test/model_test_utils.h"
26 #include "testing/gtest/include/gtest/gtest.h" 26 #include "testing/gtest/include/gtest/gtest.h"
27 #import "testing/gtest_mac.h"
27 #include "testing/platform_test.h" 28 #include "testing/platform_test.h"
28 #import "third_party/ocmock/OCMock/OCMock.h" 29 #import "third_party/ocmock/OCMock/OCMock.h"
29 30
30 // Just like a BookmarkBarController but openURL: is stubbed out. 31 // Just like a BookmarkBarController but openURL: is stubbed out.
31 @interface BookmarkBarControllerNoOpen : BookmarkBarController { 32 @interface BookmarkBarControllerNoOpen : BookmarkBarController {
32 @public 33 @public
33 std::vector<GURL> urls_; 34 std::vector<GURL> urls_;
34 std::vector<WindowOpenDisposition> dispositions_; 35 std::vector<WindowOpenDisposition> dispositions_;
35 } 36 }
36 @end 37 @end
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 [bar_ loaded:model]; 926 [bar_ loaded:model];
926 927
927 const BookmarkNode* parent = model->GetBookmarkBarNode(); 928 const BookmarkNode* parent = model->GetBookmarkBarNode();
928 model->AddURL(parent, parent->GetChildCount(), 929 model->AddURL(parent, parent->GetChildCount(),
929 L"supertitle", 930 L"supertitle",
930 GURL("http://superfriends.hall-of-justice.edu")); 931 GURL("http://superfriends.hall-of-justice.edu"));
931 const BookmarkNode* node = parent->GetChild(0); 932 const BookmarkNode* node = parent->GetChild(0);
932 933
933 NSCell* cell = [bar_ cellForBookmarkNode:node]; 934 NSCell* cell = [bar_ cellForBookmarkNode:node];
934 EXPECT_TRUE(cell); 935 EXPECT_TRUE(cell);
935 EXPECT_TRUE([[cell title] isEqual:@"supertitle"]); 936 EXPECT_NSEQ(@"supertitle", [cell title]);
936 EXPECT_EQ(node, [[cell representedObject] pointerValue]); 937 EXPECT_EQ(node, [[cell representedObject] pointerValue]);
937 EXPECT_TRUE([cell menu]); 938 EXPECT_TRUE([cell menu]);
938 939
939 // Empty cells have no menu. 940 // Empty cells have no menu.
940 cell = [bar_ cellForBookmarkNode:nil]; 941 cell = [bar_ cellForBookmarkNode:nil];
941 EXPECT_FALSE([cell menu]); 942 EXPECT_FALSE([cell menu]);
942 // Even empty cells have a title (of "(empty)") 943 // Even empty cells have a title (of "(empty)")
943 EXPECT_TRUE([cell title]); 944 EXPECT_TRUE([cell title]);
944 945
945 // cell is autoreleased; no need to release here 946 // cell is autoreleased; no need to release here
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1105 1106
1106 GURL gurls[] = { GURL("http://www.google.com/a"), 1107 GURL gurls[] = { GURL("http://www.google.com/a"),
1107 GURL("http://www.google.com/b"), 1108 GURL("http://www.google.com/b"),
1108 GURL("http://www.google.com/c") }; 1109 GURL("http://www.google.com/c") };
1109 std::wstring titles[] = { L"a", L"b", L"c" }; 1110 std::wstring titles[] = { L"a", L"b", L"c" };
1110 for (unsigned i = 0; i < arraysize(titles); i++) { 1111 for (unsigned i = 0; i < arraysize(titles); i++) {
1111 model->SetURLStarred(gurls[i], titles[i], true); 1112 model->SetURLStarred(gurls[i], titles[i], true);
1112 } 1113 }
1113 1114
1114 EXPECT_EQ([[bar_ buttons] count], arraysize(titles)); 1115 EXPECT_EQ([[bar_ buttons] count], arraysize(titles));
1115 EXPECT_TRUE([[[[bar_ buttons] objectAtIndex:0] title] isEqual:@"a"]); 1116 EXPECT_NSEQ(@"a", [[[bar_ buttons] objectAtIndex:0] title]);
1116 1117
1117 [bar_ dragButton:[[bar_ buttons] objectAtIndex:2] 1118 [bar_ dragButton:[[bar_ buttons] objectAtIndex:2]
1118 to:NSMakePoint(0, 0) 1119 to:NSMakePoint(0, 0)
1119 copy:NO]; 1120 copy:NO];
1120 EXPECT_TRUE([[[[bar_ buttons] objectAtIndex:0] title] isEqual:@"c"]); 1121 EXPECT_NSEQ(@"c", [[[bar_ buttons] objectAtIndex:0] title]);
1121 // Make sure a 'copy' did not happen. 1122 // Make sure a 'copy' did not happen.
1122 EXPECT_EQ([[bar_ buttons] count], arraysize(titles)); 1123 EXPECT_EQ([[bar_ buttons] count], arraysize(titles));
1123 1124
1124 [bar_ dragButton:[[bar_ buttons] objectAtIndex:1] 1125 [bar_ dragButton:[[bar_ buttons] objectAtIndex:1]
1125 to:NSMakePoint(1000, 0) 1126 to:NSMakePoint(1000, 0)
1126 copy:NO]; 1127 copy:NO];
1127 EXPECT_TRUE([[[[bar_ buttons] objectAtIndex:0] title] isEqual:@"c"]); 1128 EXPECT_NSEQ(@"c", [[[bar_ buttons] objectAtIndex:0] title]);
1128 EXPECT_TRUE([[[[bar_ buttons] objectAtIndex:1] title] isEqual:@"b"]); 1129 EXPECT_NSEQ(@"b", [[[bar_ buttons] objectAtIndex:1] title]);
1129 EXPECT_TRUE([[[[bar_ buttons] objectAtIndex:2] title] isEqual:@"a"]); 1130 EXPECT_NSEQ(@"a", [[[bar_ buttons] objectAtIndex:2] title]);
1130 EXPECT_EQ([[bar_ buttons] count], arraysize(titles)); 1131 EXPECT_EQ([[bar_ buttons] count], arraysize(titles));
1131 1132
1132 // A drop of the 1st between the next 2. 1133 // A drop of the 1st between the next 2.
1133 CGFloat x = NSMinX([[[bar_ buttons] objectAtIndex:2] frame]); 1134 CGFloat x = NSMinX([[[bar_ buttons] objectAtIndex:2] frame]);
1134 x += [[bar_ view] frame].origin.x; 1135 x += [[bar_ view] frame].origin.x;
1135 [bar_ dragButton:[[bar_ buttons] objectAtIndex:0] 1136 [bar_ dragButton:[[bar_ buttons] objectAtIndex:0]
1136 to:NSMakePoint(x, 0) 1137 to:NSMakePoint(x, 0)
1137 copy:NO]; 1138 copy:NO];
1138 EXPECT_TRUE([[[[bar_ buttons] objectAtIndex:0] title] isEqual:@"b"]); 1139 EXPECT_NSEQ(@"b", [[[bar_ buttons] objectAtIndex:0] title]);
1139 EXPECT_TRUE([[[[bar_ buttons] objectAtIndex:1] title] isEqual:@"c"]); 1140 EXPECT_NSEQ(@"c", [[[bar_ buttons] objectAtIndex:1] title]);
1140 EXPECT_TRUE([[[[bar_ buttons] objectAtIndex:2] title] isEqual:@"a"]); 1141 EXPECT_NSEQ(@"a", [[[bar_ buttons] objectAtIndex:2] title]);
1141 EXPECT_EQ([[bar_ buttons] count], arraysize(titles)); 1142 EXPECT_EQ([[bar_ buttons] count], arraysize(titles));
1142 1143
1143 // A drop on a non-folder button. (Shouldn't try and go in it.) 1144 // A drop on a non-folder button. (Shouldn't try and go in it.)
1144 x = NSMidX([[[bar_ buttons] objectAtIndex:0] frame]); 1145 x = NSMidX([[[bar_ buttons] objectAtIndex:0] frame]);
1145 x += [[bar_ view] frame].origin.x; 1146 x += [[bar_ view] frame].origin.x;
1146 [bar_ dragButton:[[bar_ buttons] objectAtIndex:2] 1147 [bar_ dragButton:[[bar_ buttons] objectAtIndex:2]
1147 to:NSMakePoint(x, 0) 1148 to:NSMakePoint(x, 0)
1148 copy:NO]; 1149 copy:NO];
1149 EXPECT_EQ(arraysize(titles), [[bar_ buttons] count]); 1150 EXPECT_EQ(arraysize(titles), [[bar_ buttons] count]);
1150 1151
(...skipping 24 matching lines...) Expand all
1175 BookmarkModel* model = helper_.profile()->GetBookmarkModel(); 1176 BookmarkModel* model = helper_.profile()->GetBookmarkModel();
1176 1177
1177 GURL gurls[] = { GURL("http://www.google.com/a"), 1178 GURL gurls[] = { GURL("http://www.google.com/a"),
1178 GURL("http://www.google.com/b"), 1179 GURL("http://www.google.com/b"),
1179 GURL("http://www.google.com/c") }; 1180 GURL("http://www.google.com/c") };
1180 std::wstring titles[] = { L"a", L"b", L"c" }; 1181 std::wstring titles[] = { L"a", L"b", L"c" };
1181 for (unsigned i = 0; i < arraysize(titles); i++) { 1182 for (unsigned i = 0; i < arraysize(titles); i++) {
1182 model->SetURLStarred(gurls[i], titles[i], true); 1183 model->SetURLStarred(gurls[i], titles[i], true);
1183 } 1184 }
1184 EXPECT_EQ([[bar_ buttons] count], arraysize(titles)); 1185 EXPECT_EQ([[bar_ buttons] count], arraysize(titles));
1185 EXPECT_TRUE([[[[bar_ buttons] objectAtIndex:0] title] isEqual:@"a"]); 1186 EXPECT_NSEQ(@"a", [[[bar_ buttons] objectAtIndex:0] title]);
1186 1187
1187 // Drag 'a' between 'b' and 'c'. 1188 // Drag 'a' between 'b' and 'c'.
1188 CGFloat x = NSMinX([[[bar_ buttons] objectAtIndex:2] frame]); 1189 CGFloat x = NSMinX([[[bar_ buttons] objectAtIndex:2] frame]);
1189 x += [[bar_ view] frame].origin.x; 1190 x += [[bar_ view] frame].origin.x;
1190 [bar_ dragButton:[[bar_ buttons] objectAtIndex:0] 1191 [bar_ dragButton:[[bar_ buttons] objectAtIndex:0]
1191 to:NSMakePoint(x, 0) 1192 to:NSMakePoint(x, 0)
1192 copy:YES]; 1193 copy:YES];
1193 EXPECT_TRUE([[[[bar_ buttons] objectAtIndex:0] title] isEqual:@"a"]); 1194 EXPECT_NSEQ(@"a", [[[bar_ buttons] objectAtIndex:0] title]);
1194 EXPECT_TRUE([[[[bar_ buttons] objectAtIndex:1] title] isEqual:@"b"]); 1195 EXPECT_NSEQ(@"b", [[[bar_ buttons] objectAtIndex:1] title]);
1195 EXPECT_TRUE([[[[bar_ buttons] objectAtIndex:2] title] isEqual:@"a"]); 1196 EXPECT_NSEQ(@"a", [[[bar_ buttons] objectAtIndex:2] title]);
1196 EXPECT_TRUE([[[[bar_ buttons] objectAtIndex:3] title] isEqual:@"c"]); 1197 EXPECT_NSEQ(@"c", [[[bar_ buttons] objectAtIndex:3] title]);
1197 EXPECT_EQ([[bar_ buttons] count], 4U); 1198 EXPECT_EQ([[bar_ buttons] count], 4U);
1198 } 1199 }
1199 1200
1200 // Fake a theme with colored text. Apply it and make sure bookmark 1201 // Fake a theme with colored text. Apply it and make sure bookmark
1201 // buttons have the same colored text. Repeat more than once. 1202 // buttons have the same colored text. Repeat more than once.
1202 TEST_F(BookmarkBarControllerTest, TestThemedButton) { 1203 TEST_F(BookmarkBarControllerTest, TestThemedButton) {
1203 BookmarkModel* model = helper_.profile()->GetBookmarkModel(); 1204 BookmarkModel* model = helper_.profile()->GetBookmarkModel();
1204 model->SetURLStarred(GURL("http://www.foo.com"), L"small", true); 1205 model->SetURLStarred(GURL("http://www.foo.com"), L"small", true);
1205 BookmarkButton* button = [[bar_ buttons] objectAtIndex:0]; 1206 BookmarkButton* button = [[bar_ buttons] objectAtIndex:0];
1206 EXPECT_TRUE(button); 1207 EXPECT_TRUE(button);
1207 1208
1208 NSArray* colors = [NSArray arrayWithObjects:[NSColor redColor], 1209 NSArray* colors = [NSArray arrayWithObjects:[NSColor redColor],
1209 [NSColor blueColor], 1210 [NSColor blueColor],
1210 nil]; 1211 nil];
1211 for (NSColor* color in colors) { 1212 for (NSColor* color in colors) {
1212 FakeTheme theme(color); 1213 FakeTheme theme(color);
1213 [bar_ updateTheme:&theme]; 1214 [bar_ updateTheme:&theme];
1214 NSAttributedString* astr = [button attributedTitle]; 1215 NSAttributedString* astr = [button attributedTitle];
1215 EXPECT_TRUE(astr); 1216 EXPECT_TRUE(astr);
1216 EXPECT_TRUE([[astr string] isEqual:@"small"]); 1217 EXPECT_NSEQ(@"small", [astr string]);
1217 // Pick a char in the middle to test (index 3) 1218 // Pick a char in the middle to test (index 3)
1218 NSDictionary* attributes = [astr attributesAtIndex:3 effectiveRange:NULL]; 1219 NSDictionary* attributes = [astr attributesAtIndex:3 effectiveRange:NULL];
1219 NSColor* newColor = 1220 NSColor* newColor =
1220 [attributes objectForKey:NSForegroundColorAttributeName]; 1221 [attributes objectForKey:NSForegroundColorAttributeName];
1221 EXPECT_TRUE([newColor isEqual:color]); 1222 EXPECT_NSEQ(newColor, color);
1222 } 1223 }
1223 } 1224 }
1224 1225
1225 // Test that delegates and targets of buttons are cleared on dealloc. 1226 // Test that delegates and targets of buttons are cleared on dealloc.
1226 TEST_F(BookmarkBarControllerTest, TestClearOnDealloc) { 1227 TEST_F(BookmarkBarControllerTest, TestClearOnDealloc) {
1227 // Make some bookmark buttons. 1228 // Make some bookmark buttons.
1228 BookmarkModel* model = helper_.profile()->GetBookmarkModel(); 1229 BookmarkModel* model = helper_.profile()->GetBookmarkModel();
1229 GURL gurls[] = { GURL("http://www.foo.com/"), 1230 GURL gurls[] = { GURL("http://www.foo.com/"),
1230 GURL("http://www.bar.com/"), 1231 GURL("http://www.bar.com/"),
1231 GURL("http://www.baz.com/") }; 1232 GURL("http://www.baz.com/") };
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
1592 // Validate initial model. 1593 // Validate initial model.
1593 std::wstring actualModelString = model_test_utils::ModelStringFromNode(root); 1594 std::wstring actualModelString = model_test_utils::ModelStringFromNode(root);
1594 EXPECT_EQ(model_string, actualModelString); 1595 EXPECT_EQ(model_string, actualModelString);
1595 1596
1596 // Remember how many buttons are showing. 1597 // Remember how many buttons are showing.
1597 int oldDisplayedButtons = [bar_ displayedButtonCount]; 1598 int oldDisplayedButtons = [bar_ displayedButtonCount];
1598 NSArray* buttons = [bar_ buttons]; 1599 NSArray* buttons = [bar_ buttons];
1599 1600
1600 // Move a button around a bit. 1601 // Move a button around a bit.
1601 [bar_ moveButtonFromIndex:0 toIndex:2]; 1602 [bar_ moveButtonFromIndex:0 toIndex:2];
1602 EXPECT_TRUE([[[buttons objectAtIndex:0] title] isEqualToString:@"2f"]); 1603 EXPECT_NSEQ(@"2f", [[buttons objectAtIndex:0] title]);
1603 EXPECT_TRUE([[[buttons objectAtIndex:1] title] isEqualToString:@"3b"]); 1604 EXPECT_NSEQ(@"3b", [[buttons objectAtIndex:1] title]);
1604 EXPECT_TRUE([[[buttons objectAtIndex:2] title] isEqualToString:@"1b"]); 1605 EXPECT_NSEQ(@"1b", [[buttons objectAtIndex:2] title]);
1605 EXPECT_EQ(oldDisplayedButtons, [bar_ displayedButtonCount]); 1606 EXPECT_EQ(oldDisplayedButtons, [bar_ displayedButtonCount]);
1606 [bar_ moveButtonFromIndex:2 toIndex:0]; 1607 [bar_ moveButtonFromIndex:2 toIndex:0];
1607 EXPECT_TRUE([[[buttons objectAtIndex:0] title] isEqualToString:@"1b"]); 1608 EXPECT_NSEQ(@"1b", [[buttons objectAtIndex:0] title]);
1608 EXPECT_TRUE([[[buttons objectAtIndex:1] title] isEqualToString:@"2f"]); 1609 EXPECT_NSEQ(@"2f", [[buttons objectAtIndex:1] title]);
1609 EXPECT_TRUE([[[buttons objectAtIndex:2] title] isEqualToString:@"3b"]); 1610 EXPECT_NSEQ(@"3b", [[buttons objectAtIndex:2] title]);
1610 EXPECT_EQ(oldDisplayedButtons, [bar_ displayedButtonCount]); 1611 EXPECT_EQ(oldDisplayedButtons, [bar_ displayedButtonCount]);
1611 1612
1612 // Add a couple of buttons. 1613 // Add a couple of buttons.
1613 const BookmarkNode* parent = root->GetChild(1); // Purloin an existing node. 1614 const BookmarkNode* parent = root->GetChild(1); // Purloin an existing node.
1614 const BookmarkNode* node = parent->GetChild(0); 1615 const BookmarkNode* node = parent->GetChild(0);
1615 [bar_ addButtonForNode:node atIndex:0]; 1616 [bar_ addButtonForNode:node atIndex:0];
1616 EXPECT_TRUE([[[buttons objectAtIndex:0] title] isEqualToString:@"2f1b"]); 1617 EXPECT_NSEQ(@"2f1b", [[buttons objectAtIndex:0] title]);
1617 EXPECT_TRUE([[[buttons objectAtIndex:1] title] isEqualToString:@"1b"]); 1618 EXPECT_NSEQ(@"1b", [[buttons objectAtIndex:1] title]);
1618 EXPECT_TRUE([[[buttons objectAtIndex:2] title] isEqualToString:@"2f"]); 1619 EXPECT_NSEQ(@"2f", [[buttons objectAtIndex:2] title]);
1619 EXPECT_TRUE([[[buttons objectAtIndex:3] title] isEqualToString:@"3b"]); 1620 EXPECT_NSEQ(@"3b", [[buttons objectAtIndex:3] title]);
1620 EXPECT_EQ(oldDisplayedButtons + 1, [bar_ displayedButtonCount]); 1621 EXPECT_EQ(oldDisplayedButtons + 1, [bar_ displayedButtonCount]);
1621 node = parent->GetChild(1); 1622 node = parent->GetChild(1);
1622 [bar_ addButtonForNode:node atIndex:-1]; 1623 [bar_ addButtonForNode:node atIndex:-1];
1623 EXPECT_TRUE([[[buttons objectAtIndex:0] title] isEqualToString:@"2f1b"]); 1624 EXPECT_NSEQ(@"2f1b", [[buttons objectAtIndex:0] title]);
1624 EXPECT_TRUE([[[buttons objectAtIndex:1] title] isEqualToString:@"1b"]); 1625 EXPECT_NSEQ(@"1b", [[buttons objectAtIndex:1] title]);
1625 EXPECT_TRUE([[[buttons objectAtIndex:2] title] isEqualToString:@"2f"]); 1626 EXPECT_NSEQ(@"2f", [[buttons objectAtIndex:2] title]);
1626 EXPECT_TRUE([[[buttons objectAtIndex:3] title] isEqualToString:@"3b"]); 1627 EXPECT_NSEQ(@"3b", [[buttons objectAtIndex:3] title]);
1627 EXPECT_TRUE([[[buttons objectAtIndex:4] title] isEqualToString:@"2f2b"]); 1628 EXPECT_NSEQ(@"2f2b", [[buttons objectAtIndex:4] title]);
1628 EXPECT_EQ(oldDisplayedButtons + 2, [bar_ displayedButtonCount]); 1629 EXPECT_EQ(oldDisplayedButtons + 2, [bar_ displayedButtonCount]);
1629 1630
1630 // Remove a couple of buttons. 1631 // Remove a couple of buttons.
1631 [bar_ removeButton:4 animate:NO]; 1632 [bar_ removeButton:4 animate:NO];
1632 [bar_ removeButton:1 animate:NO]; 1633 [bar_ removeButton:1 animate:NO];
1633 EXPECT_TRUE([[[buttons objectAtIndex:0] title] isEqualToString:@"2f1b"]); 1634 EXPECT_NSEQ(@"2f1b", [[buttons objectAtIndex:0] title]);
1634 EXPECT_TRUE([[[buttons objectAtIndex:1] title] isEqualToString:@"2f"]); 1635 EXPECT_NSEQ(@"2f", [[buttons objectAtIndex:1] title]);
1635 EXPECT_TRUE([[[buttons objectAtIndex:2] title] isEqualToString:@"3b"]); 1636 EXPECT_NSEQ(@"3b", [[buttons objectAtIndex:2] title]);
1636 EXPECT_EQ(oldDisplayedButtons, [bar_ displayedButtonCount]); 1637 EXPECT_EQ(oldDisplayedButtons, [bar_ displayedButtonCount]);
1637 } 1638 }
1638 1639
1639 TEST_F(BookmarkBarControllerTest, ShrinkOrHideView) { 1640 TEST_F(BookmarkBarControllerTest, ShrinkOrHideView) {
1640 NSRect viewFrame = NSMakeRect(0.0, 0.0, 500.0, 50.0); 1641 NSRect viewFrame = NSMakeRect(0.0, 0.0, 500.0, 50.0);
1641 NSView* view = [[[NSView alloc] initWithFrame:viewFrame] autorelease]; 1642 NSView* view = [[[NSView alloc] initWithFrame:viewFrame] autorelease];
1642 EXPECT_FALSE([view isHidden]); 1643 EXPECT_FALSE([view isHidden]);
1643 [bar_ shrinkOrHideView:view forMaxX:500.0]; 1644 [bar_ shrinkOrHideView:view forMaxX:500.0];
1644 EXPECT_EQ(500.0, NSWidth([view frame])); 1645 EXPECT_EQ(500.0, NSWidth([view frame]));
1645 EXPECT_FALSE([view isHidden]); 1646 EXPECT_FALSE([view isHidden]);
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
2055 bookmark_button::kBookmarkPulseFlagKey, 2056 bookmark_button::kBookmarkPulseFlagKey,
2056 nil]; 2057 nil];
2057 [[NSNotificationCenter defaultCenter] 2058 [[NSNotificationCenter defaultCenter]
2058 postNotificationName:bookmark_button::kPulseBookmarkButtonNotification 2059 postNotificationName:bookmark_button::kPulseBookmarkButtonNotification
2059 object:nil 2060 object:nil
2060 userInfo:dict]; 2061 userInfo:dict];
2061 EXPECT_FALSE([button isContinuousPulsing]); 2062 EXPECT_FALSE([button isContinuousPulsing]);
2062 } 2063 }
2063 2064
2064 } // namespace 2065 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698