| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/string16.h" | 7 #include "base/string16.h" |
| 8 #include "base/sys_string_conversions.h" | 8 #include "base/sys_string_conversions.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_model.h" | 10 #include "chrome/browser/bookmarks/bookmark_model.h" |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 | 281 |
| 282 // After changing a node, pointers to the node may be invalid. This | 282 // After changing a node, pointers to the node may be invalid. This |
| 283 // is because the node itself may not be updated; it may removed and | 283 // is because the node itself may not be updated; it may removed and |
| 284 // a new one is added in that location. (Implementation detail of | 284 // a new one is added in that location. (Implementation detail of |
| 285 // BookmarkEditorController). This method updates the class's | 285 // BookmarkEditorController). This method updates the class's |
| 286 // bookmark_bb_3_ so that it points to the new node for testing. | 286 // bookmark_bb_3_ so that it points to the new node for testing. |
| 287 void UpdateBB3() { | 287 void UpdateBB3() { |
| 288 std::vector<const BookmarkNode*> nodes; | 288 std::vector<const BookmarkNode*> nodes; |
| 289 BookmarkModel* model = browser_helper_.profile()->GetBookmarkModel(); | 289 BookmarkModel* model = browser_helper_.profile()->GetBookmarkModel(); |
| 290 model->GetNodesByURL(bb3_url_1_, &nodes); | 290 model->GetNodesByURL(bb3_url_1_, &nodes); |
| 291 if (nodes.size() == 0) | 291 if (nodes.empty()) |
| 292 model->GetNodesByURL(bb3_url_2_, &nodes); | 292 model->GetNodesByURL(bb3_url_2_, &nodes); |
| 293 DCHECK(nodes.size()); | 293 DCHECK(nodes.size()); |
| 294 bookmark_bb_3_ = nodes[0]; | 294 bookmark_bb_3_ = nodes[0]; |
| 295 } | 295 } |
| 296 | 296 |
| 297 }; | 297 }; |
| 298 | 298 |
| 299 TEST_F(BookmarkEditorControllerTreeTest, VerifyBookmarkTestModel) { | 299 TEST_F(BookmarkEditorControllerTreeTest, VerifyBookmarkTestModel) { |
| 300 BookmarkModel& model(*(browser_helper_.profile()->GetBookmarkModel())); | 300 BookmarkModel& model(*(browser_helper_.profile()->GetBookmarkModel())); |
| 301 model.root_node(); | 301 model.root_node(); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 | 414 |
| 415 TEST_F(BookmarkEditorControllerTreeNoNodeTest, NewBookmarkNoNode) { | 415 TEST_F(BookmarkEditorControllerTreeNoNodeTest, NewBookmarkNoNode) { |
| 416 [controller_ setDisplayName:@"NEW BOOKMARK"]; | 416 [controller_ setDisplayName:@"NEW BOOKMARK"]; |
| 417 [controller_ setDisplayURL:@"http://NEWURL.com"]; | 417 [controller_ setDisplayURL:@"http://NEWURL.com"]; |
| 418 [controller_ ok:nil]; | 418 [controller_ ok:nil]; |
| 419 const BookmarkNode* new_node = group_bb_->GetChild(5); | 419 const BookmarkNode* new_node = group_bb_->GetChild(5); |
| 420 ASSERT_EQ(0, new_node->GetChildCount()); | 420 ASSERT_EQ(0, new_node->GetChildCount()); |
| 421 EXPECT_EQ(new_node->GetTitle(), ASCIIToUTF16("NEW BOOKMARK")); | 421 EXPECT_EQ(new_node->GetTitle(), ASCIIToUTF16("NEW BOOKMARK")); |
| 422 EXPECT_EQ(new_node->GetURL(), GURL("http://NEWURL.com")); | 422 EXPECT_EQ(new_node->GetURL(), GURL("http://NEWURL.com")); |
| 423 } | 423 } |
| OLD | NEW |