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

Side by Side Diff: chrome/browser/bookmarks/bookmark_model_unittest.cc

Issue 149310: Always persist bookmark IDs.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/bookmarks/bookmark_model.cc ('k') | chrome/browser/bookmarks/bookmark_storage.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "app/tree_node_iterator.h" 5 #include "app/tree_node_iterator.h"
6 #include "app/tree_node_model.h" 6 #include "app/tree_node_model.h"
7 #include "base/hash_tables.h" 7 #include "base/hash_tables.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "chrome/browser/bookmarks/bookmark_codec.h" 9 #include "chrome/browser/bookmarks/bookmark_codec.h"
10 #include "chrome/browser/bookmarks/bookmark_model.h" 10 #include "chrome/browser/bookmarks/bookmark_model.h"
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 } else { 588 } else {
589 // No need to check the URL, just the title is enough. 589 // No need to check the URL, just the title is enough.
590 ASSERT_TRUE(actual_child->GetType() == 590 ASSERT_TRUE(actual_child->GetType() ==
591 history::StarredEntry::URL); 591 history::StarredEntry::URL);
592 } 592 }
593 } 593 }
594 } 594 }
595 595
596 void VerifyNoDuplicateIDs(BookmarkModel* model) { 596 void VerifyNoDuplicateIDs(BookmarkModel* model) {
597 TreeNodeIterator<const BookmarkNode> it(model->root_node()); 597 TreeNodeIterator<const BookmarkNode> it(model->root_node());
598 base::hash_set<int> ids; 598 base::hash_set<int64> ids;
599 while (it.has_next()) 599 while (it.has_next())
600 ASSERT_TRUE(ids.insert(it.Next()->id()).second); 600 ASSERT_TRUE(ids.insert(it.Next()->id()).second);
601 } 601 }
602 602
603 void BlockTillBookmarkModelLoaded() { 603 void BlockTillBookmarkModelLoaded() {
604 bb_model_ = profile_->GetBookmarkModel(); 604 bb_model_ = profile_->GetBookmarkModel();
605 if (!bb_model_->IsLoaded()) 605 if (!bb_model_->IsLoaded())
606 BlockTillLoaded(bb_model_); 606 BlockTillLoaded(bb_model_);
607 else 607 else
608 bb_model_->AddObserver(this); 608 bb_model_->AddObserver(this);
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 // Make sure we were notified. 853 // Make sure we were notified.
854 AssertObserverCount(0, 0, 0, 0, 1); 854 AssertObserverCount(0, 0, 0, 0, 1);
855 855
856 // Make sure the order matches (remember, 'a' and 'C' are folders and 856 // Make sure the order matches (remember, 'a' and 'C' are folders and
857 // come first). 857 // come first).
858 EXPECT_TRUE(parent->GetChild(0)->GetTitle() == L"a"); 858 EXPECT_TRUE(parent->GetChild(0)->GetTitle() == L"a");
859 EXPECT_TRUE(parent->GetChild(1)->GetTitle() == L"C"); 859 EXPECT_TRUE(parent->GetChild(1)->GetTitle() == L"C");
860 EXPECT_TRUE(parent->GetChild(2)->GetTitle() == L"B"); 860 EXPECT_TRUE(parent->GetChild(2)->GetTitle() == L"B");
861 EXPECT_TRUE(parent->GetChild(3)->GetTitle() == L"d"); 861 EXPECT_TRUE(parent->GetChild(3)->GetTitle() == L"d");
862 } 862 }
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_model.cc ('k') | chrome/browser/bookmarks/bookmark_storage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698