OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/bookmarks/bookmark_model_test_utils.h" |
| 6 |
| 7 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 |
| 10 // static |
| 11 void BookmarkModelTestUtils::AssertNodesEqual(BookmarkNode* expected, |
| 12 BookmarkNode* actual, |
| 13 bool check_ids) { |
| 14 ASSERT_TRUE(expected); |
| 15 ASSERT_TRUE(actual); |
| 16 if (check_ids) |
| 17 EXPECT_EQ(expected->id(), actual->id()); |
| 18 EXPECT_EQ(expected->GetTitle(), actual->GetTitle()); |
| 19 EXPECT_EQ(expected->GetType(), actual->GetType()); |
| 20 EXPECT_TRUE(expected->date_added() == actual->date_added()); |
| 21 if (expected->GetType() == history::StarredEntry::URL) { |
| 22 EXPECT_EQ(expected->GetURL(), actual->GetURL()); |
| 23 } else { |
| 24 EXPECT_TRUE(expected->date_group_modified() == |
| 25 actual->date_group_modified()); |
| 26 ASSERT_EQ(expected->GetChildCount(), actual->GetChildCount()); |
| 27 for (int i = 0; i < expected->GetChildCount(); ++i) |
| 28 AssertNodesEqual(expected->GetChild(i), actual->GetChild(i), check_ids); |
| 29 } |
| 30 } |
| 31 |
| 32 // static |
| 33 void BookmarkModelTestUtils::AssertModelsEqual(BookmarkModel* expected, |
| 34 BookmarkModel* actual, |
| 35 bool check_ids) { |
| 36 AssertNodesEqual(expected->GetBookmarkBarNode(), |
| 37 actual->GetBookmarkBarNode(), |
| 38 check_ids); |
| 39 AssertNodesEqual(expected->other_node(), |
| 40 actual->other_node(), |
| 41 check_ids); |
| 42 } |
| 43 |
OLD | NEW |