OLD | NEW |
1 // Copyright (c) 2006-2009 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 #include "chrome/browser/bookmarks/bookmark_model_test_utils.h" | 5 #include "chrome/browser/bookmarks/bookmark_model_test_utils.h" |
6 | 6 |
7 #include "chrome/browser/bookmarks/bookmark_model.h" | 7 #include "chrome/browser/bookmarks/bookmark_model.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 // static | 10 // static |
11 void BookmarkModelTestUtils::AssertNodesEqual(const BookmarkNode* expected, | 11 void BookmarkModelTestUtils::AssertNodesEqual(const BookmarkNode* expected, |
12 const BookmarkNode* actual, | 12 const BookmarkNode* actual, |
13 bool check_ids) { | 13 bool check_ids) { |
14 ASSERT_TRUE(expected); | 14 ASSERT_TRUE(expected); |
15 ASSERT_TRUE(actual); | 15 ASSERT_TRUE(actual); |
16 if (check_ids) | 16 if (check_ids) |
17 EXPECT_EQ(expected->id(), actual->id()); | 17 EXPECT_EQ(expected->id(), actual->id()); |
18 EXPECT_EQ(expected->GetTitle(), actual->GetTitle()); | 18 EXPECT_EQ(expected->GetTitleAsString16(), actual->GetTitleAsString16()); |
19 EXPECT_EQ(expected->type(), actual->type()); | 19 EXPECT_EQ(expected->type(), actual->type()); |
20 EXPECT_TRUE(expected->date_added() == actual->date_added()); | 20 EXPECT_TRUE(expected->date_added() == actual->date_added()); |
21 if (expected->type() == BookmarkNode::URL) { | 21 if (expected->type() == BookmarkNode::URL) { |
22 EXPECT_EQ(expected->GetURL(), actual->GetURL()); | 22 EXPECT_EQ(expected->GetURL(), actual->GetURL()); |
23 } else { | 23 } else { |
24 EXPECT_TRUE(expected->date_group_modified() == | 24 EXPECT_TRUE(expected->date_group_modified() == |
25 actual->date_group_modified()); | 25 actual->date_group_modified()); |
26 ASSERT_EQ(expected->GetChildCount(), actual->GetChildCount()); | 26 ASSERT_EQ(expected->GetChildCount(), actual->GetChildCount()); |
27 for (int i = 0; i < expected->GetChildCount(); ++i) | 27 for (int i = 0; i < expected->GetChildCount(); ++i) |
28 AssertNodesEqual(expected->GetChild(i), actual->GetChild(i), check_ids); | 28 AssertNodesEqual(expected->GetChild(i), actual->GetChild(i), check_ids); |
29 } | 29 } |
30 } | 30 } |
31 | 31 |
32 // static | 32 // static |
33 void BookmarkModelTestUtils::AssertModelsEqual(BookmarkModel* expected, | 33 void BookmarkModelTestUtils::AssertModelsEqual(BookmarkModel* expected, |
34 BookmarkModel* actual, | 34 BookmarkModel* actual, |
35 bool check_ids) { | 35 bool check_ids) { |
36 AssertNodesEqual(expected->GetBookmarkBarNode(), | 36 AssertNodesEqual(expected->GetBookmarkBarNode(), |
37 actual->GetBookmarkBarNode(), | 37 actual->GetBookmarkBarNode(), |
38 check_ids); | 38 check_ids); |
39 AssertNodesEqual(expected->other_node(), | 39 AssertNodesEqual(expected->other_node(), |
40 actual->other_node(), | 40 actual->other_node(), |
41 check_ids); | 41 check_ids); |
42 } | 42 } |
43 | 43 |
OLD | NEW |