| 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/time.h" |
| 19 #include "base/utf_string_conversions.h" | 20 #include "base/utf_string_conversions.h" |
| 20 #include "chrome/browser/bookmarks/bookmark_model.h" | 21 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 21 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 22 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 22 #include "chrome/browser/bookmarks/bookmark_model_observer.h" | 23 #include "chrome/browser/bookmarks/bookmark_model_observer.h" |
| 23 #include "chrome/browser/bookmarks/bookmark_utils.h" | 24 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 24 #include "chrome/browser/history/history_notifications.h" | 25 #include "chrome/browser/history/history_notifications.h" |
| 25 #include "chrome/browser/history/history_service_factory.h" | 26 #include "chrome/browser/history/history_service_factory.h" |
| 26 #include "chrome/common/chrome_constants.h" | 27 #include "chrome/common/chrome_constants.h" |
| 27 #include "chrome/common/chrome_notification_types.h" | 28 #include "chrome/common/chrome_notification_types.h" |
| 28 #include "chrome/common/chrome_paths.h" | 29 #include "chrome/common/chrome_paths.h" |
| (...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 938 profile_->CreateHistoryService(false, false); | 939 profile_->CreateHistoryService(false, false); |
| 939 profile_->CreateBookmarkModel(true); | 940 profile_->CreateBookmarkModel(true); |
| 940 BlockTillBookmarkModelLoaded(); | 941 BlockTillBookmarkModelLoaded(); |
| 941 | 942 |
| 942 // Add a URL. | 943 // Add a URL. |
| 943 GURL url("http://www.google.com"); | 944 GURL url("http://www.google.com"); |
| 944 bookmark_utils::AddIfNotBookmarked(bb_model_, url, string16()); | 945 bookmark_utils::AddIfNotBookmarked(bb_model_, url, string16()); |
| 945 | 946 |
| 946 HistoryServiceFactory::GetForProfile( | 947 HistoryServiceFactory::GetForProfile( |
| 947 profile_.get(), Profile::EXPLICIT_ACCESS)->AddPage( | 948 profile_.get(), Profile::EXPLICIT_ACCESS)->AddPage( |
| 948 url, NULL, 1, GURL(), content::PAGE_TRANSITION_TYPED, | 949 url, base::Time::Now(), NULL, 1, GURL(), history::RedirectList(), |
| 949 history::RedirectList(), history::SOURCE_BROWSED, false); | 950 content::PAGE_TRANSITION_TYPED, history::SOURCE_BROWSED, false); |
| 950 | 951 |
| 951 // This won't actually delete the URL, rather it'll empty out the visits. | 952 // This won't actually delete the URL, rather it'll empty out the visits. |
| 952 // This triggers blocking on the BookmarkModel. | 953 // This triggers blocking on the BookmarkModel. |
| 953 HistoryServiceFactory::GetForProfile( | 954 HistoryServiceFactory::GetForProfile( |
| 954 profile_.get(), Profile::EXPLICIT_ACCESS)->DeleteURL(url); | 955 profile_.get(), Profile::EXPLICIT_ACCESS)->DeleteURL(url); |
| 955 } | 956 } |
| 956 | 957 |
| 957 TEST_F(BookmarkModelTest, Sort) { | 958 TEST_F(BookmarkModelTest, Sort) { |
| 958 // Populate the bookmark bar node with nodes for 'B', 'a', 'd' and 'C'. | 959 // Populate the bookmark bar node with nodes for 'B', 'a', 'd' and 'C'. |
| 959 // 'C' and 'a' are folders. | 960 // 'C' and 'a' are folders. |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1041 AssertExtensiveChangesObserverCount(1, 0); | 1042 AssertExtensiveChangesObserverCount(1, 0); |
| 1042 model_.EndExtensiveChanges(); | 1043 model_.EndExtensiveChanges(); |
| 1043 EXPECT_TRUE(model_.IsDoingExtensiveChanges()); | 1044 EXPECT_TRUE(model_.IsDoingExtensiveChanges()); |
| 1044 AssertExtensiveChangesObserverCount(1, 0); | 1045 AssertExtensiveChangesObserverCount(1, 0); |
| 1045 model_.EndExtensiveChanges(); | 1046 model_.EndExtensiveChanges(); |
| 1046 EXPECT_FALSE(model_.IsDoingExtensiveChanges()); | 1047 EXPECT_FALSE(model_.IsDoingExtensiveChanges()); |
| 1047 AssertExtensiveChangesObserverCount(1, 1); | 1048 AssertExtensiveChangesObserverCount(1, 1); |
| 1048 } | 1049 } |
| 1049 | 1050 |
| 1050 } // namespace | 1051 } // namespace |
| OLD | NEW |