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

Side by Side Diff: components/bookmarks/browser/bookmark_index_unittest.cc

Issue 1105413002: Avoid conversion of index to BookmarkNode pointer unnacessarily. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes as per review comments. Created 5 years, 7 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "components/bookmarks/browser/bookmark_index.h" 5 #include "components/bookmarks/browser/bookmark_index.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 } 445 }
446 } 446 }
447 447
448 // Makes sure index is updated when a node is removed. 448 // Makes sure index is updated when a node is removed.
449 TEST_F(BookmarkIndexTest, Remove) { 449 TEST_F(BookmarkIndexTest, Remove) {
450 const char* titles[] = { "a", "b" }; 450 const char* titles[] = { "a", "b" };
451 const char* urls[] = {kAboutBlankURL, kAboutBlankURL}; 451 const char* urls[] = {kAboutBlankURL, kAboutBlankURL};
452 AddBookmarks(titles, urls, arraysize(titles)); 452 AddBookmarks(titles, urls, arraysize(titles));
453 453
454 // Remove the node and make sure we don't get back any results. 454 // Remove the node and make sure we don't get back any results.
455 model_->Remove(model_->other_node(), 0); 455 model_->Remove(model_->other_node()->GetChild(0));
456 ExpectMatches("A", NULL, 0U); 456 ExpectMatches("A", NULL, 0U);
457 } 457 }
458 458
459 // Makes sure index is updated when a node's title is changed. 459 // Makes sure index is updated when a node's title is changed.
460 TEST_F(BookmarkIndexTest, ChangeTitle) { 460 TEST_F(BookmarkIndexTest, ChangeTitle) {
461 const char* titles[] = { "a", "b" }; 461 const char* titles[] = { "a", "b" };
462 const char* urls[] = {kAboutBlankURL, kAboutBlankURL}; 462 const char* urls[] = {kAboutBlankURL, kAboutBlankURL};
463 AddBookmarks(titles, urls, arraysize(titles)); 463 AddBookmarks(titles, urls, arraysize(titles));
464 464
465 // Remove the node and make sure we don't get back any results. 465 // Remove the node and make sure we don't get back any results.
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 // Select top two matches. 548 // Select top two matches.
549 model->GetBookmarksMatching(ASCIIToUTF16("google"), 2, &matches); 549 model->GetBookmarksMatching(ASCIIToUTF16("google"), 2, &matches);
550 550
551 ASSERT_EQ(2U, matches.size()); 551 ASSERT_EQ(2U, matches.size());
552 EXPECT_EQ(data[0].url, matches[0].node->url()); 552 EXPECT_EQ(data[0].url, matches[0].node->url());
553 EXPECT_EQ(data[3].url, matches[1].node->url()); 553 EXPECT_EQ(data[3].url, matches[1].node->url());
554 } 554 }
555 555
556 } // namespace 556 } // namespace
557 } // namespace bookmarks 557 } // namespace bookmarks
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698