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

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

Issue 342068: Third patch in getting rid of caching MessageLoop pointers and always using C... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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
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 <set> 5 #include <set>
6 6
7 #include "app/tree_node_iterator.h" 7 #include "app/tree_node_iterator.h"
8 #include "app/tree_node_model.h" 8 #include "app/tree_node_model.h"
9 #include "base/hash_tables.h" 9 #include "base/hash_tables.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 } 555 }
556 } 556 }
557 } 557 }
558 558
559 } // namespace 559 } // namespace
560 560
561 // Test class that creates a BookmarkModel with a real history backend. 561 // Test class that creates a BookmarkModel with a real history backend.
562 class BookmarkModelTestWithProfile : public testing::Test, 562 class BookmarkModelTestWithProfile : public testing::Test,
563 public BookmarkModelObserver { 563 public BookmarkModelObserver {
564 public: 564 public:
565 BookmarkModelTestWithProfile()
566 : ui_thread_(ChromeThread::UI, &message_loop_),
567 file_thread_(ChromeThread::FILE, &message_loop_) {}
568
565 virtual void SetUp() { 569 virtual void SetUp() {
566 } 570 }
567 571
568 virtual void TearDown() { 572 virtual void TearDown() {
569 profile_.reset(NULL); 573 profile_.reset(NULL);
570 } 574 }
571 575
572 // The profile. 576 // The profile.
573 scoped_ptr<TestingProfile> profile_; 577 scoped_ptr<TestingProfile> profile_;
574 578
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 int old_index, 649 int old_index,
646 const BookmarkNode* node) {} 650 const BookmarkNode* node) {}
647 virtual void BookmarkNodeChanged(BookmarkModel* model, 651 virtual void BookmarkNodeChanged(BookmarkModel* model,
648 const BookmarkNode* node) {} 652 const BookmarkNode* node) {}
649 virtual void BookmarkNodeChildrenReordered(BookmarkModel* model, 653 virtual void BookmarkNodeChildrenReordered(BookmarkModel* model,
650 const BookmarkNode* node) {} 654 const BookmarkNode* node) {}
651 virtual void BookmarkNodeFavIconLoaded(BookmarkModel* model, 655 virtual void BookmarkNodeFavIconLoaded(BookmarkModel* model,
652 const BookmarkNode* node) {} 656 const BookmarkNode* node) {}
653 657
654 MessageLoopForUI message_loop_; 658 MessageLoopForUI message_loop_;
659 ChromeThread ui_thread_;
660 ChromeThread file_thread_;
655 }; 661 };
656 662
657 // Creates a set of nodes in the bookmark bar model, then recreates the 663 // Creates a set of nodes in the bookmark bar model, then recreates the
658 // bookmark bar model which triggers loading from the db and checks the loaded 664 // bookmark bar model which triggers loading from the db and checks the loaded
659 // structure to make sure it is what we first created. 665 // structure to make sure it is what we first created.
660 TEST_F(BookmarkModelTestWithProfile, CreateAndRestore) { 666 TEST_F(BookmarkModelTestWithProfile, CreateAndRestore) {
661 struct TestData { 667 struct TestData {
662 // Structure of the children of the bookmark bar model node. 668 // Structure of the children of the bookmark bar model node.
663 const std::wstring bbn_contents; 669 const std::wstring bbn_contents;
664 // Structure of the children of the other node. 670 // Structure of the children of the other node.
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
891 // Make sure we were notified. 897 // Make sure we were notified.
892 AssertObserverCount(0, 0, 0, 0, 1); 898 AssertObserverCount(0, 0, 0, 0, 1);
893 899
894 // Make sure the order matches (remember, 'a' and 'C' are folders and 900 // Make sure the order matches (remember, 'a' and 'C' are folders and
895 // come first). 901 // come first).
896 EXPECT_TRUE(parent->GetChild(0)->GetTitle() == L"a"); 902 EXPECT_TRUE(parent->GetChild(0)->GetTitle() == L"a");
897 EXPECT_TRUE(parent->GetChild(1)->GetTitle() == L"C"); 903 EXPECT_TRUE(parent->GetChild(1)->GetTitle() == L"C");
898 EXPECT_TRUE(parent->GetChild(2)->GetTitle() == L"B"); 904 EXPECT_TRUE(parent->GetChild(2)->GetTitle() == L"B");
899 EXPECT_TRUE(parent->GetChild(3)->GetTitle() == L"d"); 905 EXPECT_TRUE(parent->GetChild(3)->GetTitle() == L"d");
900 } 906 }
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_index_unittest.cc ('k') | chrome/browser/bookmarks/bookmark_storage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698