Chromium Code Reviews| 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 #import "chrome/browser/ui/cocoa/animation_utils.h" | 15 #import "chrome/browser/ui/cocoa/animation_utils.h" |
| 16 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" | 16 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" |
| 17 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" | 17 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" |
| 18 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_window.h" | 18 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.h" |
| 19 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_unittest_helper.h" | 19 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_unittest_helper.h" |
| 20 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_view.h" | 20 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_view.h" |
| 21 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" | 21 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" |
| 22 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.h" | 22 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.h" |
| 23 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu.h" | 23 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu.h" |
| 24 #include "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h" | |
| 24 #include "chrome/browser/ui/cocoa/browser_test_helper.h" | 25 #include "chrome/browser/ui/cocoa/browser_test_helper.h" |
| 25 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 26 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
| 26 #include "chrome/browser/ui/cocoa/test_event_utils.h" | 27 #include "chrome/browser/ui/cocoa/test_event_utils.h" |
| 27 #import "chrome/browser/ui/cocoa/view_resizer_pong.h" | 28 #import "chrome/browser/ui/cocoa/view_resizer_pong.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" |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 320 InstallAndToggleBar(bar_.get()); | 321 InstallAndToggleBar(bar_.get()); |
| 321 | 322 |
| 322 // Create a menu/item to act like a sender | 323 // Create a menu/item to act like a sender |
| 323 menu_.reset([[BookmarkMenu alloc] initWithTitle:@"I_dont_care"]); | 324 menu_.reset([[BookmarkMenu alloc] initWithTitle:@"I_dont_care"]); |
| 324 menu_item_.reset([[NSMenuItem alloc] | 325 menu_item_.reset([[NSMenuItem alloc] |
| 325 initWithTitle:@"still_dont_care" | 326 initWithTitle:@"still_dont_care" |
| 326 action:NULL | 327 action:NULL |
| 327 keyEquivalent:@""]); | 328 keyEquivalent:@""]); |
| 328 cell_.reset([[NSButtonCell alloc] init]); | 329 cell_.reset([[NSButtonCell alloc] init]); |
| 329 [menu_item_ setMenu:menu_.get()]; | 330 [menu_item_ setMenu:menu_.get()]; |
| 330 [menu_ setDelegate:cell_.get()]; | |
| 331 } | 331 } |
| 332 | 332 |
| 333 // Return a menu item that points to the given URL. | 333 // Return a menu item that points to the given URL. |
| 334 NSMenuItem* ItemForBookmarkBarMenu(GURL& gurl) { | 334 NSMenuItem* ItemForBookmarkBarMenu(GURL& gurl) { |
| 335 BookmarkModel* model = helper_.profile()->GetBookmarkModel(); | 335 BookmarkModel* model = helper_.profile()->GetBookmarkModel(); |
| 336 const BookmarkNode* parent = model->bookmark_bar_node(); | 336 const BookmarkNode* parent = model->bookmark_bar_node(); |
| 337 const BookmarkNode* node = model->AddURL(parent, parent->child_count(), | 337 const BookmarkNode* node = model->AddURL(parent, parent->child_count(), |
| 338 ASCIIToUTF16("A title"), gurl); | 338 ASCIIToUTF16("A title"), gurl); |
| 339 [menu_ setRepresentedObject:[NSNumber numberWithLongLong:node->id()]]; | 339 [menu_ setRepresentedObject:[NSNumber numberWithLongLong:node->id()]]; |
| 340 return menu_item_; | 340 return menu_item_; |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 565 EXPECT_TRUE([bar_ offTheSideButtonIsHidden]); | 565 EXPECT_TRUE([bar_ offTheSideButtonIsHidden]); |
| 566 } | 566 } |
| 567 | 567 |
| 568 const BookmarkNode* parent = model->bookmark_bar_node(); | 568 const BookmarkNode* parent = model->bookmark_bar_node(); |
| 569 for (int i = 0; i < 20; i++) { | 569 for (int i = 0; i < 20; i++) { |
| 570 model->AddURL(parent, parent->child_count(), | 570 model->AddURL(parent, parent->child_count(), |
| 571 ASCIIToUTF16("super duper wide title"), | 571 ASCIIToUTF16("super duper wide title"), |
| 572 GURL("http://superfriends.hall-of-justice.edu")); | 572 GURL("http://superfriends.hall-of-justice.edu")); |
| 573 } | 573 } |
| 574 EXPECT_FALSE([bar_ offTheSideButtonIsHidden]); | 574 EXPECT_FALSE([bar_ offTheSideButtonIsHidden]); |
| 575 | |
| 576 // Open the "off the side" and start deleting nodes. Make sure | |
| 577 // deletion of the last node in "off the side" causes the folder to | |
| 578 // close. | |
| 579 EXPECT_FALSE([bar_ offTheSideButtonIsHidden]); | |
| 580 NSButton* offTheSideButton = [bar_ offTheSideButton]; | |
| 581 // Open "off the side" menu. | |
| 582 [bar_ openOffTheSideFolderFromButton:offTheSideButton]; | |
| 583 BookmarkBarFolderController* bbfc = [bar_ folderController]; | |
| 584 EXPECT_TRUE(bbfc); | |
| 585 [bbfc setIgnoreAnimations:YES]; | |
| 586 while (!parent->empty()) { | |
| 587 // We've completed the job so we're done. | |
| 588 if ([bar_ offTheSideButtonIsHidden]) | |
| 589 break; | |
| 590 // Delete the last button. | |
| 591 model->Remove(parent, parent->child_count() - 1); | |
| 592 // If last one make sure the menu is closed and the button is hidden. | |
| 593 // Else make sure menu stays open. | |
| 594 if ([bar_ offTheSideButtonIsHidden]) { | |
| 595 EXPECT_FALSE([bar_ folderController]); | |
| 596 } else { | |
| 597 EXPECT_TRUE([bar_ folderController]); | |
| 598 } | |
| 599 } | |
| 600 } | |
| 601 | |
| 602 // http://crbug.com/46175 is a crash when deleting bookmarks from the | |
| 603 // off-the-side menu while it is open. This test tries to bang hard | |
| 604 // in this area to reproduce the crash. | |
| 605 TEST_F(BookmarkBarControllerTest, DeleteFromOffTheSideWhileItIsOpen) { | |
| 606 BookmarkModel* model = helper_.profile()->GetBookmarkModel(); | |
| 607 [bar_ setIgnoreAnimations:YES]; | |
| 608 [bar_ loaded:model]; | |
| 609 | |
| 610 // Add a lot of bookmarks (per the bug). | |
| 611 const BookmarkNode* parent = model->bookmark_bar_node(); | |
| 612 for (int i = 0; i < 100; i++) { | |
| 613 std::ostringstream title; | |
| 614 title << "super duper wide title " << i; | |
| 615 model->AddURL(parent, parent->child_count(), ASCIIToUTF16(title.str()), | |
| 616 GURL("http://superfriends.hall-of-justice.edu")); | |
| 617 } | |
| 618 EXPECT_FALSE([bar_ offTheSideButtonIsHidden]); | |
| 619 | |
| 620 // Open "off the side" menu. | |
| 621 NSButton* offTheSideButton = [bar_ offTheSideButton]; | |
| 622 [bar_ openOffTheSideFolderFromButton:offTheSideButton]; | |
| 623 BookmarkBarFolderController* bbfc = [bar_ folderController]; | |
| 624 EXPECT_TRUE(bbfc); | |
| 625 [bbfc setIgnoreAnimations:YES]; | |
| 626 | |
| 627 // Start deleting items; try and delete randomish ones in case it | |
| 628 // makes a difference. | |
| 629 int indices[] = { 2, 4, 5, 1, 7, 9, 2, 0, 10, 9 }; | |
| 630 while (!parent->empty()) { | |
| 631 for (unsigned int i = 0; i < arraysize(indices); i++) { | |
| 632 if (indices[i] < parent->child_count()) { | |
| 633 // First we mouse-enter the button to make things harder. | |
| 634 NSArray* buttons = [bbfc buttons]; | |
| 635 for (BookmarkButton* button in buttons) { | |
| 636 if ([button bookmarkNode] == parent->GetChild(indices[i])) { | |
| 637 [bbfc mouseEnteredButton:button event:nil]; | |
| 638 break; | |
| 639 } | |
| 640 } | |
| 641 // Then we remove the node. This triggers the button to get | |
| 642 // deleted. | |
| 643 model->Remove(parent, indices[i]); | |
| 644 // Force visual update which is otherwise delayed. | |
| 645 [[bbfc window] displayIfNeeded]; | |
| 646 } | |
| 647 } | |
| 648 } | |
| 649 } | 575 } |
| 650 | 576 |
| 651 // Test whether |-dragShouldLockBarVisibility| returns NO iff the bar is | 577 // Test whether |-dragShouldLockBarVisibility| returns NO iff the bar is |
| 652 // detached. | 578 // detached. |
| 653 TEST_F(BookmarkBarControllerTest, TestDragShouldLockBarVisibility) { | 579 TEST_F(BookmarkBarControllerTest, TestDragShouldLockBarVisibility) { |
| 654 [bar_ updateAndShowNormalBar:NO | 580 [bar_ updateAndShowNormalBar:NO |
| 655 showDetachedBar:NO | 581 showDetachedBar:NO |
| 656 withAnimation:NO]; | 582 withAnimation:NO]; |
| 657 EXPECT_TRUE([bar_ dragShouldLockBarVisibility]); | 583 EXPECT_TRUE([bar_ dragShouldLockBarVisibility]); |
| 658 | 584 |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1276 bar_.reset(); | 1202 bar_.reset(); |
| 1277 | 1203 |
| 1278 // Make sure that everything is cleared. | 1204 // Make sure that everything is cleared. |
| 1279 for (BookmarkButton* button in buttons.get()) { | 1205 for (BookmarkButton* button in buttons.get()) { |
| 1280 EXPECT_FALSE([button delegate]); | 1206 EXPECT_FALSE([button delegate]); |
| 1281 EXPECT_FALSE([button target]); | 1207 EXPECT_FALSE([button target]); |
| 1282 EXPECT_FALSE([button action]); | 1208 EXPECT_FALSE([button action]); |
| 1283 } | 1209 } |
| 1284 } | 1210 } |
| 1285 | 1211 |
| 1286 TEST_F(BookmarkBarControllerTest, TestFolders) { | |
| 1287 BookmarkModel* model = helper_.profile()->GetBookmarkModel(); | |
| 1288 | |
| 1289 // Create some folder buttons. | |
| 1290 const BookmarkNode* parent = model->bookmark_bar_node(); | |
| 1291 const BookmarkNode* folder = model->AddFolder(parent, | |
| 1292 parent->child_count(), | |
| 1293 ASCIIToUTF16("folder")); | |
| 1294 model->AddURL(folder, folder->child_count(), | |
| 1295 ASCIIToUTF16("f1"), GURL("http://framma-lamma.com")); | |
| 1296 folder = model->AddFolder(parent, parent->child_count(), | |
| 1297 ASCIIToUTF16("empty")); | |
| 1298 | |
| 1299 EXPECT_EQ([[bar_ buttons] count], 2U); | |
| 1300 | |
| 1301 // First confirm mouseEntered does nothing if "menus" aren't active. | |
| 1302 NSEvent* event = test_event_utils::MakeMouseEvent(NSOtherMouseUp, 0); | |
| 1303 [bar_ mouseEnteredButton:[[bar_ buttons] objectAtIndex:0] event:event]; | |
| 1304 EXPECT_FALSE([bar_ folderController]); | |
| 1305 | |
| 1306 // Make one active. Entering it is now a no-op. | |
| 1307 [bar_ openBookmarkFolderFromButton:[[bar_ buttons] objectAtIndex:0]]; | |
| 1308 BookmarkBarFolderController* bbfc = [bar_ folderController]; | |
| 1309 EXPECT_TRUE(bbfc); | |
| 1310 [bar_ mouseEnteredButton:[[bar_ buttons] objectAtIndex:0] event:event]; | |
| 1311 EXPECT_EQ(bbfc, [bar_ folderController]); | |
| 1312 | |
| 1313 // Enter a different one; a new folderController is active. | |
| 1314 [bar_ mouseEnteredButton:[[bar_ buttons] objectAtIndex:1] event:event]; | |
| 1315 EXPECT_NE(bbfc, [bar_ folderController]); | |
| 1316 | |
| 1317 // Confirm exited is a no-op. | |
| 1318 [bar_ mouseExitedButton:[[bar_ buttons] objectAtIndex:1] event:event]; | |
| 1319 EXPECT_NE(bbfc, [bar_ folderController]); | |
| 1320 | |
| 1321 // Clean up. | |
| 1322 [bar_ closeBookmarkFolder:nil]; | |
| 1323 } | |
| 1324 | |
| 1325 // Verify that the folder menu presentation properly tracks mouse movements | |
| 1326 // over the bar. Until there is a click no folder menus should show. After a | |
| 1327 // click on a folder folder menus should show until another click on a folder | |
| 1328 // button, and a click outside the bar and its folder menus. | |
| 1329 TEST_F(BookmarkBarControllerTest, TestFolderButtons) { | |
| 1330 BookmarkModel& model(*helper_.profile()->GetBookmarkModel()); | |
| 1331 const BookmarkNode* root = model.bookmark_bar_node(); | |
| 1332 const std::string model_string("1b 2f:[ 2f1b 2f2b ] 3b 4f:[ 4f1b 4f2b ] "); | |
| 1333 model_test_utils::AddNodesFromModelString(model, root, model_string); | |
| 1334 | |
| 1335 // Validate initial model and that we do not have a folder controller. | |
| 1336 std::string actualModelString = model_test_utils::ModelStringFromNode(root); | |
| 1337 EXPECT_EQ(model_string, actualModelString); | |
| 1338 EXPECT_FALSE([bar_ folderController]); | |
| 1339 | |
| 1340 // Add a real bookmark so we can click on it. | |
| 1341 const BookmarkNode* folder = root->GetChild(3); | |
| 1342 model.AddURL(folder, folder->child_count(), ASCIIToUTF16("CLICK ME"), | |
| 1343 GURL("http://www.google.com/")); | |
| 1344 | |
| 1345 // Click on a folder button. | |
| 1346 BookmarkButton* button = [bar_ buttonWithTitleEqualTo:@"4f"]; | |
| 1347 EXPECT_TRUE(button); | |
| 1348 [bar_ openBookmarkFolderFromButton:button]; | |
| 1349 BookmarkBarFolderController* bbfc = [bar_ folderController]; | |
| 1350 EXPECT_TRUE(bbfc); | |
| 1351 | |
| 1352 // Make sure a 2nd click on the same button closes things. | |
| 1353 [bar_ openBookmarkFolderFromButton:button]; | |
| 1354 EXPECT_FALSE([bar_ folderController]); | |
| 1355 | |
| 1356 // Next open is a different button. | |
| 1357 button = [bar_ buttonWithTitleEqualTo:@"2f"]; | |
| 1358 EXPECT_TRUE(button); | |
| 1359 [bar_ openBookmarkFolderFromButton:button]; | |
| 1360 EXPECT_TRUE([bar_ folderController]); | |
| 1361 | |
| 1362 // Mouse over a non-folder button and confirm controller has gone away. | |
| 1363 button = [bar_ buttonWithTitleEqualTo:@"1b"]; | |
| 1364 EXPECT_TRUE(button); | |
| 1365 NSEvent* event = test_event_utils::MouseEventAtPoint([button center], | |
| 1366 NSMouseMoved, 0); | |
| 1367 [bar_ mouseEnteredButton:button event:event]; | |
| 1368 EXPECT_FALSE([bar_ folderController]); | |
| 1369 | |
| 1370 // Mouse over the original folder and confirm a new controller. | |
| 1371 button = [bar_ buttonWithTitleEqualTo:@"2f"]; | |
| 1372 EXPECT_TRUE(button); | |
| 1373 [bar_ mouseEnteredButton:button event:event]; | |
| 1374 BookmarkBarFolderController* oldBBFC = [bar_ folderController]; | |
| 1375 EXPECT_TRUE(oldBBFC); | |
| 1376 | |
| 1377 // 'Jump' over to a different folder and confirm a new controller. | |
| 1378 button = [bar_ buttonWithTitleEqualTo:@"4f"]; | |
| 1379 EXPECT_TRUE(button); | |
| 1380 [bar_ mouseEnteredButton:button event:event]; | |
| 1381 BookmarkBarFolderController* newBBFC = [bar_ folderController]; | |
| 1382 EXPECT_TRUE(newBBFC); | |
| 1383 EXPECT_NE(oldBBFC, newBBFC); | |
| 1384 } | |
| 1385 | |
| 1386 // Make sure the "off the side" folder looks like a bookmark folder | 1212 // Make sure the "off the side" folder looks like a bookmark folder |
| 1387 // but only contains "off the side" items. | 1213 // but only contains "off the side" items. |
| 1388 TEST_F(BookmarkBarControllerTest, OffTheSideFolder) { | 1214 // TODO(rsesek): Fix the off the side folder. |
| 1215 TEST_F(BookmarkBarControllerTest, DISABLED_OffTheSideFolder) { | |
| 1389 | 1216 |
| 1390 // It starts hidden. | 1217 // It starts hidden. |
| 1391 EXPECT_TRUE([bar_ offTheSideButtonIsHidden]); | 1218 EXPECT_TRUE([bar_ offTheSideButtonIsHidden]); |
| 1392 | 1219 |
| 1393 // Create some buttons. | 1220 // Create some buttons. |
| 1394 BookmarkModel* model = helper_.profile()->GetBookmarkModel(); | 1221 BookmarkModel* model = helper_.profile()->GetBookmarkModel(); |
| 1395 const BookmarkNode* parent = model->bookmark_bar_node(); | 1222 const BookmarkNode* parent = model->bookmark_bar_node(); |
| 1396 for (int x = 0; x < 30; x++) { | 1223 for (int x = 0; x < 30; x++) { |
| 1397 model->AddURL(parent, parent->child_count(), | 1224 model->AddURL(parent, parent->child_count(), |
| 1398 ASCIIToUTF16("medium-size-title"), | 1225 ASCIIToUTF16("medium-size-title"), |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 1411 // Open it; make sure we have a folder controller. | 1238 // Open it; make sure we have a folder controller. |
| 1412 EXPECT_FALSE([bar_ folderController]); | 1239 EXPECT_FALSE([bar_ folderController]); |
| 1413 [bar_ openOffTheSideFolderFromButton:[bar_ offTheSideButton]]; | 1240 [bar_ openOffTheSideFolderFromButton:[bar_ offTheSideButton]]; |
| 1414 BookmarkBarFolderController* bbfc = [bar_ folderController]; | 1241 BookmarkBarFolderController* bbfc = [bar_ folderController]; |
| 1415 EXPECT_TRUE(bbfc); | 1242 EXPECT_TRUE(bbfc); |
| 1416 | 1243 |
| 1417 // Confirm the contents are only buttons which fell off the side by | 1244 // Confirm the contents are only buttons which fell off the side by |
| 1418 // making sure that none of the nodes in the off-the-side folder are | 1245 // making sure that none of the nodes in the off-the-side folder are |
| 1419 // found in bar buttons. Be careful since not all the bar buttons | 1246 // found in bar buttons. Be careful since not all the bar buttons |
| 1420 // may be currently displayed. | 1247 // may be currently displayed. |
| 1421 NSArray* folderButtons = [bbfc buttons]; | 1248 NSArray* folderItems = [[[bbfc menuBridge]->controller() menu] itemArray]; |
| 1422 NSArray* barButtons = [bar_ buttons]; | 1249 NSArray* barButtons = [bar_ buttons]; |
| 1423 for (BookmarkButton* folderButton in folderButtons) { | 1250 for (NSMenuItem* folderItem in folderItems) { |
| 1424 for (BookmarkButton* barButton in barButtons) { | 1251 for (BookmarkButton* barButton in barButtons) { |
| 1425 if ([barButton superview]) { | 1252 if ([barButton superview]) { |
| 1426 EXPECT_NE([folderButton bookmarkNode], [barButton bookmarkNode]); | 1253 EXPECT_NE([folderItem tag], [barButton bookmarkNode]->id()); |
| 1427 } | 1254 } |
| 1428 } | 1255 } |
| 1429 } | 1256 } |
| 1430 | |
| 1431 // Delete a bookmark in the off-the-side and verify it's gone. | |
| 1432 BookmarkButton* button = [bbfc buttonWithTitleEqualTo:@"DELETE_ME"]; | |
| 1433 EXPECT_TRUE(button); | |
| 1434 model->Remove(parent, parent->child_count() - 2); | |
| 1435 button = [bbfc buttonWithTitleEqualTo:@"DELETE_ME"]; | |
| 1436 EXPECT_FALSE(button); | |
| 1437 } | |
| 1438 | |
| 1439 TEST_F(BookmarkBarControllerTest, EventToExitCheck) { | |
| 1440 NSEvent* event = test_event_utils::MakeMouseEvent(NSMouseMoved, 0); | |
| 1441 EXPECT_FALSE([bar_ isEventAnExitEvent:event]); | |
| 1442 | |
| 1443 BookmarkBarFolderWindow* folderWindow = [[[BookmarkBarFolderWindow alloc] | |
| 1444 init] autorelease]; | |
| 1445 [[[bar_ view] window] addChildWindow:folderWindow | |
| 1446 ordered:NSWindowAbove]; | |
| 1447 event = test_event_utils::LeftMouseDownAtPointInWindow(NSMakePoint(1,1), | |
| 1448 folderWindow); | |
| 1449 EXPECT_FALSE([bar_ isEventAnExitEvent:event]); | |
| 1450 | |
| 1451 event = test_event_utils::LeftMouseDownAtPointInWindow(NSMakePoint(100,100), | |
| 1452 test_window()); | |
| 1453 EXPECT_TRUE([bar_ isEventAnExitEvent:event]); | |
| 1454 | |
| 1455 // Many components are arbitrary (e.g. location, keycode). | |
| 1456 event = [NSEvent keyEventWithType:NSKeyDown | |
| 1457 location:NSMakePoint(1,1) | |
| 1458 modifierFlags:0 | |
| 1459 timestamp:0 | |
| 1460 windowNumber:0 | |
| 1461 context:nil | |
| 1462 characters:@"x" | |
| 1463 charactersIgnoringModifiers:@"x" | |
| 1464 isARepeat:NO | |
| 1465 keyCode:87]; | |
| 1466 EXPECT_FALSE([bar_ isEventAnExitEvent:event]); | |
| 1467 | |
| 1468 [[[bar_ view] window] removeChildWindow:folderWindow]; | |
| 1469 } | 1257 } |
| 1470 | 1258 |
| 1471 TEST_F(BookmarkBarControllerTest, DropDestination) { | 1259 TEST_F(BookmarkBarControllerTest, DropDestination) { |
| 1472 // Make some buttons. | 1260 // Make some buttons. |
| 1473 BookmarkModel* model = helper_.profile()->GetBookmarkModel(); | 1261 BookmarkModel* model = helper_.profile()->GetBookmarkModel(); |
| 1474 const BookmarkNode* parent = model->bookmark_bar_node(); | 1262 const BookmarkNode* parent = model->bookmark_bar_node(); |
| 1475 model->AddFolder(parent, parent->child_count(), ASCIIToUTF16("folder 1")); | 1263 model->AddFolder(parent, parent->child_count(), ASCIIToUTF16("folder 1")); |
| 1476 model->AddFolder(parent, parent->child_count(), ASCIIToUTF16("folder 2")); | 1264 model->AddFolder(parent, parent->child_count(), ASCIIToUTF16("folder 2")); |
| 1477 EXPECT_EQ([[bar_ buttons] count], 2U); | 1265 EXPECT_EQ([[bar_ buttons] count], 2U); |
| 1478 | 1266 |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 1500 // On the very edges: NOT a match | 1288 // On the very edges: NOT a match |
| 1501 x = NSMinX([button frame]) + viewFrameXOffset; | 1289 x = NSMinX([button frame]) + viewFrameXOffset; |
| 1502 EXPECT_NE(button, | 1290 EXPECT_NE(button, |
| 1503 [bar_ buttonForDroppingOnAtPoint:NSMakePoint(x, 9)]); | 1291 [bar_ buttonForDroppingOnAtPoint:NSMakePoint(x, 9)]); |
| 1504 x = NSMaxX([button frame]) + viewFrameXOffset; | 1292 x = NSMaxX([button frame]) + viewFrameXOffset; |
| 1505 EXPECT_NE(button, | 1293 EXPECT_NE(button, |
| 1506 [bar_ buttonForDroppingOnAtPoint:NSMakePoint(x, 11)]); | 1294 [bar_ buttonForDroppingOnAtPoint:NSMakePoint(x, 11)]); |
| 1507 } | 1295 } |
| 1508 } | 1296 } |
| 1509 | 1297 |
| 1510 TEST_F(BookmarkBarControllerTest, NodeDeletedWhileMenuIsOpen) { | |
| 1511 BookmarkModel* model = helper_.profile()->GetBookmarkModel(); | |
| 1512 [bar_ loaded:model]; | |
| 1513 | |
| 1514 const BookmarkNode* parent = model->bookmark_bar_node(); | |
| 1515 const BookmarkNode* initialNode = model->AddURL( | |
| 1516 parent, parent->child_count(), | |
| 1517 ASCIIToUTF16("initial"), | |
| 1518 GURL("http://www.google.com")); | |
| 1519 | |
| 1520 NSMenuItem* item = ItemForBookmarkBarMenu(initialNode); | |
| 1521 EXPECT_EQ(0U, noOpenBar()->urls_.size()); | |
| 1522 | |
| 1523 // Basic check of the menu item and an IBOutlet it can call. | |
| 1524 EXPECT_EQ(initialNode, [bar_ nodeFromMenuItem:item]); | |
| 1525 [bar_ openBookmarkInNewWindow:item]; | |
| 1526 EXPECT_EQ(1U, noOpenBar()->urls_.size()); | |
| 1527 [bar_ clear]; | |
| 1528 | |
| 1529 // Now delete the node and make sure things are happy (no crash, | |
| 1530 // NULL node caught). | |
| 1531 model->Remove(parent, parent->GetIndexOf(initialNode)); | |
| 1532 EXPECT_EQ(nil, [bar_ nodeFromMenuItem:item]); | |
| 1533 // Should not crash by referencing a deleted node. | |
| 1534 [bar_ openBookmarkInNewWindow:item]; | |
| 1535 // Confirm the above did nothing in case it somehow didn't crash. | |
| 1536 EXPECT_EQ(0U, noOpenBar()->urls_.size()); | |
| 1537 | |
| 1538 // Confirm some more non-crashes. | |
| 1539 [bar_ openBookmarkInNewForegroundTab:item]; | |
| 1540 [bar_ openBookmarkInIncognitoWindow:item]; | |
| 1541 [bar_ editBookmark:item]; | |
| 1542 [bar_ copyBookmark:item]; | |
| 1543 [bar_ deleteBookmark:item]; | |
| 1544 [bar_ openAllBookmarks:item]; | |
| 1545 [bar_ openAllBookmarksNewWindow:item]; | |
| 1546 [bar_ openAllBookmarksIncognitoWindow:item]; | |
| 1547 } | |
| 1548 | |
| 1549 TEST_F(BookmarkBarControllerTest, NodeDeletedWhileContextMenuIsOpen) { | 1298 TEST_F(BookmarkBarControllerTest, NodeDeletedWhileContextMenuIsOpen) { |
| 1550 BookmarkModel* model = helper_.profile()->GetBookmarkModel(); | 1299 BookmarkModel* model = helper_.profile()->GetBookmarkModel(); |
| 1551 [bar_ loaded:model]; | 1300 [bar_ loaded:model]; |
| 1552 | 1301 |
| 1553 const BookmarkNode* parent = model->bookmark_bar_node(); | 1302 const BookmarkNode* parent = model->bookmark_bar_node(); |
| 1554 const BookmarkNode* folder = model->AddFolder(parent, | 1303 const BookmarkNode* folder = model->AddFolder(parent, |
| 1555 parent->child_count(), | 1304 parent->child_count(), |
| 1556 ASCIIToUTF16("folder")); | 1305 ASCIIToUTF16("folder")); |
| 1557 const BookmarkNode* framma = model->AddURL(folder, folder->child_count(), | 1306 const BookmarkNode* framma = model->AddURL(folder, folder->child_count(), |
| 1558 ASCIIToUTF16("f1"), | 1307 ASCIIToUTF16("f1"), |
| 1559 GURL("http://framma-lamma.com")); | 1308 GURL("http://framma-lamma.com")); |
| 1560 | 1309 |
| 1561 // Mock in a menu | 1310 // Mock in a menu |
| 1562 id origMenu = [bar_ buttonContextMenu]; | 1311 id origMenu = [bar_ buttonContextMenu]; |
| 1563 id fakeMenu = [OCMockObject partialMockForObject:origMenu]; | 1312 id fakeMenu = [OCMockObject partialMockForObject:origMenu]; |
| 1564 [[fakeMenu expect] cancelTracking]; | 1313 [[fakeMenu expect] cancelTracking]; |
| 1565 [bar_ setButtonContextMenu:fakeMenu]; | 1314 [bar_ setButtonContextMenu:fakeMenu]; |
| 1566 | 1315 |
| 1567 // Force a delete which should cancelTracking on the menu. | 1316 // Force a delete which should cancelTracking on the menu. |
| 1568 model->Remove(framma->parent(), framma->parent()->GetIndexOf(framma)); | 1317 model->Remove(framma->parent(), framma->parent()->GetIndexOf(framma)); |
| 1569 | 1318 |
| 1570 // Restore, then confirm cancelTracking was called. | 1319 // Restore, then confirm cancelTracking was called. |
| 1571 [bar_ setButtonContextMenu:origMenu]; | 1320 [bar_ setButtonContextMenu:origMenu]; |
| 1572 EXPECT_OCMOCK_VERIFY(fakeMenu); | 1321 EXPECT_OCMOCK_VERIFY(fakeMenu); |
| 1573 } | 1322 } |
| 1574 | 1323 |
| 1575 TEST_F(BookmarkBarControllerTest, CloseFolderOnAnimate) { | |
| 1576 BookmarkModel* model = helper_.profile()->GetBookmarkModel(); | |
| 1577 const BookmarkNode* parent = model->bookmark_bar_node(); | |
| 1578 const BookmarkNode* folder = model->AddFolder(parent, | |
| 1579 parent->child_count(), | |
| 1580 ASCIIToUTF16("folder")); | |
| 1581 model->AddFolder(parent, parent->child_count(), | |
| 1582 ASCIIToUTF16("sibbling folder")); | |
| 1583 model->AddURL(folder, folder->child_count(), ASCIIToUTF16("title a"), | |
| 1584 GURL("http://www.google.com/a")); | |
| 1585 model->AddURL(folder, folder->child_count(), | |
| 1586 ASCIIToUTF16("title super duper long long whoa momma title you betcha"), | |
| 1587 GURL("http://www.google.com/b")); | |
| 1588 BookmarkButton* button = [[bar_ buttons] objectAtIndex:0]; | |
| 1589 EXPECT_FALSE([bar_ folderController]); | |
| 1590 [bar_ openBookmarkFolderFromButton:button]; | |
| 1591 BookmarkBarFolderController* bbfc = [bar_ folderController]; | |
| 1592 // The following tells us that the folder menu is showing. We want to make | |
| 1593 // sure the folder menu goes away if the bookmark bar is hidden. | |
| 1594 EXPECT_TRUE(bbfc); | |
| 1595 EXPECT_TRUE([bar_ isVisible]); | |
| 1596 | |
| 1597 // Hide the bookmark bar. | |
| 1598 [bar_ updateAndShowNormalBar:NO | |
| 1599 showDetachedBar:YES | |
| 1600 withAnimation:YES]; | |
| 1601 EXPECT_TRUE([bar_ isAnimationRunning]); | |
| 1602 | |
| 1603 // Now that we've closed the bookmark bar (with animation) the folder menu | |
| 1604 // should have been closed thus releasing the folderController. | |
| 1605 EXPECT_FALSE([bar_ folderController]); | |
| 1606 } | |
| 1607 | |
| 1608 TEST_F(BookmarkBarControllerTest, MoveRemoveAddButtons) { | 1324 TEST_F(BookmarkBarControllerTest, MoveRemoveAddButtons) { |
| 1609 BookmarkModel& model(*helper_.profile()->GetBookmarkModel()); | 1325 BookmarkModel& model(*helper_.profile()->GetBookmarkModel()); |
| 1610 const BookmarkNode* root = model.bookmark_bar_node(); | 1326 const BookmarkNode* root = model.bookmark_bar_node(); |
| 1611 const std::string model_string("1b 2f:[ 2f1b 2f2b ] 3b "); | 1327 const std::string model_string("1b 2f:[ 2f1b 2f2b ] 3b "); |
| 1612 model_test_utils::AddNodesFromModelString(model, root, model_string); | 1328 model_test_utils::AddNodesFromModelString(model, root, model_string); |
| 1613 | 1329 |
| 1614 // Validate initial model. | 1330 // Validate initial model. |
| 1615 std::string actualModelString = model_test_utils::ModelStringFromNode(root); | 1331 std::string actualModelString = model_test_utils::ModelStringFromNode(root); |
| 1616 EXPECT_EQ(model_string, actualModelString); | 1332 EXPECT_EQ(model_string, actualModelString); |
| 1617 | 1333 |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1850 bar_.reset( | 1566 bar_.reset( |
| 1851 [[BookmarkBarControllerDragData alloc] | 1567 [[BookmarkBarControllerDragData alloc] |
| 1852 initWithBrowser:helper_.browser() | 1568 initWithBrowser:helper_.browser() |
| 1853 initialWidth:NSWidth([parent_view_ frame]) | 1569 initialWidth:NSWidth([parent_view_ frame]) |
| 1854 delegate:nil | 1570 delegate:nil |
| 1855 resizeDelegate:resizeDelegate_.get()]); | 1571 resizeDelegate:resizeDelegate_.get()]); |
| 1856 InstallAndToggleBar(bar_.get()); | 1572 InstallAndToggleBar(bar_.get()); |
| 1857 } | 1573 } |
| 1858 }; | 1574 }; |
| 1859 | 1575 |
| 1860 TEST_F(BookmarkBarControllerDragDropTest, DragMoveBarBookmarkToOffTheSide) { | 1576 TEST_F(BookmarkBarControllerDragDropTest, |
|
mrossetti
2011/08/04 02:16:27
Nit: Add comment on the anticipated disposition of
Robert Sesek
2011/08/04 15:37:02
Done.
| |
| 1577 DISABLED_DragMoveBarBookmarkToOffTheSide) { | |
| 1861 BookmarkModel& model(*helper_.profile()->GetBookmarkModel()); | 1578 BookmarkModel& model(*helper_.profile()->GetBookmarkModel()); |
| 1862 const BookmarkNode* root = model.bookmark_bar_node(); | 1579 const BookmarkNode* root = model.bookmark_bar_node(); |
| 1863 const std::string model_string("1bWithLongName 2fWithLongName:[ " | 1580 const std::string model_string("1bWithLongName 2fWithLongName:[ " |
| 1864 "2f1bWithLongName 2f2fWithLongName:[ 2f2f1bWithLongName " | 1581 "2f1bWithLongName 2f2fWithLongName:[ 2f2f1bWithLongName " |
| 1865 "2f2f2bWithLongName 2f2f3bWithLongName 2f4b ] 2f3bWithLongName ] " | 1582 "2f2f2bWithLongName 2f2f3bWithLongName 2f4b ] 2f3bWithLongName ] " |
| 1866 "3bWithLongName 4bWithLongName 5bWithLongName 6bWithLongName " | 1583 "3bWithLongName 4bWithLongName 5bWithLongName 6bWithLongName " |
| 1867 "7bWithLongName 8bWithLongName 9bWithLongName 10bWithLongName " | 1584 "7bWithLongName 8bWithLongName 9bWithLongName 10bWithLongName " |
| 1868 "11bWithLongName 12bWithLongName 13b "); | 1585 "11bWithLongName 12bWithLongName 13b "); |
| 1869 model_test_utils::AddNodesFromModelString(model, root, model_string); | 1586 model_test_utils::AddNodesFromModelString(model, root, model_string); |
| 1870 | 1587 |
| 1871 // Validate initial model. | 1588 // Validate initial model. |
| 1872 std::string actualModelString = model_test_utils::ModelStringFromNode(root); | 1589 std::string actualModelString = model_test_utils::ModelStringFromNode(root); |
| 1873 EXPECT_EQ(model_string, actualModelString); | 1590 EXPECT_EQ(model_string, actualModelString); |
| 1874 | 1591 |
| 1875 // Insure that the off-the-side is not showing. | 1592 // Insure that the off-the-side is not showing. |
| 1876 ASSERT_FALSE([bar_ offTheSideButtonIsHidden]); | 1593 ASSERT_FALSE([bar_ offTheSideButtonIsHidden]); |
| 1877 | 1594 |
| 1878 // Remember how many buttons are showing and are available. | 1595 // Remember how many buttons are showing and are available. |
| 1879 int oldDisplayedButtons = [bar_ displayedButtonCount]; | 1596 int oldDisplayedButtons = [bar_ displayedButtonCount]; |
| 1880 int oldChildCount = root->child_count(); | 1597 int oldChildCount = root->child_count(); |
| 1881 | 1598 |
| 1882 // Pop up the off-the-side menu. | 1599 // Pop up the off-the-side menu. |
| 1883 BookmarkButton* otsButton = (BookmarkButton*)[bar_ offTheSideButton]; | 1600 BookmarkButton* otsButton = (BookmarkButton*)[bar_ offTheSideButton]; |
| 1884 ASSERT_TRUE(otsButton); | 1601 ASSERT_TRUE(otsButton); |
| 1885 [[otsButton target] performSelector:@selector(openOffTheSideFolderFromButton:) | 1602 |
| 1886 withObject:otsButton]; | |
| 1887 BookmarkBarFolderController* otsController = [bar_ folderController]; | 1603 BookmarkBarFolderController* otsController = [bar_ folderController]; |
| 1888 EXPECT_TRUE(otsController); | 1604 EXPECT_TRUE(otsController); |
| 1889 NSWindow* toWindow = [otsController window]; | 1605 |
| 1890 EXPECT_TRUE(toWindow); | |
| 1891 BookmarkButton* draggedButton = | 1606 BookmarkButton* draggedButton = |
| 1892 [bar_ buttonWithTitleEqualTo:@"3bWithLongName"]; | 1607 [bar_ buttonWithTitleEqualTo:@"3bWithLongName"]; |
| 1893 ASSERT_TRUE(draggedButton); | 1608 ASSERT_TRUE(draggedButton); |
| 1894 int oldOTSCount = (int)[[otsController buttons] count]; | 1609 |
| 1610 int oldOTSCount = GetNumberOfMenuItems(otsController); | |
| 1895 EXPECT_EQ(oldOTSCount, oldChildCount - oldDisplayedButtons); | 1611 EXPECT_EQ(oldOTSCount, oldChildCount - oldDisplayedButtons); |
| 1896 BookmarkButton* targetButton = [[otsController buttons] objectAtIndex:0]; | 1612 |
| 1897 ASSERT_TRUE(targetButton); | 1613 NSRect frame = [otsButton frame]; |
| 1898 [otsController dragButton:draggedButton | 1614 [bar_ dragButton:draggedButton |
| 1899 to:[targetButton center] | 1615 to:NSMakePoint(NSMidX(frame), NSMidY(frame)) |
| 1900 copy:YES]; | 1616 copy:YES]; |
| 1617 | |
| 1901 // There should still be the same number of buttons in the bar | 1618 // There should still be the same number of buttons in the bar |
| 1902 // and off-the-side should have one more. | 1619 // and off-the-side should have one more. |
| 1903 int newDisplayedButtons = [bar_ displayedButtonCount]; | 1620 int newDisplayedButtons = [bar_ displayedButtonCount]; |
| 1904 int newChildCount = root->child_count(); | 1621 int newChildCount = root->child_count(); |
| 1905 int newOTSCount = (int)[[otsController buttons] count]; | 1622 int newOTSCount = GetNumberOfMenuItems(otsController); |
| 1906 EXPECT_EQ(oldDisplayedButtons, newDisplayedButtons); | 1623 EXPECT_EQ(oldDisplayedButtons, newDisplayedButtons); |
| 1907 EXPECT_EQ(oldChildCount + 1, newChildCount); | 1624 EXPECT_EQ(oldChildCount + 1, newChildCount); |
| 1908 EXPECT_EQ(oldOTSCount + 1, newOTSCount); | 1625 EXPECT_EQ(oldOTSCount + 1, newOTSCount); |
| 1909 EXPECT_EQ(newOTSCount, newChildCount - newDisplayedButtons); | 1626 EXPECT_EQ(newOTSCount, newChildCount - newDisplayedButtons); |
| 1910 } | 1627 } |
| 1911 | 1628 |
| 1912 TEST_F(BookmarkBarControllerDragDropTest, DragOffTheSideToOther) { | |
| 1913 BookmarkModel& model(*helper_.profile()->GetBookmarkModel()); | |
| 1914 const BookmarkNode* root = model.bookmark_bar_node(); | |
| 1915 const std::string model_string("1bWithLongName 2bWithLongName " | |
| 1916 "3bWithLongName 4bWithLongName 5bWithLongName 6bWithLongName " | |
| 1917 "7bWithLongName 8bWithLongName 9bWithLongName 10bWithLongName " | |
| 1918 "11bWithLongName 12bWithLongName 13bWithLongName 14bWithLongName " | |
| 1919 "15bWithLongName 16bWithLongName 17bWithLongName 18bWithLongName " | |
| 1920 "19bWithLongName 20bWithLongName "); | |
| 1921 model_test_utils::AddNodesFromModelString(model, root, model_string); | |
| 1922 | |
| 1923 const BookmarkNode* other = model.other_node(); | |
| 1924 const std::string other_string("1other 2other 3other "); | |
| 1925 model_test_utils::AddNodesFromModelString(model, other, other_string); | |
| 1926 | |
| 1927 // Validate initial model. | |
| 1928 std::string actualModelString = model_test_utils::ModelStringFromNode(root); | |
| 1929 EXPECT_EQ(model_string, actualModelString); | |
| 1930 std::string actualOtherString = model_test_utils::ModelStringFromNode(other); | |
| 1931 EXPECT_EQ(other_string, actualOtherString); | |
| 1932 | |
| 1933 // Insure that the off-the-side is showing. | |
| 1934 ASSERT_FALSE([bar_ offTheSideButtonIsHidden]); | |
| 1935 | |
| 1936 // Remember how many buttons are showing and are available. | |
| 1937 int oldDisplayedButtons = [bar_ displayedButtonCount]; | |
| 1938 int oldRootCount = root->child_count(); | |
| 1939 int oldOtherCount = other->child_count(); | |
| 1940 | |
| 1941 // Pop up the off-the-side menu. | |
| 1942 BookmarkButton* otsButton = (BookmarkButton*)[bar_ offTheSideButton]; | |
| 1943 ASSERT_TRUE(otsButton); | |
| 1944 [[otsButton target] performSelector:@selector(openOffTheSideFolderFromButton:) | |
| 1945 withObject:otsButton]; | |
| 1946 BookmarkBarFolderController* otsController = [bar_ folderController]; | |
| 1947 EXPECT_TRUE(otsController); | |
| 1948 int oldOTSCount = (int)[[otsController buttons] count]; | |
| 1949 EXPECT_EQ(oldOTSCount, oldRootCount - oldDisplayedButtons); | |
| 1950 | |
| 1951 // Pick an off-the-side button and drag it to the other bookmarks. | |
| 1952 BookmarkButton* draggedButton = | |
| 1953 [otsController buttonWithTitleEqualTo:@"20bWithLongName"]; | |
| 1954 ASSERT_TRUE(draggedButton); | |
| 1955 BookmarkButton* targetButton = [bar_ otherBookmarksButton]; | |
| 1956 ASSERT_TRUE(targetButton); | |
| 1957 [bar_ dragButton:draggedButton to:[targetButton center] copy:NO]; | |
| 1958 | |
| 1959 // There should one less button in the bar, one less in off-the-side, | |
| 1960 // and one more in other bookmarks. | |
| 1961 int newRootCount = root->child_count(); | |
| 1962 int newOTSCount = (int)[[otsController buttons] count]; | |
| 1963 int newOtherCount = other->child_count(); | |
| 1964 EXPECT_EQ(oldRootCount - 1, newRootCount); | |
| 1965 EXPECT_EQ(oldOTSCount - 1, newOTSCount); | |
| 1966 EXPECT_EQ(oldOtherCount + 1, newOtherCount); | |
| 1967 } | |
| 1968 | |
| 1969 TEST_F(BookmarkBarControllerDragDropTest, DragBookmarkData) { | 1629 TEST_F(BookmarkBarControllerDragDropTest, DragBookmarkData) { |
| 1970 BookmarkModel& model(*helper_.profile()->GetBookmarkModel()); | 1630 BookmarkModel& model(*helper_.profile()->GetBookmarkModel()); |
| 1971 const BookmarkNode* root = model.bookmark_bar_node(); | 1631 const BookmarkNode* root = model.bookmark_bar_node(); |
| 1972 const std::string model_string("1b 2f:[ 2f1b 2f2f:[ 2f2f1b 2f2f2b 2f2f3b ] " | 1632 const std::string model_string("1b 2f:[ 2f1b 2f2f:[ 2f2f1b 2f2f2b 2f2f3b ] " |
| 1973 "2f3b ] 3b 4b "); | 1633 "2f3b ] 3b 4b "); |
| 1974 model_test_utils::AddNodesFromModelString(model, root, model_string); | 1634 model_test_utils::AddNodesFromModelString(model, root, model_string); |
| 1975 const BookmarkNode* other = model.other_node(); | 1635 const BookmarkNode* other = model.other_node(); |
| 1976 const std::string other_string("O1b O2b O3f:[ O3f1b O3f2f ] " | 1636 const std::string other_string("O1b O2b O3f:[ O3f1b O3f2f ] " |
| 1977 "O4f:[ O4f1b O4f2f ] 05b "); | 1637 "O4f:[ O4f1b O4f2f ] 05b "); |
| 1978 model_test_utils::AddNodesFromModelString(model, other, other_string); | 1638 model_test_utils::AddNodesFromModelString(model, other, other_string); |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2168 "2f3b ] 4b "); | 1828 "2f3b ] 4b "); |
| 2169 actual = model_test_utils::ModelStringFromNode(root); | 1829 actual = model_test_utils::ModelStringFromNode(root); |
| 2170 EXPECT_EQ(expected, actual); | 1830 EXPECT_EQ(expected, actual); |
| 2171 | 1831 |
| 2172 // Verify that the other bookmark folder can't be deleted. | 1832 // Verify that the other bookmark folder can't be deleted. |
| 2173 BookmarkButton *otherButton = [bar_ otherBookmarksButton]; | 1833 BookmarkButton *otherButton = [bar_ otherBookmarksButton]; |
| 2174 EXPECT_FALSE([bar_ canDragBookmarkButtonToTrash:otherButton]); | 1834 EXPECT_FALSE([bar_ canDragBookmarkButtonToTrash:otherButton]); |
| 2175 } | 1835 } |
| 2176 | 1836 |
| 2177 } // namespace | 1837 } // namespace |
| OLD | NEW |