OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/base_paths.h" | 8 #include "base/base_paths.h" |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
13 #include "base/hash_tables.h" | 13 #include "base/hash_tables.h" |
14 #include "base/path_service.h" | 14 #include "base/path_service.h" |
15 #include "base/string16.h" | 15 #include "base/string16.h" |
16 #include "base/string_number_conversions.h" | 16 #include "base/string_number_conversions.h" |
17 #include "base/string_split.h" | 17 #include "base/string_split.h" |
18 #include "base/string_util.h" | 18 #include "base/string_util.h" |
19 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
20 #include "chrome/browser/bookmarks/bookmark_model.h" | 20 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 21 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
21 #include "chrome/browser/bookmarks/bookmark_model_observer.h" | 22 #include "chrome/browser/bookmarks/bookmark_model_observer.h" |
22 #include "chrome/browser/bookmarks/bookmark_utils.h" | 23 #include "chrome/browser/bookmarks/bookmark_utils.h" |
23 #include "chrome/browser/history/history_notifications.h" | 24 #include "chrome/browser/history/history_notifications.h" |
24 #include "chrome/browser/history/history_service_factory.h" | 25 #include "chrome/browser/history/history_service_factory.h" |
25 #include "chrome/common/chrome_constants.h" | 26 #include "chrome/common/chrome_constants.h" |
26 #include "chrome/common/chrome_notification_types.h" | 27 #include "chrome/common/chrome_notification_types.h" |
27 #include "chrome/common/chrome_paths.h" | 28 #include "chrome/common/chrome_paths.h" |
28 #include "chrome/common/chrome_switches.h" | 29 #include "chrome/common/chrome_switches.h" |
29 #include "chrome/test/base/model_test_utils.h" | 30 #include "chrome/test/base/model_test_utils.h" |
30 #include "chrome/test/base/testing_profile.h" | 31 #include "chrome/test/base/testing_profile.h" |
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 } | 818 } |
818 | 819 |
819 void VerifyNoDuplicateIDs(BookmarkModel* model) { | 820 void VerifyNoDuplicateIDs(BookmarkModel* model) { |
820 ui::TreeNodeIterator<const BookmarkNode> it(model->root_node()); | 821 ui::TreeNodeIterator<const BookmarkNode> it(model->root_node()); |
821 base::hash_set<int64> ids; | 822 base::hash_set<int64> ids; |
822 while (it.has_next()) | 823 while (it.has_next()) |
823 ASSERT_TRUE(ids.insert(it.Next()->id()).second); | 824 ASSERT_TRUE(ids.insert(it.Next()->id()).second); |
824 } | 825 } |
825 | 826 |
826 void BlockTillBookmarkModelLoaded() { | 827 void BlockTillBookmarkModelLoaded() { |
827 bb_model_ = profile_->GetBookmarkModel(); | 828 bb_model_ = BookmarkModelFactory::GetForProfile(profile_.get()); |
828 profile_->BlockUntilBookmarkModelLoaded(); | 829 profile_->BlockUntilBookmarkModelLoaded(); |
829 } | 830 } |
830 | 831 |
831 // Destroys the current profile, creates a new one and creates the history | 832 // Destroys the current profile, creates a new one and creates the history |
832 // service. | 833 // service. |
833 void RecreateProfile() { | 834 void RecreateProfile() { |
834 // Need to shutdown the old one before creating a new one. | 835 // Need to shutdown the old one before creating a new one. |
835 profile_.reset(NULL); | 836 profile_.reset(NULL); |
836 profile_.reset(new TestingProfile()); | 837 profile_.reset(new TestingProfile()); |
837 profile_->CreateHistoryService(true, false); | 838 profile_->CreateHistoryService(true, false); |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1160 AssertExtensiveChangesObserverCount(1, 0); | 1161 AssertExtensiveChangesObserverCount(1, 0); |
1161 model_.EndExtensiveChanges(); | 1162 model_.EndExtensiveChanges(); |
1162 EXPECT_TRUE(model_.IsDoingExtensiveChanges()); | 1163 EXPECT_TRUE(model_.IsDoingExtensiveChanges()); |
1163 AssertExtensiveChangesObserverCount(1, 0); | 1164 AssertExtensiveChangesObserverCount(1, 0); |
1164 model_.EndExtensiveChanges(); | 1165 model_.EndExtensiveChanges(); |
1165 EXPECT_FALSE(model_.IsDoingExtensiveChanges()); | 1166 EXPECT_FALSE(model_.IsDoingExtensiveChanges()); |
1166 AssertExtensiveChangesObserverCount(1, 1); | 1167 AssertExtensiveChangesObserverCount(1, 1); |
1167 } | 1168 } |
1168 | 1169 |
1169 } // namespace | 1170 } // namespace |
OLD | NEW |