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

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

Issue 99217: Implement ID persistence for bookmarks:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/bookmarks/bookmark_model_test_utils.cc ('k') | chrome/chrome.gyp » ('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 "base/string_util.h" 5 #include "base/string_util.h"
6 #include "chrome/browser/bookmarks/bookmark_codec.h"
6 #include "chrome/browser/bookmarks/bookmark_model.h" 7 #include "chrome/browser/bookmarks/bookmark_model.h"
7 #include "chrome/browser/bookmarks/bookmark_codec.h"
8 #include "chrome/browser/bookmarks/bookmark_utils.h" 8 #include "chrome/browser/bookmarks/bookmark_utils.h"
9 #include "chrome/common/chrome_constants.h" 9 #include "chrome/common/chrome_constants.h"
10 #include "chrome/common/chrome_paths.h" 10 #include "chrome/common/chrome_paths.h"
11 #include "chrome/common/notification_registrar.h" 11 #include "chrome/common/notification_registrar.h"
12 #include "chrome/common/notification_service.h" 12 #include "chrome/common/notification_service.h"
13 #include "chrome/test/testing_profile.h" 13 #include "chrome/test/testing_profile.h"
14 #include "chrome/views/controls/tree/tree_node_model.h" 14 #include "chrome/views/controls/tree/tree_node_model.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 16
17 using base::Time; 17 using base::Time;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 int removed_count, 111 int removed_count,
112 int changed_count, 112 int changed_count,
113 int reordered_count) { 113 int reordered_count) {
114 ASSERT_EQ(added_count, this->added_count); 114 ASSERT_EQ(added_count, this->added_count);
115 ASSERT_EQ(moved_count, this->moved_count); 115 ASSERT_EQ(moved_count, this->moved_count);
116 ASSERT_EQ(removed_count, this->removed_count); 116 ASSERT_EQ(removed_count, this->removed_count);
117 ASSERT_EQ(changed_count, this->changed_count); 117 ASSERT_EQ(changed_count, this->changed_count);
118 ASSERT_EQ(reordered_count, reordered_count_); 118 ASSERT_EQ(reordered_count, reordered_count_);
119 } 119 }
120 120
121 void AssertNodesEqual(BookmarkNode* expected, BookmarkNode* actual) {
122 ASSERT_TRUE(expected);
123 ASSERT_TRUE(actual);
124 EXPECT_EQ(expected->GetTitle(), actual->GetTitle());
125 EXPECT_EQ(expected->GetType(), actual->GetType());
126 EXPECT_TRUE(expected->date_added() == actual->date_added());
127 if (expected->GetType() == history::StarredEntry::URL) {
128 EXPECT_EQ(expected->GetURL(), actual->GetURL());
129 } else {
130 EXPECT_TRUE(expected->date_group_modified() ==
131 actual->date_group_modified());
132 ASSERT_EQ(expected->GetChildCount(), actual->GetChildCount());
133 for (int i = 0; i < expected->GetChildCount(); ++i)
134 AssertNodesEqual(expected->GetChild(i), actual->GetChild(i));
135 }
136 }
137
138 void AssertModelsEqual(BookmarkModel* expected,
139 BookmarkModel* actual) {
140 AssertNodesEqual(expected->GetBookmarkBarNode(),
141 actual->GetBookmarkBarNode());
142 AssertNodesEqual(expected->other_node(),
143 actual->other_node());
144 }
145
146 BookmarkModel model; 121 BookmarkModel model;
147 122
148 int moved_count; 123 int moved_count;
149 124
150 int added_count; 125 int added_count;
151 126
152 int removed_count; 127 int removed_count;
153 128
154 int changed_count; 129 int changed_count;
155 130
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 // Make sure we were notified. 836 // Make sure we were notified.
862 AssertObserverCount(0, 0, 0, 0, 1); 837 AssertObserverCount(0, 0, 0, 0, 1);
863 838
864 // Make sure the order matches (remember, 'a' and 'C' are folders and 839 // Make sure the order matches (remember, 'a' and 'C' are folders and
865 // come first). 840 // come first).
866 EXPECT_TRUE(parent->GetChild(0)->GetTitle() == L"a"); 841 EXPECT_TRUE(parent->GetChild(0)->GetTitle() == L"a");
867 EXPECT_TRUE(parent->GetChild(1)->GetTitle() == L"C"); 842 EXPECT_TRUE(parent->GetChild(1)->GetTitle() == L"C");
868 EXPECT_TRUE(parent->GetChild(2)->GetTitle() == L"B"); 843 EXPECT_TRUE(parent->GetChild(2)->GetTitle() == L"B");
869 EXPECT_TRUE(parent->GetChild(3)->GetTitle() == L"d"); 844 EXPECT_TRUE(parent->GetChild(3)->GetTitle() == L"d");
870 } 845 }
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_model_test_utils.cc ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698